test(gitea-curl): harden equals-form rejections + prove create-before-write ordering #35
Reference in New Issue
Block a user
Delete Branch "fix/gitea-curl-followup-hardening"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes the remaining gaps flagged in RC #11714:
-H=Authorization:.../-H=Authorization=...regression cases (equals-attached flag + value).setup-gitea-netrc.sh: it runsmain()while intercepting_write_netrcto assert the tempfile is mode 0600 and empty at the exact moment credentials are written. A regression that writes before chmod (or reuses a non-empty file) will fail this test.All 33 tests pass locally.
APPROVED: Reviewed head
65e38c8d5e27a6cbf4bf20c4c12fc3894ed9c813.This is test-only hardening in
scripts/test_gitea_curl.py; no production wrapper/setup code changes.Verification:
-H=Authorization: Bearer tokand-H=Authorization=Bearer tokregression cases are real. I ran the live wrapper from this head directly with both arguments; both exit non-zero with the wrapper refusal message before curl exec.setup-gitea-netrc.sh, overrides_write_netrc, and asserts the passed tempfile is mode 0600 and empty before writing credential bytes. I reproduced that flow directly; it observedempty + 0600before write and final.netrcmode 0600.5-axis: correctness and security coverage are improved for the exact bypasses found during #34 review; robustness/idempotency are unchanged; no performance impact; tests are readable and targeted.
Approved on head
65e38c8d5e. Exact-head CI is green. The PR is test-only, and the added cases are load-bearing: the new -H=Authorization: and -H=Authorization= forms run the real gitea-curl wrapper and assert non-zero/refusal, and the main()-level setup-gitea-netrc test overrides _write_netrc to prove the tempfile is already 0600 and empty before credential bytes are written. I also manually spot-checked the two equals-form wrapper cases and the create-before-write ordering path locally; local pytest itself is not installed in this container, so full execution proof is the green CI validator suite.Approved on head
65e38c8d5e. Exact-head CI is green. The PR is test-only, and the added cases are load-bearing: the new -H=Authorization: and -H=Authorization= forms run the real gitea-curl wrapper and assert non-zero/refusal, and the main()-level setup-gitea-netrc test overrides _write_netrc to prove the tempfile is already 0600 and empty before credential bytes are written. I also manually spot-checked the two equals-form wrapper cases and the create-before-write ordering path locally; local pytest itself is not installed in this container, so full execution proof is the green CI validator suite.New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings
APPROVED: Reviewed head
ee0c3854ea55cc7d000624888147a7630292b1e0.This is still test-only in
scripts/test_gitea_curl.py. The new delta adds the exact-H=Authorization: token SECRETregression case on top of the prior equals-form hardening tests.Verification:
-H=Authorization: token SECRET; it exits non-zero with the wrapper'srefusing inline Authorization/Proxy-Authorization headermessage, so the added test case exercises a real fail-closed path.5-axis: correctness/security coverage improves for the #11721 form; robustness/readability are fine; no performance impact; scope is appropriately test-only.
Approved on head
ee0c3854ea. Exact-head CI is green. The delta remains test-only in scripts/test_gitea_curl.py; the added #11721 regression case '-H=Authorization: token SECRET' runs the real gitea-curl wrapper and asserts the refusal/non-zero path. I also spot-checked that exact argv locally and it exits 1 with the inline Authorization refusal. The prior equals-form and 0600-before-token load-bearing tests remain intact.Approved on head
ee0c3854ea. Exact-head CI is green. The delta remains test-only in scripts/test_gitea_curl.py; the added #11721 regression case '-H=Authorization: token SECRET' runs the real gitea-curl wrapper and asserts the refusal/non-zero path. I also spot-checked that exact argv locally and it exits 1 with the inline Authorization refusal. The prior equals-form and 0600-before-token load-bearing tests remain intact.