Repository navigation
Description
Summary
Two gaps keep security/tls-certificate (v0.0.139, #712) from replacing our own certificate monitor:
- Behind an HTTP proxy the rule disappears. We run every audit through an egress proxy (
HTTPS_PROXYset, it enforces our outbound network policy). The rule docs say it reportsnot checkedthere; in practice it is absent fromissues,passedRulesandnotCheckedin-f json, so there is no trace of it at all. A CONNECT tunnel through the proxy would allow the same handshake end to end: the proxy only relays bytes, the client still does TLS with SNI and reads the server certificate. - A broken certificate on the audited host aborts the audit instead of failing the rule.
expired.badssl.com,wrong.host.badssl.com,self-signed.badssl.comandrsa1024.badssl.comall end with✗ Cannot reach https://…/: SSL/TLS error - certificate issueand no JSON output. The worst case (expired or wrong certificate on the main host) therefore never produces asecurity/tls-certificatefailure, only a failed run.
Reproduce (v0.0.139, macOS arm64)
Direct, rule passes:
squirrel audit https://www.brunobanani.com --http -m 1 --rule-include security/tls-certificate --includePassed -f json
# "passedRules":[{"ruleId":"security/tls-certificate",...}]Same command with any CONNECT proxy (we used a 10-line Node http server handling connect):
HTTPS_PROXY=http://127.0.0.1:18899 HTTP_PROXY=http://127.0.0.1:18899 \
squirrel audit https://www.brunobanani.com --http -m 1 --rule-include security/tls-certificate --includePassed -f json
# "summary":{"passed":0,"warnings":0,"failed":0,"skipped":0}, no passedRules, no notChecked entryThe crawl itself works through the proxy (all page fetches go through it), only the rule is dropped.
Broken main-host certificate:
squirrel audit https://expired.badssl.com --http -m 1 -f json
# ✗ Cannot reach https://expired.badssl.com/: SSL/TLS error - certificate issue (exit 1, empty stdout)Request
- Do the rule's handshake through a CONNECT tunnel when
HTTPS_PROXY/HTTP_PROXYis set (respectingNO_PROXY), with the same resolved-address checks applied by the proxy side being out of scope. If that is not wanted, at least emit the documentednot checkedentry innotCheckedso JSON consumers can see the gap. - When the start URL fails on a TLS error, still emit a JSON report whose
security/tls-certificateresult fails with the cause (expired on , hostname not covered, self-signed, incomplete chain), instead of only aborting. The 0.0.139 TLS-cause detection already finds that cause.
Why
With both, the rule covers what we monitor ourselves today (expiry, trust, hostname, plus the www/apex counterpart we currently miss), so we could drop our own certificate check and keep a single source.
Triage notes (maintainers, 2026-10-29)
Verified against main (v0.0.139 plus later merges):
- Proxy case is a docs-versus-behaviour gap, not just a missing feature.
apps/cli/src/audit/tls-probe.tsreturnsunavailable("an HTTP proxy is set in the environment ...") and the rule emits aninfocheck with valuenot-checked. But the report's not-checked list (packages/report/src/not-checked.ts) only collectsskippedchecks carrying a NOT_CHECKED skip reason, so the TLS entry never reachesnotCheckedin-f json, the console or the other formats. The rule page promises "reportsnot checked"; JSON consumers see nothing. That is the fallback the reporter asked for, and it is a bug on its own. - A broken start-URL certificate aborts before any rule runs. The reachability preflight fails on a TLS error and exits with the cause. The cause detection (
packages/crawler/src/tls-cause.ts, the 3 second one-handshake probe) already finds expired, hostname, self-signed and incomplete-chain, so the rule's verdict can be produced from it. - Thresholds are already tunable (
[rule_options."security/tls-certificate"]:warn_days, default 30, anderror_days, default 7, documented on the rule page). Other limits are fixed today: the RSA minimum (2048 bits, and only RSA is judged today: ECDSA, Ed25519 and DSA keys are not), the www/apex counterpart check and the 3 second probe deadline. A user asked for configurable thresholds and the maintainer asked for key types and minimums too, so the options below add the ones that are hard-coded. The probe currently exposes only the RSA modulus size (rsaBitsinpackages/utils/src/tls-certificate.ts); key type and curve, signature algorithm and negotiated protocol need to be read from the peer certificate and socket. - CONNECT tunnel risk: the handshake must go through the proxy and never around it,
NO_PROXYmust be respected, and the runtime must support TLS over an already-open tunnel socket (spike this on the pinned Bun first). If it does not work reliably, ship item 1 (visiblenot checkedwith the reason) and keep the tunnel as a follow-up.
Suggested PRs, in order: (a) visible not checked entry (small, ships first), (b) report instead of abort on a TLS-broken start URL, (c) CONNECT tunnel handshake behind a proxy, (d) the key and certificate options (key type allow-list and per-type minimums, signature and protocol limits where the probe exposes them, counterpart check). Not in v0.0.140.
Acceptance Criteria
- With
HTTPS_PROXYset and no tunnel support,squirrel audit ... -f jsonlistssecurity/tls-certificateinnotCheckedwith the reason, and the console and markdown reports show the same "Not checked" line; the rule page text matches - With
HTTPS_PROXYorHTTP_PROXYset, the rule makes its handshake through a CONNECT tunnel (SNI and hostname verification intact) and reports pass, warn or fail as it does without a proxy; a host matched byNO_PROXYis probed directly - A proxy that refuses or fails the CONNECT (403, 407, 502, timeout) gives a
not checkedentry with that reason, never a crash and never a pass; no direct socket is opened while a proxy applies -
squirrel audit https://expired.badssl.com -f json(andwrong.host,self-signed,rsa1024) emits a JSON report in whichsecurity/tls-certificatefails or warns with the cause (expired on , hostname not covered, self-signed, incomplete chain, weak key), instead of printing onlyCannot reach ...and no JSON; the exit code stays non-zero - An unreachable host that is not a TLS problem (DNS failure, refused connection) behaves exactly as today
- The key and certificate limits are configurable under
[rule_options."security/tls-certificate"], each validated with a clear error and documented with defaults:key_types(allow-list ofrsa,ecdsa,ed25519,dsa; default["rsa", "ecdsa", "ed25519"], so a DSA key warns by default),rsa_min_bits(default 2048),ecdsa_min_bits(default 256, the curve size),dsa_min_bits(default 2048, only meaningful whendsais allowed),reject_weak_signature(boolean, default true: SHA-1 or MD5 signed certificates warn),min_tls_version(defaultTLSv1.2, a handshake that negotiates lower warns) andcheck_counterpart(boolean, default true; false skips the www/apex handshake). Signature algorithm and negotiated protocol options ship only if the probe can read them reliably (spike first); otherwise they are listed as follow-ups - The key check names the key type and size in its message (
RSA 1024 bits,ECDSA P-256,Ed25519,DSA 1024 bits) and thetls-certificate-keycheck warns when the type is not inkey_typesor the size is below the matching minimum; the existingwarn_days,error_daysdefaults and theerror_days <= warn_dayscheck are unchanged - The rule page documents the proxy behaviour, the not-checked entry, the failure-instead-of-abort behaviour and every option with a
squirrel.tomlexample - Tests: local TLS fixture servers (expired, wrong host, self-signed, weak key), a CONNECT proxy fixture (accepting, refusing,
NO_PROXY), and a JSON-report test for each path - CHANGELOG bullet under Unreleased per PR; each PR states whether the squirrelscan skill changes
Activity
nc9 commentedon Oct 29, 2026
This is a good one - thanks. I also got an email this morning asking if the thresholds can be tuned in config - i'll add that to this issue!
nc9 commentedon Oct 29, 2026
Thanks for the detailed report, @deniskern. I checked both gaps against main and confirmed them, and I added triage notes, a split into PRs and acceptance criteria to the issue description.
not checked, but that entry never reachesnotCheckedin the reports, so the docs promise something JSON consumers cannot see. That fix ships first.security/tls-certificatefails with the cause, instead of aborting.HTTPS_PROXY(respectingNO_PROXY) is planned; it depends on the runtime handling TLS over an open tunnel, so it gets a spike first.warn_days(30) anderror_days(7) under[rule_options."security/tls-certificate"]. I'm adding the limits that are fixed today (rsa_min_bits,check_counterpart). If you need another one tuned, say which.None of this is in v0.0.140.
refactor(cli): open TLS probe sockets in one place #1259
fix(cli): vet and pin the address behind a proxy in the TLS probe, ad…
fix(cli,rules): judge a tunnelled IP host against its own address, li…
fix(rules): lifetime-relative TLS expiry warning, visible not-checked…
refactor(cli): open TLS probe sockets in one place #1259
fix(cli): vet and pin the address behind a proxy in the TLS probe, ad…
fix(cli,rules): judge a tunnelled IP host against its own address, li…
nc9 commentedon Oct 30, 2026
Checked against main (23a34c1, v0.0.144). Ticked what holds (the visible not-checked entry, the CONNECT tunnel with NO_PROXY handling, refused CONNECT). Open: a broken start-URL certificate still aborts instead of emitting a report with a failing
security/tls-certificate; the new rule options (key_types,rsa_min_bits,ecdsa_min_bits,dsa_min_bits,reject_weak_signature,min_tls_version,check_counterpart) do not exist (only RSA is judged, at a fixed 2048 bits); the key check does not name type and size for ECDSA, Ed25519 or DSA; the rule page does not document the failure behaviour or the options; there are no JSON-report tests for expired, wrong-host or self-signed start URLs.nik
test(utils): tls-certificate key facts; update the expected certifica…
fix(cli,utils,core-contracts): start-URL TLS finding only for a named…
docs(rules): state what the runtime cannot reach (TLS below 1.2, Ed25…
fix(cli,core-contracts): a broken start-URL certificate is reported a…
fix(cli,utils,core-contracts): start-URL TLS finding only for a named…
feat(rules,cli,utils): security/tls-certificate key types, minimum si…
test(utils): tls-certificate key facts; update the expected certifica…
docs(rules): state what the runtime cannot reach (TLS below 1.2, Ed25…
nc9 commentedon Oct 31, 2026
Verified against main after v0.0.147 (broken start-URL certificate reported as failing, key and certificate options). Met: criteria 1 to 9 (proxy CONNECT behaviour, not-checked reporting, start-URL certificate failures with exit 5, the seven options with tests and docs). Open: criterion 10, the per-PR statement on whether the agent skill changes is not checkable from the repo; and the start-URL e2e has no incomplete-chain case (the wrong-host, self-signed, expired and weak-key cases are covered). Leaving this open for those.
nik
nc9 commentedon Nov 4, 2026
Acceptance check against main 7c31d5b (proxy work first released in v0.0.143, start-URL failure and options in v0.0.147, all in v0.0.161):
Criteria 1 to 9 were already ticked; I re-ran their tests on this main:
apps/cli/tests/audit/tls-probe.test.ts67 pass (CONNECT accept, 403 refusal, hang, garbage,NO_PROXY),apps/cli/tests/cli/audit-tls-start-url-1259-e2e.test.ts8 pass (expired, wrong host, self-signed, RSA-1024, xml and console, rule-exclude, plain-HTTP port, closed port),packages/rules/tests/tls-certificate.test.ts63 pass,tls-certificate-pipeline.test.ts11 pass,packages/report/tests/not-checked-tls-1259.test.ts4 pass. The rule page documents all seven options. A missing intermediate is covered at the cause level (packages/crawler/tests/tls-cause.test.ts"a server that omits its intermediate names the missing chain",tls-probe.test.ts"a leaf served without its intermediate is an incomplete chain"); the start-URL e2e has no incomplete-chain fixture, which no criterion asks for.CHANGELOG.mdhas a bullet for each part (not-checked entry and lifetime-relative expiry, the broken start-URL certificate, the key and certificate options), and the descriptions of PR #1306, #1401 and #1402 each say "Skill: none" or "Skill change: none"Ticked criterion 10 and closing.
nik