Repository navigation
feat(github): repo-scoped token seam and installation-token scrubbing (abilityai/trinity-enterprise#1277) - #4624
Merged
Merged
Conversation
…Abilityai/trinity-enterprise#1277) Open-core half of GitHub App authentication. - services/github_token_provider.py: a seam through which a registered provider supplies a short-lived token scoped to one repository. Inert with no provider registered. - settings_service.resolve_github_token(repo, agent_name, owner_id, permissions): per-agent PAT, per-user PAT, provider, platform PAT. Returns (token, tier, expires_at). A provider failure on a covered repo raises GithubTokenUnavailable; the platform PAT is used only when the provider answers "not covered". - resolve_github_pat, resolve_github_pat_candidates and get_github_pat_for_agent are unchanged and never consult the provider. Their answers are persisted or baked into a container environment. - github_app_credentials joins SECRET_SETTING_KEYS: encrypted at rest, refused in cleartext, covered by key rotation. settings_service.get_stored_secret_setting reads it with no env leg. - Installation tokens (ghs_<appid>_<JWT>, about 390 characters, with ".", "-", "_") are redacted whole by both credential_sanitizer copies, scrub.js and reportSummary.js. The pattern matches by structure with bounded quantifiers, so it is linear on repeated prefixes and leaves ordinary text such as "boroughs_population_2020-2024_final.csv" alone. - enterprise-docs-guard: the new seam file joins SEAM_FILES. Refs Abilityai/trinity-enterprise#1277 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
Author
|
Private half: abilityai/trinity-enterprise#1281 (draft until this is on |
… refuses non-secret keys (#4624) Mechanical, per the merge-train note on the PR. - resolve_github_token docstring states that it does no per-caller authorization and passes permissions through unvalidated. - get_stored_secret_setting raises for a key outside SECRET_SETTING_KEYS, so the lazy legacy migration can never run on an ordinary setting; one test. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
|
merge-train (2026-11-17): on the train. One commit pushed to this branch and the body patched. Validated at Pushed
Body: Ruling at Gate 1: the key and tier names in the public seam are fine as they are (recorded on the linked issue). For you, not blocking this merge:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
services/github_token_provider.py, through which a registered provider supplies a short-lived GitHub token scoped to one repository. With no provider registered it is inert and resolution is PAT-only.settings_service.resolve_github_token(repo, agent_name, owner_id, permissions) -> (token, tier, expires_at). Order: per-agent PAT, per-user PAT, provider (app), platform PAT.ghs_<appid>_<JWT>, about 390 characters) in all four scrubbers.No call site uses the new resolver yet. Existing behaviour is unchanged.
Changes
src/backend/services/github_token_provider.py(new):register_provider,token_for_repo,RepoToken,GithubTokenUnavailable,normalize_repo.src/backend/services/settings_service.py:resolve_github_token,get_stored_secret_setting.resolve_github_pat,resolve_github_pat_candidatesandget_github_pat_for_agentare untouched and never consult the provider; their answers are persisted or baked into a container environment, and a provider token expires within the hour.src/backend/services/secret_settings.py:github_app_credentialsjoinsSECRET_SETTING_KEYS(encrypted at rest, refused in cleartext, covered by key rotation).src/backend/utils/credential_sanitizer.py,docker/base-image/agent_server/utils/credential_sanitizer.py,src/frontend/src/utils/scrub.js,src/frontend/src/components/reports/reportSummary.js: installation-token pattern. Matched by structure with bounded quantifiers..github/workflows/enterprise-docs-guard.yml: the new seam file joinsSEAM_FILES.docs/memory/requirements/github.md§11.20,docs/memory/architecture/backend.md.Behaviour worth reviewing
GithubTokenUnavailable. The platform PAT is used only when the provider answers "not covered".owner/reporeaches the provider (trailing.gitremoved). A URL, a third segment or a./..segment skips the provider tier.ghs_[a-zA-Z0-9]{36,}pattern is kept beside the new one.resolve_github_tokenmust check that the caller may use that repo. The resolver itself does no per-caller authorization.Test Plan
cd tests && pytest -p no:randomly unit/test_ent1277_github_token_resolver.py -v(24 tests)pytest unit/test_credential_sanitizer_backend.py,unit/test_credential_sanitizer_agent.py(run separately),unit/test_ec_input_hardening_properties.py,unit/test_ent1066_secret_paste_guard.py,unit/test_ec_credential_crypto_edges.py,unit/test_ent500_assignment_provider.pycd src/frontend && npx vitest run tests/unit/scrubInstallationToken.spec.js tests/unit/reportSummary.spec.jsscrub.jsrule turnsscrubInstallationToken.spec.jsredThe private half (the provider module) is a separate PR in
abilityai/trinity-enterpriseand depends on this one. No submodule pointer moves here.Journey Impact
Journey Impact: none: inert open-core seam plus token redaction; no call site uses the resolver yet, so no journey promise changes
Fixes abilityai/trinity-enterprise#1277
🤖 Generated with Claude Code