Skip to content

fix(core): stop rotating internal tokens on startup - #132

Open
BK1031 wants to merge 1 commit into
mainfrom
bk1031/remove-internal-scope-migration
Open

fix(core): stop rotating internal tokens on startup#132
BK1031 wants to merge 1 commit into
mainfrom
bk1031/remove-internal-scope-migration

Conversation

@BK1031

@BK1031 BK1031 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor
  • Remove the completed sentinel:internal scope migration from core startup
  • Leave mismatched service-account scopes untouched and log the configuration error
  • Preserve fresh internal account creation and missing-token recovery

@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: 6dc2515e5c

ℹ️ 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/jobs/init.go
Comment on lines 251 to +258
if sa.Scope != authz.SentinelInternalScope {
if err := database.DB.Model(&model.ServiceAccount{}).
Where("id = ?", sa.ID).
Updates(map[string]any{
"scope": authz.SentinelInternalScope,
"signed_token": "",
}).Error; err != nil {
logger.SugarLogger.Errorf("Failed to migrate internal SA %s scope: %v", name, err)
continue
}
sa.Scope = authz.SentinelInternalScope
sa.SignedToken = ""
logger.SugarLogger.Errorf(
"Internal service account %s has scope %q; expected %q",
name,
sa.Scope,
authz.SentinelInternalScope,
)
continue

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 the scope migration for skipped releases

When an installation upgrades directly from v5.10.7 or earlier to a release containing this commit, its existing internal service accounts still have the previously seeded sentinel:all scope because it never ran the migration introduced immediately before v5.11.0. This branch now only logs the mismatch; BootstrapToken rejects the account at core/api/bootstrap.go:82-85, and every non-core service treats bootstrap failure as fatal, leaving OAuth, Discord, SAML, and Google in restart loops. Keep the idempotent migration, or otherwise support skipped releases without rotating tokens whose scope is already correct.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

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-10T02:26:05.257089Z 6dc2515 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.

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