Skip to content

feat(cli): store_scripts follow-ups: per-reason warning, --no-store-scripts, owner-only files #1268 - #1305

Closed
nc9 wants to merge 4 commits into
mainfrom
feat/1268-store-scripts-followups
Closed

nc9 wants to merge 4 commits into
mainfrom
feat/1268-store-scripts-followups

Conversation

@nc9

@nc9 nc9 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1268

Each acceptance criterion:

  • Per-reason warning. storeCrawlScripts returns skippedByReason; skippedScriptsWarning (apps/cli/src/audit/store-scripts.ts) lists each reason with its count and what applies: too-large and total-cap name their store_scripts_* setting, memory-cap and time-budget say they are fixed bounds (and never tell you to raise a size setting), plus not-javascript and store-error.
  • Overshoot docs. docs/configuration/storage.mdx states the time overshoot (about 20 s: a request in flight runs to its 15 s timeout, then decode), the memory overshoot (up to 10 bodies in flight, the fetch concurrency) and roughly 3x RSS for non-Latin1 bundles.
  • Preload fetch. Not shared: the preload pass runs through a separate fetchScriptContents call with its own counters, and sharing would mean threading one bound through the resource checker. The docs now say it does not share the 256 MB or 120 s bounds (the AC allows this).
  • Test title. Now "1 to 500".
  • --no-store-scripts. Turns store_scripts = true off for one run (storeScripts: false through mergeOptionsToConfig); in the flag table, bash/zsh/fish completions.
  • File modes. content-store.db and project databases, plus -wal and -shm, are chmod 0600 after the schema (new restrictToOwner, @squirrelscan/crawler/file-mode); existing files are tightened on open. Docs state it and that FAT-like file systems ignore it.
  • Empty tables. The AC allowed docs: they are created with the project schema, and the docs say so (making them lazy would need every reader and the crawl-delete table list to tolerate a missing table).

Tests

apps/cli/tests/audit/store-scripts-1255.test.ts: warning text per reason (unit), --no-store-scripts with the config on stores nothing (real CLI), content store and project db plus side files have no group/other bits after an audit (real CLI). packages/config/tests/store-scripts-config-1255.test.ts title. 558 related CLI tests and the config test pass; apps/cli format, lint, tsgo and crawler tsgo clean; make validate passes.

Not in scope: #1280 (store_scripts changing audit results). The docs paragraph that says findings can differ with the option on is untouched for it.

Skill (squirrelscan/skills): no change needed. CHANGELOG under ## [Unreleased] / Fixed. Branched from main separately from #1302 (both touch packages/crawler/src/storage/sqlite.ts init, a small textual conflict is possible, and both add a ### Fixed block to the CHANGELOG).

Review follow-ups: the database file is now created 0600 before the first open (so it never exists wider), the folders squirrel creates for them are 0700, link-cache.db gets the same, and the docs say 'file systems without POSIX modes (Windows, FAT)'.

Compose note (merge order #1302 -> #1305 -> #1310)

Conflicts with #1302 after it lands, and their resolution:

  • CHANGELOG.md: keep both ### Fixed bullets under one block.
  • packages/crawler/package.json: keep both exports, ./sqlite-open and ./file-mode.
  • apps/cli/src/crawler/storage/content-store.ts, link-cache.ts and packages/crawler/src/storage/sqlite.ts imports: import type { Database } from "bun:sqlite", then openSqlite and enableWal from sqlite-open, then restrictToOwner and OWNER_ONLY_DIR_MODE from file-mode. In each getDb/init call restrictToOwner(path) BEFORE openSqlite(path) and enableWal.

… owner-only db files, bound docs #1268

Signed-off-by: Nik Cubrilovic <[email protected]>
…ts check (CodeQL file-system-race) #1268

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9 nc9 mentioned this pull request Oct 30, 2026
@nc9

nc9 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Landed in v0.0.143 as 139c1f4e efa31981 b9fe51b5 85ad9e25 via #1341. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.143. Closing this original.

nik

@nc9 nc9 closed this Oct 30, 2026
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.

store_scripts follow-ups: per-reason skip warning, bound overshoot docs, --no-store-scripts

2 participants