Repository navigation
test: pin the plain-http credential refusal and the unreachable env builtin - #176
Conversation
…uiltin AllowlistHttpClient refuses to send a resolved credential over plain http, but no test covered it. env_builtin_is_not_reachable only asserted forms that stop at the path resolver and never reach jq, so it passed even with jq's env builtin compiled in. Add a credential-over-http test and two assertions that go through jq.
|
Warning Review limit reached
This review includes 2 billable files and costs up to $0.50. Or wait 51 minutes for your next included review. View limit details
Comment |
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): test: pin the plain-http credential refusal and the unreachable env builtin. Tests-only change that pins two already-correct guards: the plain-HTTP credential refusal in the allowlist HTTP client, and the unreachability of jq's `env` builtin. No production code changed. The code index is behind this pull request, so retrieved context may be out of date. Review snapshot
Completeness: Complete What changedAdds an async test in the HTTP host-cap tests that resolves a credential and confirms a request over `http://` to an allowlisted public IP literal is refused with error text containing "plain http" and never containing the secret. Extends the existing `env` reachability test with two assertions that route through jq itself (`=env | .PATH` and `=(env|type)`), each expected to evaluate to `Value::Null`. Features
Tests
FindingsNo active actionable findings. Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
Summary
This PR adds tests only: two guards that already behave correctly are now pinned.
AllowlistHttpClientrefuses to send a resolved credential overhttp://, but no test covered that. The newa_credential_is_never_sent_over_plain_httpuses an allowlisted public IP literal (so no DNS is involved). It asserts that the request is refused before anything is sent, and that the error text never contains the secret.envunreachable from jq.env_builtin_is_not_reachableonly asserted=env,=env.PATHand=$ENV.PATH. Those forms stop at the plain path resolver and never reach jq, so the test passed even with jq'senvbuiltin compiled in. Two assertions now go through jq:=env | .PATHand=(env|type).Evidence the tests bite. I broke each guard on purpose and restored both files by copy afterwards.
mainjaq-stdbuilt with its default features usingfuns()(which compilesenvin)In the broken run:
env_builtin_is_not_reachablefailed on the new=env | .PATHassertion. It returned the host'sPATH. The three original assertions still passed, which confirms they never exercised jq.a_credential_is_never_sent_over_plain_httpfailed because the request was no longer refused.API Or Behavior Changes
None. This PR changes tests only.
Tests
cargo fmt --checkcargo clippy --all-targets -- -D warnings: left to CIcargo clippy --all-targets --all-features -- -D warnings: left to CIcargo build --all-targets: left to CIcargo build --all-targets --all-features: left to CIcargo test -p tinyflows --features host-caps --lib -- a_credential_is_never_sent_over_plain_http env_builtin_is_not_reachable: 2 passed onmain, 2 failed with the guards brokencargo test --all-features: left to CIDocumentation
Not needed (tests only).