Files
rengine/api
Yogesh OjhaandClaude Opus 5 f3b406ec03 feat(freshness): re-check a certificate between scans, which is Class B's first job
The derivation rule names four classes and only three had anything implementing
them. Class B is "needs a per-asset request, so a background job with its own
freshness, never a stage that blocks", and a certificate is the clearest case:
it expires and renews on a schedule no scan is aligned to. A dashboard built on
a scan from six weeks ago reports every certificate that has auto-renewed since
as expiring or expired — 548 hosts on this box sit inside a 30-day window right
now, and on a 90-day ACME cycle every one of them would be wrong within a month.

shared/services/cert_freshness.py + app.tasks.freshness.certificates (beat, 4h).
The policy is the design: a certificate whose stored expiry is more than 30 days
away is re-asked after 12h, one already inside its renewal window after 4h,
nearest expiry first, 500 a pass, one tlsx handshake per host. Only the newest
scan of each target is refreshed — an older scan's rows are a record of that
run, not a claim about today. A host that did not answer keeps what the scan
found and still gets its stamp moved: silence is not evidence the certificate
changed, but an unreachable host must not be re-asked every four hours.

It is opt-in, not opt-out (instance_settings.cert_recheck_enabled, default
false, a switch in Settings). The threat feeds only download; this one
handshakes the operator's targets outside a scan, and nobody should discover
that after the fact.

Two tool bugs, both the shape CLAUDE.md already lists four of. CLIToolRunner.run
defaults to OutputFormat.PLAIN and only appends json_flag for JSONL, so passing
json_flag without the format runs the tool with no -json at all — the first live
pass answered 0 of 40. And tlsx writes every record it is going to write and
then does not exit (40 hosts: 16s to emit, still running at 90s), so the run is
bounded by budget(hosts) and Freshness.cut_short reports a pass that hit the
ceiling instead of swallowing it. Together: 300.2s and 0 answers became 15.6s
and 37 of 40.

19 tests, each proven to fail against 9 mutations of the policy.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013dKUV96WkQQETZBMoAG98C
2026-09-11 08:46:32 +05:30
..
2026-02-04 20:05:28 +05:30
2026-02-04 20:05:28 +05:30