Skip to content

Commit

Permalink
feat: prevent passing in role claim in presigned URL JWTs
Browse files Browse the repository at this point in the history
  • Loading branch information
hf committed Jul 14, 2024
1 parent f6d2fbc commit c97ba49
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/storage/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,10 @@ export class ObjectStorage {
return all
}, metadata || {})

// security-in-depth: as signObjectUrl could be used as a signing oracle,
// make sure it's never able to specify a role JWT claim
delete metadata['role']

const urlParts = url.split('/')
const urlToSign = decodeURI(urlParts.splice(3).join('/'))
const { secret: jwtSecret } = await getJwtSecret(this.db.tenantId)
Expand Down

0 comments on commit c97ba49

Please sign in to comment.