Skip to content

Lint rule: ban disabling TLS verification in tests #104

Description

@V3RON

Why

On #99, a new daemon integration test set NODE_TLS_REJECT_UNAUTHORIZED=0 and
rejectUnauthorized: false, copied from older tests. CodeQL flagged two high-severity
alerts and the PR needed a second review round to fix. A written lesson in
.agents/memory/LESSONS.md only helps if it's read and remembered; an ESLint rule catches
it every time, before review.

Expected outcome

pnpm lint fails when a test file sets process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0" or
passes rejectUnauthorized: false (or an equivalent TLS-verification bypass) to a TLS/HTTPS
client option. The correct pattern — trusting the daemon's own certificate via
ca: daemon.tls.current().certPem — is unaffected.

Constraints and non-goals

Repo already enforces module boundaries and no vi.mock via custom ESLint rules (#88); this
follows the same pattern. Should not fire on non-test files or on the daemon's own TLS setup
code, only on client/test code disabling verification. Out of scope: a general "no
insecure crypto" rule — just this specific bypass.

How we know it is done

  1. pnpm lint fails on a test file containing NODE_TLS_REJECT_UNAUTHORIZED = "0" or
    rejectUnauthorized: false.
  2. pnpm lint passes on a test that instead trusts the daemon's cert via ca: ...certPem.
  3. Existing test suite is unaffected (no false positives on legitimate TLS setup code).

Alternatives considered

Rely on the memory lesson alone — rejected, since it already failed to prevent a repeat
within one PR cycle and CodeQL is a review-time backstop, not a pre-commit one.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:toolingRepo scripts, CI workflows, workspace configstatus:readySpec and fix direction are clear; an agent can pick it uptype:choreMaintenance with no user-visible change

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions