Skip to content

chore(audit): pin the dead-code audit to [email protected] - #12165

Merged
brennanb2025 merged 1 commit into
mainfrom
brennanb2025/pin-knip-audit
Aug 3, 2026
Merged

brennanb2025 merged 1 commit into
mainfrom
brennanb2025/pin-knip-audit

Conversation

@brennanb2025

Copy link
Copy Markdown
Contributor

Summary

Pins the manual dead-code audit script to an exact knip version: pnpm dlx knip@5 → pnpm dlx [email protected]. The floating major was a P2 in the v1.4.165-rc.0 prod release scan: dlx downloads and executes whatever the newest matching release is at invocation time, outside lockfile integrity review. This matches the exact-pin pattern already used by audit:react-doctor ([email protected]) one line up. One-token change; the script is manual-only (not wired into CI, release, or install paths).

Why not a devDependency (the otherwise-preferred fix): knip 5.x peer-depends on typescript@^5, and this repo is on [email protected]. Installed as a devDependency, pnpm resolves knip's peer against the workspace TS 7 and knip crashes at module load (TypeError in its timerify wrapper — it wraps a compiler-API function that no longer exists in the native TS 7). A/B-verified: the same knip 5.88.1 against a TS 5 peer runs clean. The dlx sandbox auto-installs knip's own TS 5, which is the environment the original #12077 sweep actually ran in — so dlx here is load-bearing, not laziness. If knip ships TS 7 support later, moving it into devDependencies + plain knip in the script becomes the right follow-up.

Screenshots

No visual change.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

The four package commands don't exercise this manual script. Direct verification instead:

  • pnpm dlx [email protected] --config config/knip.json runs against the repo and produces a normal findings report (exit 1 = findings present, knip's standard reporting behavior).
  • devDependency probe: knip 5.88.1 with [email protected] as peer → crashes at module load; identical setup with typescript@^5 → runs clean. This is why the PR keeps dlx.

AI Review Report

Reviewed as a follow-up from the v1.4.165-rc.0 prod release scan (security worker flagged the floating version). Risks checked: whether the devDependency route was viable (no — TS 7 peer crash, verified empirically rather than assumed), whether the pinned version works against config/knip.json (yes, live run), and whether the script participates in CI/release paths (it does not; manual-only). Cross-platform: the script change is a version string inside an existing pnpm dlx invocation; no shortcuts, paths, shell behavior, or Electron surface involved — behavior is identical on macOS, Linux, and Windows.

Security Audit

This PR is itself a supply-chain hygiene fix: it closes the window where a compromised future [email protected] release would run on a developer machine via pnpm dlx's fetch-and-execute. No new inputs, command execution, auth, secrets, or IPC surface. Residual: dlx still auto-installs knip's transitive deps and TS 5 peer unpinned inside its sandbox at the pinned knip version — fully closing that requires the devDependency route, blocked on knip supporting TS 7. The $schema URL in config/knip.json (unpkg.com/knip@5/schema.json) is editor-tooling metadata, never executed, and stays as-is.

Notes

  • Version updates are now deliberate: bump the pin and re-run the audit, exactly like react-doctor.
  • Follow-up when knip gains TS 7 support: move to devDependencies + pnpm exec so the lockfile owns the integrity hash end to end.

pnpm dlx knip@5 downloads and runs whatever the newest 5.x is at
invocation time, outside lockfile integrity review — flagged P2 by the
v1.4.165-rc.0 release scan. Pin the exact version, matching the
[email protected] pattern one line up.

Why dlx rather than a devDependency: knip 5.x peer-depends on
typescript@^5, and this repo is on typescript 7.0.2 — installed as a
devDependency, pnpm resolves knip against TS 7 and knip crashes at
module load (verified: same knip against a TS 5 peer runs clean). The
dlx sandbox auto-installs knip's own TS 5, which is the environment the
original #12077 sweep actually ran in.
@greptile-apps

greptile-apps Bot commented Aug 3, 2026

Copy link
Copy Markdown

Greptile Summary

Pins the audit:dead-code script's pnpm dlx invocation from the floating knip@5 major tag to the exact [email protected] patch release, aligning it with the [email protected] pin pattern already present on the adjacent line.

  • The change is one token in package.json; the script is manual-only and not wired into CI, install, or release paths, so there is no build or runtime impact.
  • [email protected] is a legitimate published release (March 2026) with no reported security issues; it is the version that was actually used for the prior dead-code sweep, making this an exact-replay guarantee rather than an arbitrary pin.

Confidence Score: 5/5

Safe to merge — a one-token version pin in a manual-only audit script with no CI, release, or install-path involvement.

The only changed file is package.json, and the only changed line swaps a floating major tag for a verified exact release. The pinned version ([email protected]) is a real, published release with no reported security issues. The script is never invoked automatically, so nothing in the normal development workflow is affected. The PR description thoroughly documents the TS 7 peer-crash rationale for keeping dlx over devDependencies, and the pattern matches the existing [email protected] pin directly above it.

Files Needing Attention: No files require special attention.

Important Files Changed

Filename Overview
package.json Single-token version pin: knip@5 → [email protected] in the manual audit:dead-code script; version is a legitimate published release with no known security issues.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Developer runs\npnpm audit:dead-code] --> B[pnpm dlx [email protected]]
    B --> C[dlx fetches [email protected]\nwith its own TS 5 peer\nisolated sandbox]
    C --> D[knip runs against\nconfig/knip.json]
    D --> E{Findings?}
    E -- Yes --> F[exit 1 + report]
    E -- No --> G[exit 0]

    style B fill:#90EE90,stroke:#228B22
    style C fill:#fffbe6,stroke:#ccaa00
Loading

Reviews (1): Last reviewed commit: "chore(audit): pin the dead-code audit to..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0d7d85f8-4b84-4aad-92fc-47af70ed2289

📥 Commits

Reviewing files that changed from the base of the PR and between 95c431f and d7e5722.

📒 Files selected for processing (1)
  • package.json

📝 Walkthrough

Walkthrough

The audit:dead-code script now uses Knip version 5.88.1 instead of the unversioned 5 range.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes pinning the Knip version used by the dead-code audit.
Description check ✅ Passed The description includes all required sections and provides clear rationale, testing evidence, AI review coverage, security findings, and follow-up notes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@brennanb2025
brennanb2025 merged commit 3658165 into main Aug 3, 2026
44 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
pnpm dlx knip@5 downloads and runs whatever the newest 5.x is at
invocation time, outside lockfile integrity review — flagged P2 by the
v1.4.165-rc.0 release scan. Pin the exact version, matching the
[email protected] pattern one line up.

Why dlx rather than a devDependency: knip 5.x peer-depends on
typescript@^5, and this repo is on typescript 7.0.2 — installed as a
devDependency, pnpm resolves knip against TS 7 and knip crashes at
module load (verified: same knip against a TS 5 peer runs clean). The
dlx sandbox auto-installs knip's own TS 5, which is the environment the
original stablyai#12077 sweep actually ran in.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant