Repository navigation
Conversation
… and CONNECT tunnel for security/tls-certificate #1279 #1259 Signed-off-by: Nik Cubrilovic <[email protected]>
Signed-off-by: Nik Cubrilovic <[email protected]>
…versarial egress tests #1259 Signed-off-by: Nik Cubrilovic <[email protected]>
…fetime-relative error threshold, proxy URL hardening #1259 #1279 Signed-off-by: Nik Cubrilovic <[email protected]>
This was referenced Oct 30, 2026
Contributor
Author
|
Landed in v0.0.143 as nik |
10 tasks done
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.
Fixes #1279
Refs #1259 (partial: items 1 and 3 of the issue are done, see below; the issue stays open)
#1279: expiry warning relative to the certificate's lifetime (Nik's decision)
notAfter - notBefore) less a 14-day renewal margin:floor(L / 3 - 14), never belowerror_days. 16 days for a 90-day certificate, 52 for 200 days, and it shrinks with SC-081's shorter lifetimes. If the lifetime cannot be read the window is 30 days.RENEWAL_MARGIN_DAYS) changes it.warn_daysis now optional and unset by default; set, it replaces the window with a fixed number of days as before (error_days <= warn_daysis still refused when both are set).error_daysdefault 7 is unchanged. The warn check'sdetailscarrywarnDaysandwarnDaysSource(lifetimeoroption).#1259 items done
tls-certificate-not-checkedskip reason, which is inNOT_CHECKED_SKIP_REASONS, so it appears under "Not checked" in every format and innotCheckedin-f json(it used to be an info check the report dropped).HTTPS_PROXYorHTTP_PROXY(either case) set, the CLI probe opens a CONNECT tunnel and does TLS inside it (SNI and verification intact). Spiked first: TLS over a CONNECT socket works on Bun 1.4.3.NO_PROXY(*, host,.suffix,*.suffix, optional port) is honoured and probed directly. A proxy answering 403, 407 or 502, never answering (PROXY_TIMEOUT), unreachable, or sending garbage gives a not-checked entry with that reason, never a pass or a crash; anhttps:orsocksproxy is reported as unsupported; no address is resolved and no direct socket is opened for the target while a proxy applies; proxy credentials go inProxy-Authorizationand never appear in a result.#1259 NOT done in this PR (needs your call)
security/tls-certificatefailing needs a report for a crawl that fetched nothing (a new synthetic-report path in the CLI audit controller and all report formats, like theredirectedreport). That is a separate, larger change.key_types,rsa_min_bits,ecdsa_min_bits,dsa_min_bits,reject_weak_signature,min_tls_version,check_counterpart): the issue itself says signature and protocol options ship only after a probe spike, and the key-type options need the probe to read key type and curve.NO_PROXY) is new.Tests
apps/cli/tests/audit/tls-probe.test.ts(47): real handshakes through a local CONNECT proxy fixture (accept, 403, 407, 502, hang, garbage, down, credentials,NO_PROXYtable, socks unsupported) and the rule end to end;packages/rules/tests/tls-certificate.test.tsandtls-certificate-pipeline.test.ts;packages/report/tests/not-checked-tls-1259.test.ts(JSONnotChecked, text and markdown).rule-options-check,docs-rule-pages,private-target-skip,streaming-rules-canonical-golden(no pin moved),tls-cause, apps/cli format, lint and tsgo, tsgo on rules, report and core-contracts,make validateindocs/.--run clior--run rulessuites, an end-to-end audit through a real egress proxy. Local Bun is not the pinned 1.4.4.Docs:
docs/rules/security/tls-certificate.mdx(expiry window, options table, not checked, proxy behaviour). Skill: none.Egress and SSRF review of the tunnel (security scan lead), head 534c9e5
The first version CONNECTed to the NAME and skipped the egress guard, so the proxy resolved it: a bypass. Fixed:
NO_PROXYtake the direct path, which is vetted identically. A SAN or link in page content is never connected to. Redirects are not followed.Proxy-Authorization; results and console output carry the proxy host and port only (asserted).Review round 1 (head e9c9d1c)
connectForFactsnow getshostfor the tunnel; test with the proxy on::1and the certificate on127.0.0.1(fails without the fix; direct and tunnelled agree).js/disabling-certificate-validation): there is exactly ONErejectUnauthorized: falsesite, inconnectForFacts, shared by the direct and the tunnelled handshake. It is deliberate and commented there: the audit reads whatever certificate the host serves and judges it on the facts (authorized,authorizationError, names, dates) so an expired, self-signed or mismatched certificate is reported instead of aborting; nothing is sent over the connection. Same reason the alert was dismissed on main; needs the maintainer dismissal for the new fingerprint.http://us%zzer:p@host) isPROXY_BAD_URL(not checked), and the whole probe is wrapped so it can never reject (the rule and the crawl cause-read call it unguarded).error_daysis now lifetime-relative as well: 7 days, or a tenth of the lifetime (at least 1 day) under 70 days, and the warn window is derived with a margin of at most 15% of the lifetime and never below the error threshold. Lifetimes are rounded to whole days (Let's Encrypt 90 days less a second reads 90, warn 16). 6, 10, 30, 47, 90 and 365-day tables tested; explicit options still win.NO_PROXYno longer shadowsno_proxy; CIDR inNO_PROXYdocumented as unsupported (tested); html, llm and xml not-checked output tested.