Skip to content

perf(security): Upgrade to Secretlint v14 and use its built-in recommend preset - #2070

Merged
yamadashy merged 1 commit into
mainfrom
feat/secretlint-v14
Nov 26, 2026
Merged

yamadashy merged 1 commit into
mainfrom
feat/secretlint-v14

Conversation

@yamadashy

@yamadashy yamadashy commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Upgrades Secretlint from v13 to v14 and switches to the recommend preset that v14 ships inside @secretlint/core. The security check gets several times faster; findings are unchanged.

Supersedes #2062 (the Renovate bump). That PR only raises the versions, which leaves core v14 running the v13 preset package.

Changes

  • @secretlint/core, @secretlint/types and secretlint: ^13.1.0 → ^14.0.1.
  • securityCheckWorker.ts imports presetRecommend from @secretlint/core/builtin. @secretlint/secretlint-rule-preset-recommend is removed: it is no longer published from v14.
  • The performance.mark override in the worker is removed, together with its type shim secretlint.d.ts. It existed to neutralize the Secretlint profiler, which v14 no longer triggers during lintSource (0 performance.mark calls for 50 files; 3,100 on v13).
  • lint-secretlint drops --secretlintignore .gitignore. The v14 CLI applies .gitignore by default.

Why the import matters

v14's speedup comes from rules declaring keywords: a file without any keyword is skipped without running a rule. That only works with the rules built into v14.

lintSource() per file, the way the worker calls it, single thread:

