Repository navigation
feat(cli): opt-in storage of fetched first-party scripts in the content store #1255 - #1267
Merged
Merged
Conversation
…nt store #1255 Signed-off-by: Nik Cubrilovic <[email protected]>
… it dropped, honest retention docs #1255 Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
force-pushed
the
feat/store-scripts-1255
branch
from
October 29, 2026 07:54
eebe8a2 to
781bdbd
Compare
Signed-off-by: Nik Cubrilovic <[email protected]>
#1255 Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
marked this pull request as ready for review
October 29, 2026 08:15
Closed
7 tasks done
|
Review of #1267 (opt-in
I found no security problems. Script bodies are only stored and hashed, never executed or rendered. Skipped scripts and sizes are bounded by config caps. |
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.
Closes #1255
What
Opt-in
[storage] store_scripts = true(andsquirrel audit --store-scriptsfor one run) keeps the first-party scripts an audit fetched in the content store, for corpus and research runs that re-analyse a crawl later.crawl_scriptstable in the project DB (created with the schema, no migration): script URL, content hash, size, status, skip reason, and the page URLs that load it (getCrawlScripts(crawl, { pageUrl })rebuilds "page + its bundles";getCrawlScriptBody(crawl, url)reads a body).store_scripts_max_bytes(default 2 MB per file; over it the script is recorded asskipped/too-largewith its size and its body is never hashed or compressed) andstore_scripts_total_bytes(default a quarter ofcontent_store_max_bytes; distinct bytes per audit, a shared bundle counts once; past itskipped/total-cap). Both take numbers or size strings.content_store_max_bytes);retainPageBodiestouches them with the HTML;crawl_scriptsis inRETIREABLE_TABLES, sokeep_auditsretention andself disk --pruneretire the index with the audit.--store-scripts.Evidence
packages/crawler/tests/store-scripts-1255.test.ts(11): retrieval by URL per crawl, dedupe (one put, one row, across crawls too), page link, per-file cap (size kept, body never written), total cap with shared-bundle accounting, failed or bodiless scripts leave no row, store error skips one script, no store = nothing, retention touches the hashes, and 20 distinct 5 MB bundles plus 20 copies (200 MB of input) stop at the cap with 3 writes, no copies written, heap growth under 64 MB.apps/cli/tests/audit/store-scripts-1255.test.ts(7): realsquirrel audit --offline --httpagainst a fixture site: two pages, a shared bundle under two URLs, an own bundle, an oversized one. Asserts the index, one content-store row for the shared bundle, gunzipped bodies equal the served bytes, the oversized one skipped with its size, the total cap, the config key without the flag, and OFF by default (no rows, no JS in the store).packages/config/tests/store-scripts-config-1255.test.ts(3).tsgo --noEmitclean for config, utils, crawler, cli; CLI lint andformat:checkclean;scripts/test-suites.ts --check; docsmake validate; detect-secrets; content-store, retention, disk and home-guard tests still pass.Docs
docs/configuration/storage.mdx(option, the three keys, disk cost, how it interplays withkeep_auditsandcontent_store_max_bytes, privacy: stays local),docs/cli/audit.mdx(flag), CHANGELOG under Unreleased.Skill
The squirrelscan agent skill (
squirrelscan/skills) needs no change.Known, deferred
--no-store-scripts(config on, flag off).store_scripts_total_bytesdefault is a quarter of the compressed store cap but counts decoded text (documented).crawl_scriptstables are created in every project DB even with the option off.memory-cap/time-budget.