feat(git-token): authorize exact provider review resources - #5692
Closed
iscekic wants to merge 11 commits into
Closed
feat(git-token): authorize exact provider review resources#5692iscekic wants to merge 11 commits into
iscekic wants to merge 11 commits into
Conversation
This was referenced Aug 29, 2026
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Previous Review Summaries (3 snapshots, latest commit e277180)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit e277180)Status: No Issues Found | Recommendation: Merge Files Reviewed (13 files)
Previous review (commit 28e1ecf)Status: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Previous review (commit 32460b1)Status: No Issues Found | Recommendation: Merge Files Reviewed (8 files)
Reviewed by grok-4.6 · Input: 66.9K · Output: 14K · Cached: 459.6K Review guidance: REVIEW.md from base branch |
This was referenced Aug 29, 2026
This was referenced Aug 30, 2026
This was referenced Aug 30, 2026
Contributor
Author
|
Closing: the owner stopped this workflow section. The branch is retained. |
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
BitbucketInteractiveHttpRequestSchemabinds review operations to authorized organization resources and rechecks credential identity to prevent account or repository substitution.The broker returns credential-free provider identity metadata and requires
pullrequest:writefor approval, change-request, withdrawal, and merge operations.Merges default
close_source_branchtofalseand reject deletion across forks; rejected workspace tokens invalidate only the selected credential.Files
services/git-token-service/src/interactive-review-handler.ts— source, added (306 lines); adds the request schema and authorization query for unblocked organization members or administrators. Requires an active organization-owned integration, a valid repository sync timestamp, matching workspace and repository identities, and existing grants. Rechecks OAuth credential and actor identities or workspace credential identity and version after token resolution; identity changes require reconnection. Validates strict metadata containing the Kilo actor, organization, integration, provider principal, and scopes, without a provider token. Addresses requests by immutable workspace and repository identifiers, checks merge deletion against the source repository, and returns safe failure reasons. The source check provides no atomic head guard.services/git-token-service/src/interactive-review-handler.test.ts— test, added (462 lines); adds the interactive review handler suite.POST /internal/bitbucket/interactive-reviewrequires an organization claim andBITBUCKET_INTERACTIVE_AUDIENCE(git-token-service:bitbucket-interactive-review), isolating it from other internal token audiences.Requests use the 256,000-byte
BITBUCKET_INTERACTIVE_REQUEST_MAX_BYTESlimit, return 413 for oversized bodies, and applyCache-Control: no-storeto successes and errors.Existing endpoints retain their 16,000-byte limit and audiences, including unchanged GitHub behavior.
Files
services/git-token-service/src/index.ts— source, modified (80 changed lines); registers the route and derives the user and organization from verified claims. Adds an optional limit and a distinct oversized-body error to the shared JavaScript Object Notation (JSON) reader. Validates JSON bodies before dispatch, returns 400 for invalid input and 413 for excessive size, and keeps existing endpoint errors unchanged. Applies the new audience and no-store headers throughout the route, rejects missing organizations, and converts unexpected failures totemporarily_unavailable.packages/worker-utils/src/internal-service-token-audiences.ts— source, modified (1 changed line); exports the dedicated Bitbucket interactive audience without changing existing audiences.services/git-token-service/src/index.test.ts— test, modified (300 changed lines); updates the service route suite.packages/worker-utils/src/internal-service-token-audiences.test.ts— test, modified (26 changed lines); updates the internal service audience suite.GetGitLabTokenParams.expectedIntegrationIdalso reachesIssueGitLabSessionCapabilityParams, letting token and capability requests select an exact authorized integration.Unpinned requests retain authorized lookup and legacy instance subpaths; ordinary sessions now reject ambiguous matches, mismatched credentials, and mismatched instances.
Review sessions still require a valid repository, and any candidate credential failure now blocks success even when another candidate qualifies.
Files
services/git-token-service/src/gitlab-runtime-token-resolver.ts— source, modified (65 changed lines); adds the optional pin and filters authorized integrations by the repository before credential resolution. Validates review repository input before lookup and checks returned credential identity and normalized instance identity. Preserves authorized legacy prefixes despite the generic URL check. Retains unpinned requests for old callers and records, including the documented 30-day ledger window, without adding an automatic cutoff. Returnsambiguous_integrationorno_matching_integrationinstead of selecting another connection, and prioritizes candidate credential failures over a usable review credential.services/git-token-service/src/gitlab-runtime-token-resolver.test.ts— test, modified (333 changed lines); updates the GitLab runtime token suite.Tests: 4 files changed (1 added, 3 modified; 1,121 changed lines):
interactive-review-handler.test.ts,index.test.ts,internal-service-token-audiences.test.ts, andgitlab-runtime-token-resolver.test.ts.Generated: 0 files changed.
Visual Changes
Visual Changes: N/A
Verification
Reviewer Notes
mobile-provider-parity-1d93-s3...mobile-provider-parity-1d93-s4.Kilo-Org/cloud; worktree:/Users/igor/Projects/.worktrees/mobile-provider-parity-1d93.Human steps
Notes
Runtime verification is pending for the cumulative stack; this level adds no visual surface.
Stacked PRs — merge bottom to top. Each level shows only its own diff.
Runtime verification (E2E, user advocacy, simplify) runs on the tip PR over every level.
Every level keeps its own checks, its own bot review, and its own threads; each one is answered on its own PR.
Each level is its own deliverable: it builds and passes its own checks alone.
A finding on a level is repaired on that level, then carried upward with stack.sh forward.
mobile-provider-parity-1d93-s1— feat(provider-review): add shared identity and stack checks #5663mobile-provider-parity-1d93-s2— feat(provider-review): define review contracts and vocabulary #5665mobile-provider-parity-1d93-s3— feat(provider-review): add safe provider SDK boundaries #5689mobile-provider-parity-1d93-s4— feat(git-token): authorize exact provider review resources #5692 ← this PRmobile-provider-parity-1d93-s5— feat(cloud-agent): preserve provider identity through checkout #5700mobile-provider-parity-1d93-s6— feat(provider-review): expose exact repositories and branches #5705mobile-provider-parity-1d93-s7— feat(mobile): preserve provider launch and recent identity #5711mobile-provider-parity-1d93-s8— feat(mobile): select exact provider repositories and branches #5729mobile-provider-parity-1d93-s9— feat(provider-review): add authorized GitLab review reads #5738mobile-provider-parity-1d93-s10— feat(provider-review): add authorized Bitbucket review reads #5745mobile-provider-parity-1d93-s11— feat(provider-review): add reconciled GitLab review actions #5748mobile-provider-parity-1d93-s12— feat(provider-review): add Bitbucket review actions and recovery #5756mobile-provider-parity-1d93-s13— feat(provider-review): expose the neutral review facade #5763 (tip)