Repository navigation
fix(api): refuse a sync link or credential that git cannot take when it is stored - #892
Conversation
…it is stored A sync run gives git the upstream URL as one argument and each credential value as one environment entry. Since #748 a run fails as configuration when the URL is over 131,070 bytes or a username or password is over 131,042 bytes, but POST /repos and the git credential routes stored such values, so the client learned it only from a failed run. They now answer 400 with invalid_params, using the worker's constants, which are now exported (sync.MaxUpstreamURLBytes, sync.MaxCredentialBytes). The run check stays for values stored before. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: Ia9cceeab87af3193f31a3171b65a578d881778ac
Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: I8c1967a3e7a4c06c2113400a34401752e86ae5e4
|
@codex review |
|
@codex security review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Ten mutants of the new checks passed the tests: a bad host that would also make the URL too long, the default host of a base_repo, the default_branch problem inside the URL problem and its order, an owner, name, password or token that holds a NUL and is over its limit, and a host with a path and a trailing slash, at and over the limit. Each now has a case, and each of those mutants fails. The docs say how a host with a scheme makes the URL, and that a link or credential stored by an older server still meets the run check. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: I7788a7e1b1007beaa98be91924b94cfc18cfbe17
|
@codex review |
|
@codex security review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
…xt to a long URL The second review found two branches without a case: a base_repo whose upstream_host is bad and whose URL would be too long, and an unsupported provider with a host sent, where the URL is still checked. Both mutants now fail. The docs say that a host loses all its trailing slashes. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: I244f64c9b45b9ee55c048571a2f4224958435baf
|
@codex review |
|
@codex security review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
main got #845, which re-recorded the lane-schedule fingerprints. This takes main's SKILL.md; the fingerprints are recorded again next. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: Ibb7c54e3c03ccde4905f0641e6a22f00a25b5ec8
Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: Ia1f99374b8fc08039135fd970a650ad0376ceaa9
POST /reposand the git credential routes now refuse a sync value that git cannot take, with400andinvalid_params, before anything is stored. Since #748 the sync run fails such a link asrepository configuration erroron every run, so the client learned it only from a failed run.invalid_paramshttps://{host}/{owner}/{name}.git, or the host as given when it has a scheme, without trailing/s)POST /reposwithupstreamor abase_reposyncowner, thename, and the host field when the body sent one, reasonmust keep the upstream URL at most 131070 bytesbase_repo.auth.tokenPOST /reposbase_repo.auth.token,must be at most 131042 bytesusername,passwordPOST/PUT /repos/git-credentials,POST/PUT /repos/{repo_name}/git-credentials,PUT /repos/{repo_name}/git-credentials/{id}must be at most 131042 bytessync.MaxUpstreamURLBytesandsync.MaxCredentialBytes. The worker checks (upstreamURLFailure,Worker.upstreamAuth) stay as the backstop for values stored before this change.upstream.access(orbase_repo.auth.tokenandbase_repo.default_branch) lies between the name and the host in the docs. A problem of such a field joins the URL problem in that place, asaddFieldsdoes for the required fields, so the items keep the order of the body.base_repo.auth.tokenthat starts withenc:makes the create answer500(main too), while the credential routes answer400for the same value. A credential with a CR or LF is stored (201), and then every sync run fails it as configuration; that is the same class as this PR but outside its decision.Evidence
TestSyncValuesGitCannotTakeAtRegistrationfails on main's handlers (go test -overlaywith main'shandlers_sync.goandhandlers_credentials.go): every over-the-limit case is stored (201/200) instead of400. On this head it passes, and a link and a credential at the limits are stored. The test pins the literal numbers.base_repo, the order of the joined items, NUL before length for the password and the token, a URL built withoutCloneURL) all failTestSyncValuesGitCannotTakeAtRegistration; a no-op control passes.go test -race -tags=openstorage_viewcheckof./internal/sync/...(92 s at 286cc3c, same sync code as the head) and./internal/api/...without pg (353 s at 2fb75df) pass. PostgreSQL and S3-WAL rely on CI.Worker.upstreamAuth,upstreamURLFailure, and the changed API validators.Review
base_repobad host next to a long URL, an unsupported provider with a host sent) and the wording fixes. The CR/LF credential gap is listed above as separate.usernamenext to a short valid password (two mutants survive),internal/api/README.mddoes not list the new limits, and a comment ingcredValidatesays the entry, not the value, must fitMaxCredentialBytes.SKILL.md). 33c2441 merges main (main'sSKILL.md), and c384208 records the fingerprints again. Outside.agents/the PR diff is byte for byte the one Codex and the reviews passed at 2fb75df. The sync (66 s) and api (339 s) race lanes pass on the merged tree. This head has no Codex pair: the six Codex requests of this PR are used up.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:xhigh