Skip to content

feat(core): add scoped impersonation tokens - #129

Open
BK1031 wants to merge 1 commit into
mainfrom
bk1031/impersonation-token
Open

feat(core): add scoped impersonation tokens#129
BK1031 wants to merge 1 commit into
mainfrom
bk1031/impersonation-token

Conversation

@BK1031

@BK1031 BK1031 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor
  • Add a service-account-only endpoint for issuing user impersonation tokens to a target application
  • Issue five-minute JWTs with authoritative user/group claims and an RFC 8693 actor claim
  • Use sentinel:all for the Sentinel application and user:read groups:read for other applications
  • Enforce application group gates and restrict sentinel:impersonate grants to privileged service-account creators
  • Persist the actor on token records and audit every impersonation issuance

@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-09T05:55:23.057109Z 7b14285 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: 7b142859af

ℹ️ 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 on lines +97 to +98
if RequestTokenHasScope(c, "sentinel:all") || RequestUserIsAdmin(c) {
validateScope = service.ValidatePrivilegedServiceAccountScope

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 Recheck privileged scope authorization during rotation

When an admin creates a service account carrying sentinel:impersonate for an application owned by somebody else, that application's non-admin owner can call the existing rotate endpoint, which reuses the stored scope and returns the new raw token. This bypasses the new creation-time restriction and gives an unprivileged owner an impersonation credential; rotation must apply the privileged-scope authorization as well.

Useful? React with 👍 / 👎.

}

func impersonationGroups(entityID string, application model.Application) ([]model.Group, error) {
userGroups, err := GetGroupsForEntity(entityID)

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 Exclude expired memberships from impersonation groups

GetGroupsForEntity returns every group_member row without checking has_expiration or expires_at, so a user whose required membership has expired still passes passesApplicationGate, and the expired group is embedded in the impersonation token. Load only active memberships here before enforcing the application gate and constructing authoritative group claims.

Useful? React with 👍 / 👎.

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