Repository v13 (main) core v14 + v13 preset (#2062 alone) core v14 + built-in preset (this PR)
repomix (1,346 files, 6.4MB) 173ms 100ms 26ms
ComfyUI (1,339 files, 31.6MB) 518ms 397ms 76ms
cloudflare-os (826 files, 17.7MB) 326ms 257ms 42ms

End to end

node bin/repomix.cjs <repo>, mean of 10 runs:

Repository Before After Without security check (before / after)
repomix 456ms 416ms (-9%) 401ms / 403ms
ComfyUI 1119ms 906ms (-19%) 818ms / 818ms
cloudflare-os 603ms 521ms (-14%) 484ms / 486ms

The wall-time cost of the security check itself drops from 55 / 301 / 119ms to 13 / 88 / 35ms.

All timings were taken on a Mac in low power mode, before and after under the same conditions. Absolute numbers will be lower in normal mode; the unchanged --no-security-check column shows the comparison is clean.

Findings are unchanged

  • The same files are flagged before and after on the three repositories above (0, 1 and 2 files).
  • Fake credentials for AWS, GitHub, Slack, npm, SendGrid, basic auth, Anthropic and Stripe are detected by all three combinations.
  • One difference: the word xapp-le-kernel is no longer reported as a Slack token (fixed upstream in 14.0.1).
  • The existing security tests pass unchanged.

lint-secretlint was checked both with and without the removed flag: a secret in a git-ignored file is skipped, a secret in a tracked location fails the lint.

Dependencies

  • Direct dependencies: 26 → 25.
  • Production tree: 75 → 76 packages. Core v14 adds @textlint/regexp-string-matcher and a nested picomatch, which is one more than the preset package it replaces.
  • package-lock.json shrinks by about 650 lines, mostly from the secretlint CLI (dev dependency).

Not in this PR

The security worker count was tuned in #2052 against v13's cost. With the check this much cheaper, fewer workers may now be optimal; that needs its own measurement.

Checklist

  • Run npm run test
  • Run npm run lint

Note on lint: my local Biome install is older than package.json requires, so I ran Biome 2.6.8 on the changed files via npx, and oxlint, tsc and secretlint through the regular scripts.

🤖 Generated with Claude Code


Devin Review

…end preset

intent(security-check): the security check is one of the slower pipeline stages; Secretlint v14 runs rules only on files that contain a rule keyword
decision(secretlint): import presetRecommend from @secretlint/core/builtin and drop @secretlint/secretlint-rule-preset-recommend, which is no longer published from v14
rejected(secretlint): merging the Renovate bump alone — core v14 with the v13 preset package still works but is only 1.3-1.7x faster instead of 6.6-7.8x, and is not a combination upstream supports
learned(secretlint): v14 no longer calls performance.mark during lintSource (0 calls for 50 files, 3100 on v13), so the worker's performance.mark override and its type shim are removed
learned(secretlint): the v14 CLI applies .gitignore by default, so `--secretlintignore .gitignore` in lint-secretlint is redundant; checked that an ignored file is skipped and a tracked one is still flagged
constraint(detection): findings must not change; the same files are flagged on three repositories and on fake credentials for eight providers, and the only difference is one fixed Slack false positive (`xapp-le-kernel`)
constraint(dependencies): direct dependencies go 26 -> 25, but the production tree goes 75 -> 76 packages (core v14 adds @textlint/regexp-string-matcher and a nested picomatch)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

⚡ Performance Benchmark

Latest commit:63230ed perf(security): Upgrade to Secretlint v14 and use its built-in recommend preset
Status:✅ Benchmark complete!
Ubuntu:0.53s (±0.02s) → 0.46s (±0.01s) · -0.07s (-13.6%)
macOS:0.97s (±0.32s) → 0.83s (±0.31s) · -0.14s (-14.3%)
Windows:0.83s (±0.01s) → 0.76s (±0.02s) · -0.07s (-8.5%)
Details
  • Packing the repomix repository with node bin/repomix.cjs
  • Warmup: 2 runs (discarded), interleaved execution
  • Measurement: 20 runs / 30 on macOS (median ± IQR)
  • Workflow run

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pull request upgrades SecretLint dependencies to version 14. It updates the security worker to use the built-in recommendation preset and removes the worker-only performance mark override.

Changes: SecretLint update

Layer / File(s) Summary
SecretLint dependencies and lint command
package.json, src/core/security/workers/secretlint.d.ts
SecretLint packages are upgraded to version 14. The recommendation preset package and its ambient declaration are removed. The lint command no longer sets .gitignore as its ignore file.
Worker preset and performance mark handling
src/core/security/workers/securityCheckWorker.ts
The worker uses presetRecommend from @secretlint/core/builtin. It no longer overrides performance.mark in non-main threads or logs an error if that override fails.

Change: Other

Merge Risk: Minimal · up to 63230 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4 · Inconclusive 2

Failed Failed checks: 2 inconclusive

Check name Status Explanation Resolution
Docs In All Locales Inconclusive Pull request inputs changed after this check was assessed; its verdict is no longer current. Re-run the check against the current pull request inputs.
Tests For Behavior Changes Inconclusive Pull request inputs changed after this check was assessed; its verdict is no longer current. Re-run the check against the current pull request inputs.
Passed Passed checks: 4 passed

Check name Status Explanation
Title check Passed The title names the main change: upgrading Secretlint to v14 and using its built-in recommend preset. The title uses the perf(security) prefix, and the description reports a measured speedup in the se…
Description check Passed The description covers the change, the reason for it, the dependency and file changes, measured results, and verification. It follows the repository template by including the Checklist with the npm ru…
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.
Full details: Title check

Explanation

The title names the main change: upgrading Secretlint to v14 and using its built-in recommend preset. The title uses the perf(security) prefix, and the description reports a measured speedup in the security check. The title matches the changeset and the stated objectives.

Full details: Description check

Explanation

The description covers the change, the reason for it, the dependency and file changes, measured results, and verification. It follows the repository template by including the Checklist with the npm run test and npm run lint items, both marked complete. The author also explains the lint tooling workaround and the deferred worker-count tuning.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 7bde93e and 63230ed.

Files ignored due to path filters: 1

  • package-lock.json is excluded by !**/package-lock.json, !**/package-lock.json
Files selected for processing: 3

  • package.json
  • src/core/security/workers/secretlint.d.ts
  • src/core/security/workers/securityCheckWorker.ts
Files with no reviewable changes: 1

  • src/core/security/workers/secretlint.d.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@codecov

codecov Bot commented Nov 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.28%. Comparing base (f609aad) to head (63230ed).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2070      +/-   ##
==========================================
+ Coverage   96.22%   96.28%   +0.06%     
==========================================
  Files         139      139              
  Lines        6309     6304       -5     
  Branches     1602     1601       -1     
==========================================
- Hits         6071     6070       -1     
+ Misses        238      234       -4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@claude

claude Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Review: LGTM 👍

The PR is small and does what it says. I checked the main claims against the installed v14 packages and found no blocking issues.

Details

What I checked

  • Removing the profiler workaround is safe. In v14, @secretlint/profiler is off by default (enabled ?? false). mark() returns before doing anything, and it only keeps running totals, not an entry list that grows without limit. The O(n²) performance.mark problem that the old override worked around is gone, so deleting it (and secretlint.d.ts) along with the isMainThread guard is correct.
  • The config cache still works. v14 caches the lint plan in a WeakMap keyed by the config object. The worker's module-level cachedConfig gets a cache hit on every file. The MCP tools build a new config for each call, but they lint one file per call, so that's fine.
  • Findings are unchanged. I ran runSecretLint from main (v13) and from this PR (v14) over the same 9,559 files (node_modules, tests, website). Both flagged the same 5 files with the same message counts.
  • .secretlintrc.json still works. The v14 CLI resolves the @secretlint/secretlint-rule-preset-recommend id to the built-in preset. A tracked file containing a GitHub token fails secretlint with exit 1, and npm run lint-secretlint passes on the repo.
  • Types and tests pass. tsc --noEmit is clean, and tests/core/security + tests/mcp pass (358 tests). The @secretlint/core/builtin subpath export ships its own .d.ts.

Nits (optional)

  • The rule id '@secretlint/secretlint-rule-preset-recommend' in createSecretLintConfig now names a package that is no longer installed. It still matches what v14 reports (the CLI prints @secretlint/secretlint-rule-preset-recommend > @secretlint/secretlint-rule-github), so keep it. A one-line comment saying the id is kept for compatibility with the built-in preset could help a future reader.

No AI bot inline comments needed triage.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Devin Review: 1 flag

Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

@yamadashy
yamadashy merged commit 98154fc into main Nov 26, 2026
56 checks passed
@yamadashy
yamadashy deleted the feat/secretlint-v14 branch November 26, 2026 12:43
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