chore: lint rule banning disabled TLS verification in tests (#104) - #108
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UHcZfMyTBtKc72KVYQw4rb
Adds appduct/no-tls-bypass for test files. In-process daemon tests now trust the daemon's certificate with ca: daemon.tls.current().certPem; tests whose daemon runs as a subprocess go on LEGACY_TLS_BYPASS. 6 failing -> 0 failing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UHcZfMyTBtKc72KVYQw4rb
V3RON
left a comment
There was a problem hiding this comment.
Comment: 0 blockers, 1 should-fix, 0 nits.
Spec: issue #104, with criterion 3 replaced by the issue comment (migrate or list on a burn-down allowlist).
Fix first: appduct/no-tls-bypass lets vi.stubEnv("NODE_TLS_REJECT_UNAUTHORIZED", "0") and https.globalAgent.options.rejectUnauthorized = false through.
Generated by Claude Code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UHcZfMyTBtKc72KVYQw4rb
2 failing -> 0 failing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UHcZfMyTBtKc72KVYQw4rb
V3RON
left a comment
There was a problem hiding this comment.
Verdict: approve. GitHub won't take an approval on your own PR, so this is posted as a comment. Round 2: 0 blockers, 0 should-fix. The round-1 finding is fixed in ac9db98 and I've resolved the thread.
Spec: issue #104, with criterion 3 as replaced in its comment.
Nothing to fix. I agree with checking call arguments rather than every literal: it catches vi.stubEnv and still allows delete process.env[...].
Generated by Claude Code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UHcZfMyTBtKc72KVYQw4rb
Closes #104
What changed
pnpm lintnow fails when a test turns off TLS verification: settingNODE_TLS_REJECT_UNAUTHORIZED(as an assignment, through a call such asvi.stubEnv, or in a child-process env object) or settingrejectUnauthorizedtofalse(in an options object, or by assigning it, e.g.https.globalAgent.options.rejectUnauthorized = false). The rule isappduct/no-tls-bypassineslint.config.mjsand applies only to files under__tests__, since on a TLS serverrejectUnauthorized: falseis the normal setting for client certificates. The five integration tests that run the daemon in-process now trust its certificate withca: daemon.tls.current().certPem, and their fake-appconnectClienttakes the daemon instead of a port, so the now-unusedportfields and parameters are gone. The six files whose daemon runs as a CLI subprocess never see its certificate, so they go on a newLEGACY_TLS_BYPASSburn-down list. It works like the #88 lists, and a test checks that every entry still violates.Acceptance criteria
pnpm lintfails on a test file withNODE_TLS_REJECT_UNAUTHORIZED = "0"orrejectUnauthorized: false, or an equivalent bypasslint-boundaries.test.ts› "lint: TLS verification in tests": process-wide, bracketed, child env,vi.stubEnv,rejectUnauthorized: false,globalAgent.options.rejectUnauthorized = false, test helperpnpm lintpasses on a test that trusts the daemon's cert viaca: ...certPemlint-boundaries.test.ts› "a test trusting the daemon's own certificate passes"ca: daemon.tls.current().certPemor on a burn-down list, andpnpm lintpasses on mainlint-boundaries.test.ts› "every LEGACY_TLS_BYPASS entry still switches off TLS verification";pnpm lintlint-boundaries.test.ts› "source outside tests is not linted by it"Migrated (5):
tool-invocation,session-engine,policy-and-audit,tls-refresh,mcp-serverintegration tests.Listed (6):
cli-v2,events,exit-codesintegration tests, pluse2e/harness.ts,e2e/app-client.ts,e2e/hostility.e2e.test.ts.E2E evidence
Waived by the maintainer. The PR changes only
eslint.config.mjsand files under__tests__, and no app or daemon runtime code. The session's container has no simulator. The CIiosandandroidjobs pass on the head commit.Checklist
CHANGELOG.mdhas an entry underUnreleased(writing-changelogskill), or the change is not user-visiblewriting-user-docsskill), or the change is not user-visibleindex.ts; no new directnode:*I/O outside an adapterarchitectureskill applied, exceptions explained abovedocs/ARCHITECTURE.mdupdated if a surface it describes changedOut of scope
LEGACY_TLS_BYPASS: the subprocess-daemon tests need a way to get the daemon's certificate (for example fromdaemon status), or they need to move to an in-process daemon.implement-issuelesson in.agents/memory/LESSONS.mdthat points at Lint rule: ban disabling TLS verification in tests #104 can be retired by the next memory review once this lands.Status
Implement: done (9/9 green) Review: round 2, approve E2E: waived by user (lint and test files only; no simulator in this container) Ready: yes
🤖 Generated with Claude Code
https://claude.ai/code/session_01UHcZfMyTBtKc72KVYQw4rb