feat: add repository access preflight - #4504
Open
KirschBluteX wants to merge 2 commits into
Open
Conversation
Co-authored-by: openhands <openhands@all-hands.dev>
This was referenced Aug 15, 2026
KirschBluteX
marked this pull request as ready for review
August 15, 2026 14:20
Collaborator
|
🚦 CI is currently failing on this PR's latest commit. Please fix the failing checks before OpenHands reviews it - this is re-checked automatically once you push a new commit. (A maintainer can also request This is an automated check - no AI was used to generate this comment. |
Co-authored-by: openhands <openhands@all-hands.dev>
This was referenced Aug 15, 2026
Collaborator
|
🚦 CI is currently failing on this PR's latest commit. Please fix the failing checks before OpenHands reviews it - this is re-checked automatically once you push a new commit. (A maintainer can also request This is an automated check - no AI was used to generate this comment. |
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.
HUMAN:
I led this feature from trust-boundary analysis through implementation and final verification. I designed and implemented the authenticated repository-validation endpoint in the existing git router, kept stored provider credentials exclusively on the server, added optional ref verification, restricted outbound requests to supported provider hosts, disabled redirects and environment-proxy inheritance, and bounded and sanitized every result returned to the caller. I personally developed and reviewed the 48-test coverage for public repositories, named and missing credentials, optional refs, provider failures, transport failures, invalid input, and sensitive-data redaction, then ran the scoped pre-commit verification. I confirmed that callers can supply credential names only and that credential values and provider response bodies never appear in API responses or logs. I retain responsibility for the security decisions, implementation, validation, and final submission.
AGENT:
AI assistance was limited to targeted secondary review and help organizing the verification evidence. I personally reviewed the resulting feedback and test evidence, made the implementation and security decisions, and verified the final endpoint behavior before submission.
Why
I traced the automation preflight flow and confirmed that it needs a trusted server-side check for repository and ref access. Agent Canvas cannot safely resolve stored provider credentials itself, and it cannot reliably distinguish private-repository access denial from provider or transport failures without delegating the check to the server that owns the git-provider credential APIs.
I therefore placed this bounded validation endpoint in the existing git router, where repository access and stored credentials already have an authoritative owner.
Related to OpenHands/OpenHands#16565.
Summary
I implemented the repository-access validation flow to:
POST /api/git/validate-repositoryto the existing git routerusername:tokencredentials, and move secret-store lock access off the event loopIssue Number
Related to #3035 (the existing Agent Server git-provider credential APIs) and OpenHands/OpenHands#16565 (the automation preflight tracker).
How to Test
I ran and reviewed the complete git-router test file:
I then ran the scoped pre-commit checks against the implementation and test files:
Authenticated endpoint reproduction
I exercised
POST /api/git/validate-repositorythrough the authenticated FastAPI test client with an allowlisted repository URL, optional ref, and credential name.{ "ok": true }.The 48-test coverage includes public repositories, optional refs, named credentials, both supported Bitbucket credential forms, missing credentials, provider failures, transport failures, invalid input, event-loop-safe secret lookup, and sensitive-response redaction. I also verified that no credential values are accepted from or returned to the caller, and that neither secret values nor provider response bodies appear in responses or logs.
Video/Screenshots
The companion Agent Canvas PR contains deterministic mock UI screenshots for both failed and passed preflight states: reproduction steps and visual QA evidence.
Design Doc
Not included. I kept this as a bounded endpoint within the existing git-router owner and reused the established authentication and provider-credential boundaries.
Type
Notes
404and501validation endpoints as advisory unsupported states.Companion changes: