Skip to content

Commit

Permalink
Merge branch 'pds-proxy-headers' into rm-basic-auth
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed Mar 6, 2024
2 parents 9d5d762 + 5b6b9ee commit f583ba9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/ozone/src/mod-service/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ export class ModerationService {
const isSafeUrl = (url: URL) => {
if (url.protocol !== 'https:') return false
if (!url.hostname || url.hostname === 'localhost') return false
if (net.isIP(url.hostname) === 0) return false
if (net.isIP(url.hostname) !== 0) return false
return true
}

Expand Down
11 changes: 10 additions & 1 deletion packages/pds/src/auth-verifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,18 @@ export class AuthVerifier {
throw new AuthRequiredError('Untrusted issuer', 'UntrustedIss')
}
const payload = await this.verifyServiceJwt(reqCtx, {
aud: this.dids.entryway ?? this.dids.pds,
aud: null,
iss: [this.dids.modService, `${this.dids.modService}#atproto_labeler`],
})
if (
payload.aud !== this.dids.pds &&
(!this.dids.entryway || payload.aud !== this.dids.entryway)
) {
throw new AuthRequiredError(
'jwt audience does not match service did',
'BadJwtAudience',
)
}
return {
credentials: {
type: 'mod_service',
Expand Down

0 comments on commit f583ba9

Please sign in to comment.