Repository navigation
Speed up secret scanning by turning off Secretlint's profiler - #1352
Merged
Benjamin Christopher Simmonds (benibenj) merged 3 commits intoNov 24, 2026
Merged
Benjamin Christopher Simmonds (benibenj) merged 3 commits into
Benjamin Christopher Simmonds (benibenj) merged 3 commits into
Conversation
Upgrade Secretlint packages to 13.1.0 and disable internal profiling before file and in-memory scans. Preserve secret detection with realistic fixtures and regression coverage for profiling, disabled scanning, and updated rules. Co-authored-by: Copilot <[email protected]>
Member
Author
Resolve the dependency manifest and lockfile conflicts while keeping both branches' updates. Co-authored-by: Copilot <[email protected]> Copilot-Session: c6702bc7-8e98-4ab3-99ba-07d071bc50f5
Contributor
|
Thanks Bill, the speedup is great. I could reproduce it locally: scanning ~8k files went from ~260 s to ~4 s. The jump to Secretlint 13.1.0 also changes which secrets get caught, though:
To get the speedup in quickly, I split this up:
Your branch allows maintainer edits, so I pushed the change there and updated the description. |
Hold @secretlint/secretlint-rule-preset-recommend at 10.2.2 so this change only affects scanning speed: every detection rule lives in that package, and core, source-creator, types and no-dotenv behave the same in 13.1.0. The rule upgrade moves to a separate PR. Load the profiler from @secretlint/core's own location instead of declaring it as a direct dependency, so disabling it always reaches the instance core uses. Co-authored-by: Copilot <[email protected]>
This was referenced Nov 23, 2026
Benjamin Christopher Simmonds (benibenj)
enabled auto-merge
November 23, 2026 18:46
Benjamin Christopher Simmonds (benibenj)
approved these changes
Nov 23, 2026
Dirk Bäumer (dbaeumer)
approved these changes
Nov 24, 2026
Benjamin Christopher Simmonds (benibenj)
merged commit Nov 24, 2026
a2a8745
into
microsoft:main
4 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before: Packaging an extension with many files spent most of its time scanning for secrets. Secretlint's built-in profiler recorded performance marks for every file and every rule, and each new mark searched through all earlier ones, so scan time grew roughly with the square of the file count. vsce never reads those measurements.
After: vsce upgrades Secretlint's core to 13.1.0 and turns its profiler off, so scan time grows linearly with the number of files. Which secrets get detected doesn't change: the detection rules stay at the version vsce uses today.
Measured locally (macOS, Apple Silicon, Node 24), with extensions made of VS Code source files:
vsce package, 2,048 files (median of 3)This is part 1 of splitting the original change. The detection-rule upgrade moved to #1358, and the move to Secretlint v14 is in draft #1359.
Details
Changes
@secretlint/core,source-creator,typesandsecretlint-rule-no-dotenvgo from 10.2.2 to 13.1.0. For vsce they behave the same in both versions: the only source change in core is a fix to secret masking, which vsce doesn't use.@secretlint/secretlint-rule-preset-recommendstays at 10.2.2. All detection logic lives in that package, so findings are identical.secretLintProfiler.setEnabled(false)(available since 13.0.7) before scanning. The profiler is loaded from@secretlint/core's own location, so the switch always reaches the instance core uses, even when npm installs a second copy of the profiler somewhere else in the tree.Side effects
performance.markusers in the same process are unaffected; a test checks this.preset-recommendat install, because upstream deprecated every version. That's unchanged here; the v14 draft removes the package.Testing
npm test: 404 passing. The new tests force the profiler on, run real file and in-memory scans, and check that no Secretlint marks or measures are recorded while findings are still reported. They fail if the switch is removed..envfiles) and for all 9,892 files of 31 real extensions.vsce packagerun on 2,048 files with dbgjs. In the live process, core's profiler instance reportsisEnabled: falseand never starts its observer. After scanning, main had recorded 73,800 Secretlint marks and 36,864 measures and spent about 11.5 s of a 15 s CPU profile inside the profiler's observer; this PR recorded none and has no profiler frames.@secretlint/[email protected]. npm nested core's own copy, and scanning still recorded no marks.