fix(fix): add --exclude-paths so socket fix can skip unreadable directories#1339
Open
Martin Torp (mtorp) wants to merge 4 commits into
Open
fix(fix): add --exclude-paths so socket fix can skip unreadable directories#1339Martin Torp (mtorp) wants to merge 4 commits into
Martin Torp (mtorp) wants to merge 4 commits into
Conversation
socket fix walks the project tree to collect manifest files before uploading them to the API. That walk runs through fast-glob which throws on the first unreadable subdirectory: EACCES: permission denied, scandir '/home/user/proj/data/postgres/pgdata' A postgres data dir owned by another uid, an unreadable Docker volume mount, or any other directory the running user can't enter would crash 'socket fix' before coana is even invoked. The existing --exclude flag is forwarded to coana for workspace-level filtering but never threaded into the manifest discovery walk, so users had no way to skip problem directories. Mirror the --exclude-paths shape already used by 'socket scan create' (same validation, same anchored micromatch semantics, same ignore expansion) and pass it to getPackageFilesForScan as additionalIgnores.
Make --exclude-paths the canonical path-exclusion flag on socket fix: its value is now also forwarded to coana's --exclude alongside the existing --exclude entries, so a matched path is skipped consistently across manifest upload and fix application. Hide the legacy --exclude flag in --help. Its narrower fix-application only semantic is preserved unchanged so existing scripts that rely on 'detect vulnerabilities everywhere, only write fixes outside the excluded workspace' continue to work — but new users land on --exclude-paths.
Benjamin Barslev Nielsen (barslev)
approved these changes
May 28, 2026
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.
Summary
socket fixcrashes when its manifest-discovery walk hits an unreadable directory (e.g. a postgrespgdataowned by another uid inside a backend repo):The existing
--excludeflag is only consulted for workspace filtering at fix-application time inside coana — it never reaches the manifest-discovery walk, so users have no way to skip the problem directory.Change
Add
--exclude-pathstosocket fix, mirroringsocket scan create's validation and pattern handling. The value is applied in both stages of the pipeline:excludePathToScanIgnoresand passed togetPackageFilesForScanasadditionalIgnores, so the offending paths never enter the upload tar.--excludearray forwarded to coana, so any workspace that did slip through is still skipped during fix application.Validated via
assertValidExcludePaths(rejects negation, absolute paths,.., degenerate sentinels) before any network call.The pre-existing
--excludeflag keeps its previous narrower (fix-application only) semantic for back-compat, but is hidden from--helpin favor of--exclude-paths.Release: 1.1.109.
Test plan
handle-fix-limit.test.mtscover both wirings: populated/emptyexcludePaths→additionalIgnores, and merged forwarding to coana's--exclude(legacy entries first, then--exclude-pathsentries).--helpsnapshot updated incmd-fix.integration.test.mts—--excluderemoved,--exclude-pathsadded.pnpm check:tscclean;vitest run src/commands/fix/handle-fix-limit.test.mts— 12/12 pass.dist/and confirmed the new flag is documented, the hidden--excludestill parses, and--exclude-paths '\!negation'is rejected with a clear error.