Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: handle authentication on top level routes #542

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

fenos
Copy link
Contributor

@fenos fenos commented Sep 5, 2024

What kind of change does this PR introduce?

Feature

What is the current behavior?

Currently, we use /public and /authenticated endpoints to determine the access control

What is the new behavior?

This PR modifies the route without the /public or /authenticated endpoint, which allows authentication to happen at the route level.

This fixes many issues on downloading objects or fetching info without knowing their privacy control

@fenos fenos force-pushed the feat/handle-auth-on-top-level-routes branch from 08d7d88 to 5ca0b11 Compare September 5, 2024 11:20
@coveralls
Copy link

coveralls commented Sep 5, 2024

Pull Request Test Coverage Report for Build 10739955625

Details

  • 63 of 73 (86.3%) changed or added relevant lines in 5 files are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.03%) to 78.768%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/storage/storage.ts 3 4 75.0%
src/http/routes/object/getObject.ts 28 30 93.33%
src/http/routes/object/getObjectInfo.ts 19 21 90.48%
src/http/plugins/jwt.ts 12 17 70.59%
Files with Coverage Reduction New Missed Lines %
src/http/routes/object/getObjectInfo.ts 2 95.79%
src/storage/database/knex.ts 2 87.56%
Totals Coverage Status
Change from base Build 10526353108: 0.03%
Covered Lines: 13427
Relevant Lines: 16899

💛 - Coveralls

@fenos fenos force-pushed the feat/handle-auth-on-top-level-routes branch from 5ca0b11 to 6404438 Compare September 6, 2024 14:14
@fenos fenos merged commit 040871f into master Sep 6, 2024
1 check passed
@fenos fenos deleted the feat/handle-auth-on-top-level-routes branch September 6, 2024 14:20
Copy link

github-actions bot commented Sep 6, 2024

🎉 This PR is included in version 1.11.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@criskell
Copy link

criskell commented Nov 16, 2024

This PR doesn't seem to be working in production @fenos
Without prefix:
image
With prefix:
image
Maybe related with this issue in storage-js:
supabase/storage-js#209
The info method uses the unprefixed version
https://github.com/supabase/storage-js/blob/b225a4d8a77fb6336b6e4cc7e0d4fe52ddca6c85/src/packages/StorageFileApi.ts#L565
I was facing the same problem, and when using this way:

await supabase.storage.from('<bucketName>').info('../authenticated/<bucketName>/<pathName>')

It worked.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants