Skip to content

fix(auth): enforce Sentinel authorization boundaries - #131

Merged
BK1031 merged 4 commits into
mainfrom
bk1031/sentinel-scope-boundaries
Sep 9, 2026
Merged

fix(auth): enforce Sentinel authorization boundaries#131
BK1031 merged 4 commits into
mainfrom
bk1031/sentinel-scope-boundaries

Conversation

@BK1031

@BK1031 BK1031 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor
  • Reserve sentinel:internal for allowlisted Sentinel service accounts and rotate existing internal credentials at startup
  • Keep sentinel:all as the first-party user scope while requiring self, owner, or Admins authorization for writes
  • Gate generic reads by resource scopes and preserve stricter authorization for secrets, audit data, and login history
  • Centralize group authorization in Core for Discord and Google integration writes
  • Add the missing groups:write OAuth scope and keep both Sentinel-only scopes out of third-party consent

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-09T20:15:07.790669Z a2782f5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a2782f5b91

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread core/api/user.go
RequestTokenHasAudience(c, "sentinel"),
RequestTokenHasScope(c, "sentinel:all"),
))
Require(c, RequestTokenHasResourceScope(c, authz.UserReadScope))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restrict bulk user reads to trusted callers

When a third-party OAuth app is granted user:read, RequestTokenHasResourceScope succeeds without checking the audience or subject, so GET /users now returns every user. GetAllUsers populates fields including email, phone number, birthday, clothing sizes, and SAE registration number, even though the consent UI describes this scope as reading “your profile”; before this change the collection was limited to Sentinel callers. Keep the bulk directory first-party/admin/internal-only or return an appropriately sanitized directory response.

Useful? React with 👍 / 👎.

Comment thread core/api/entity.go
RequestTokenHasEntityID(c, entityID),
RequestUserIsAdmin(c),
))
Require(c, RequestTokenHasResourceScope(c, authz.UserReadScope))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Retain subject checks on entity reads

For a third-party token with user:read, this gate now permits requesting any entityID, rather than only the token subject. service.GetEntityByID populates email and phone authentication records plus EntityExternalAuth rows whose JSON includes provider access_token and refresh_token fields, so a known entity ID—obtainable from the newly exposed /users collection—can disclose another user's PII and stored provider credentials. Preserve the previous self/admin/internal restriction or expose a sanitized profile DTO for scoped reads.

Useful? React with 👍 / 👎.

@BK1031
BK1031 merged commit a074a9b into main Sep 9, 2026
19 checks passed
@BK1031
BK1031 deleted the bk1031/sentinel-scope-boundaries branch September 9, 2026 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant