From a376b21aba65fd9c094c94a7ae2e640744be4cfb Mon Sep 17 00:00:00 2001 From: AlexanderLevenskikh Date: Tue, 1 Dec 2026 10:28:45 +0500 Subject: [PATCH] fix: align public sanitization gate and retain follow-up audit --- .github/workflows/ci.yml | 2 + .../2026-12-01/corrected-core-boundaries.json | 129 +++++++++++ docs/audits/2026-12-01/full-followup.md | 201 ++++++++++++++++++ .../2026-12-01/published-data-readback.json | 171 +++++++++++++++ .../2026-12-01/released-core-boundaries.json | 145 +++++++++++++ .../2026-12-01/released-core-boundaries.py | 192 +++++++++++++++++ scripts/check-public-sanitization.py | 12 +- tests/test_public_sanitization.py | 79 +++++++ 8 files changed, 930 insertions(+), 1 deletion(-) create mode 100644 docs/audits/2026-12-01/corrected-core-boundaries.json create mode 100644 docs/audits/2026-12-01/full-followup.md create mode 100644 docs/audits/2026-12-01/published-data-readback.json create mode 100644 docs/audits/2026-12-01/released-core-boundaries.json create mode 100644 docs/audits/2026-12-01/released-core-boundaries.py create mode 100644 tests/test_public_sanitization.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 45fef00..d877ba8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,8 @@ jobs: - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 with: python-version: ${{ matrix.python }} + - name: Verify public release sanitization + run: python scripts/check-public-sanitization.py - uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0 with: node-version: '24.18.0' diff --git a/docs/audits/2026-12-01/corrected-core-boundaries.json b/docs/audits/2026-12-01/corrected-core-boundaries.json new file mode 100644 index 0000000..8ce07ce --- /dev/null +++ b/docs/audits/2026-12-01/corrected-core-boundaries.json @@ -0,0 +1,129 @@ +{ + "coreDirectory": "accepted-core-source", + "expected": "fixed", + "loaded": { + "dependency_live_roadmap_generator": "accepted-core-source/dependency_live_roadmap_generator.py", + "migration_research": "accepted-core-source/migration_research.py", + "peer_solver_model": "accepted-core-source/peer_solver_model.py", + "peer_solver_transition": "accepted-core-source/peer_solver_transition.py" + }, + "fileSha256": { + "dependency_live_roadmap_generator.py": "876cd0f6ecebbd9e2987384ec27fdfd1be0207dd4adbe1bfad245b6216b5035d", + "migration_research.py": "6c98f68a1fa77a3ce9186de638f5f7041981ca14ebab13b7cfd601d1730a4cce", + "peer_solver_model.py": "7653535756327a2c2e30f7971374e11b9a64e237546af79ea6cbb44a24408b7b", + "peer_solver_transition.py": "4e6d7c7cc0ff15ecaa906ee7f71d9445681679d1b8548531da4fa2181ab41df3" + }, + "C01": [ + { + "scope": "collect", + "environment": { + "DEPLOOM_DRAFT_PRIVATE_SCOPES": "@company" + }, + "package": "@company/private", + "publicCallbackCalls": 0, + "unknown": [ + "PRIVATE_SCOPE_EXCLUDED" + ], + "outboundPackage": null + }, + { + "scope": "collect", + "environment": { + "DEPLOOM_MCP_PRIVATE_SCOPES": "@company" + }, + "package": "@company/private", + "publicCallbackCalls": 0, + "unknown": [ + "PRIVATE_SCOPE_EXCLUDED" + ], + "outboundPackage": null + }, + { + "scope": "collect", + "environment": { + "DEPLOOM_DRAFT_DISABLE_EXTERNAL_EVIDENCE": "1" + }, + "package": "public-name", + "publicCallbackCalls": 0, + "unknown": [ + "EXTERNAL_EVIDENCE_DISABLED_BY_HOST_POLICY" + ], + "outboundPackage": null + }, + { + "scope": "collect", + "environment": { + "DEPLOOM_MCP_LOCAL_CACHE_ONLY": "1" + }, + "package": "public-name", + "publicCallbackCalls": 0, + "unknown": [ + "EXTERNAL_EVIDENCE_DISABLED_BY_HOST_POLICY" + ], + "outboundPackage": null + }, + { + "scope": "release-builder", + "status": "unavailable", + "jsonCalls": 0, + "textCalls": 0, + "summary": "External release lookups unavailable: EXTERNAL_EVIDENCE_DISABLED_BY_HOST_POLICY" + } + ], + "C02": [ + { + "scope": "github-origin", + "method": "fetch_text", + "url": "https://evil.invalid/github/changelog", + "syntheticBearerPresent": false + }, + { + "scope": "github-origin", + "method": "fetch_json_url", + "url": "https://api.github.com.evil.invalid/releases", + "syntheticBearerPresent": false + }, + { + "scope": "github-origin", + "method": "fetch_json_url", + "url": "http://api.github.com/repos/example/project/releases", + "syntheticBearerPresent": false + }, + { + "scope": "registry-session", + "basicAuth": false, + "customHeader": false, + "cookie": false, + "queryParameter": false, + "clientCertificate": false + } + ], + "C03": [ + { + "reason": "USER_BASELINE_REQUIRED_UPDATE: router must change", + "modelRejectsTarget": "USER_BASELINE_REQUIRED_UPDATE: router must change", + "safe": false, + "groups": [], + "unresolved": [ + "INVALID_TARGET_ENDPOINT: USER_BASELINE_REQUIRED_UPDATE: router must change" + ] + }, + { + "reason": "USER_EXACT_TARGET: router must be 2.0.0", + "modelRejectsTarget": "USER_EXACT_TARGET: router must be 2.0.0", + "safe": false, + "groups": [], + "unresolved": [ + "INVALID_TARGET_ENDPOINT: USER_EXACT_TARGET: router must be 2.0.0" + ] + } + ], + "network": "All transports intercepted; socket.connect/connect_ex forbidden", + "scenarioCount": 11, + "result": "PASS_EXPECTED_FIXED", + "harnessSha256": "cb3737b1f3e1480a0281c769899aafe3ae490bd10caafa6d2fe3d527629391b3", + "retainedReceipt": { + "locationRedaction": "Only local absolute source paths were replaced by role-relative paths. Scenario results, module hashes, release identity and harness hash are unchanged.", + "originalReceiptSha256": "07a6920560c45f31e835d3884a8bac71b86bc34c6a168740a2689fd59e911de3" + } +} diff --git a/docs/audits/2026-12-01/full-followup.md b/docs/audits/2026-12-01/full-followup.md new file mode 100644 index 0000000..78b68d0 --- /dev/null +++ b/docs/audits/2026-12-01/full-followup.md @@ -0,0 +1,201 @@ +# DepLoom integrated follow-up audit — 1 December 2026 + +## Scope and delivery checkpoint + +This follow-up reviewed Core, MCP, the npm distribution and knowledge corpus, +and Playground. The four accepted component PRs received regression checks, +independent agent review and their applicable PR gates. A supplemental +release-tooling correction, C05, accompanies this report and still requires +its own PR qualification. This report supplements the +[historical 51-row checkpoint](../2026-11-29/README.md); it does not mark that +entire matrix closed or rewrite earlier acceptance states. + +| Component | Accepted source | Fix PR | +| --- | --- | --- | +| Core | `00726b66c3bab12c8e3836abf450b5a7c4e61e36` | [#48](https://github.com/levencode-labs/deploom-core/pull/48) | +| MCP | `cd05e91e6494c0fe9fccd8a9d87264ff140a66b4` | [#81](https://github.com/levencode-labs/deploom-mcp/pull/81) | +| npm | `b3b65d20ae8fce2d181486699ae38125d2e18a3f` | [#182](https://github.com/levencode-labs/deploom-npm/pull/182) | +| Playground | `daa9bfa351a3add393e2d26d835fe458f5c6cbb5` | [#18](https://github.com/levencode-labs/deploom-playground/pull/18) | + +MCP now pins the accepted Core revision and its regenerated integrity +manifest. Source publication does not establish delivery to existing users: +the observed public packages remain **Core 0.1.22, MCP 0.2.34 and npm 0.2.31**. +MCP's post-merge workflows passed. npm's post-merge POSIX, public-data and +source-scan jobs passed; its Windows job was still executing at this checkpoint. +The npm Pages deployment and installed readback completed successfully at +**revision 88**, following the pre-merge live revision 87. Playground's +corrected browser code and refreshed OSV data were separately read back after +deployment. + +## Confirmed findings and corrections + +This pass confirmed **12 findings: two P1, eight P2 and two P3**. Eleven are +covered by the accepted component PRs; C05 is the supplemental correction +described below. + +Detailed reproducers and verification limits are retained in the accepted +[Core report](https://github.com/levencode-labs/deploom-core/blob/00726b66c3bab12c8e3836abf450b5a7c4e61e36/docs/audits/2026-12-01/core-second-pass.md), +[MCP report](https://github.com/levencode-labs/deploom-mcp/blob/cd05e91e6494c0fe9fccd8a9d87264ff140a66b4/docs/audits/2026-12-01/cache-second-pass.md) +and [npm report](https://github.com/levencode-labs/deploom-npm/blob/b3b65d20ae8fce2d181486699ae38125d2e18a3f/docs/audits/2026-12-01/npm-second-pass.md). + +| ID | Priority | Impact and correction | +| --- | --- | --- | +| C01 | P1 | Optional public research could dispatch a host-private package identity, and release lookups ignored external-evidence restrictions. Admission now checks the union of Core/MCP host policies before transport or evidence reuse; restricted or malformed policy returns explicit unavailable/unknown reasons. | +| C02 | P1 | Generic helpers chose GitHub bearer authentication by URL substring and public requests could inherit registry credentials, cookies, headers, query parameters and client certificates. Exact approved HTTPS origins now govern bearer attachment; a separate public session preserves approved proxy/CA routing without registry identity or implicit netrc authentication. | +| C03 | P2 | The public transition refiner could declare an unchanged target safe despite a required-update or exact-target constraint. It now validates the complete final assignment before baseline exceptions, preserving existing domain and cardinality diagnostics. | +| C04 | P3 | The test guide documented only three of six general CI profiles. It now lists all profiles and separate ownership jobs. | +| C05 | P2 | The release sanitizer rejected an existing quoted synthetic proxy-credential fixture in `tests/test_plan_registry_facts.py`. `release_ci.py` invoked this gate, but ordinary CI did not. The supplemental correction narrowly allows the exact quoted literal at that fixture path, adds negative controls and invokes the full scanner in all six existing general CI profiles without reducing the matrix. Its PR qualification remains pending. | +| MCP01 | P2 | A busy or replaced v3 database could fall back to timeless v2, bypassing signed freshness. Reads now fail closed with `KNOWLEDGE_SNAPSHOT_BUSY`; final continuity checks cover early returns, SQLite errors, replacement and sidecars at symlink targets. | +| MCP02 | P2 | An expired GitHub release-asset redirect failed without bounded recovery. The transport closes error responses and permits one new request to the original approved OSV publisher URL for the specific 618 `jwt:expired` condition, within the original 45-second budget. Trust, size, hash and 304 checks remain intact. | +| NPM01 | P2 | Direct POSIX SIGINT/SIGTERM could leave the owned runtime alive. The launcher forwards shutdown, waits, removes its lease and applies a five-second forced-stop fallback. | +| NPM02 | P2 | A lease rename failure after spawn left the runtime and starting lease behind. Failed registration now stops and awaits the owned runtime, cleans staging state and returns the original startup error. | +| NPM03 | P2 | POSIX installed diagnostics omitted the wheel digest from the hash lock and treated malformed entries as absent metadata. Exact digest checks now apply; a present malformed, missing-entry or duplicate-entry lock fails closed. Truly absent metadata remains unavailable. | +| NPM04 | P3 | The knowledge-priority document understated coverage and proposed a TypeScript boundary already supported by typecheck evidence. It now records 24/30 with explicit evidence limits and six remaining major gaps. | +| PLAY01 | P2 | The hosted OSV exporter discarded standard global/package severity vectors, losing scores or producing Unknown severity. It now retains those vectors and the browser consumes them while preserving legacy labels. Builder, browser and Worker/fallback regressions cover the correction. | + +C05 was discovered by running the existing release gate before publishing this +report; report additions did not cause the rejection. It affects release +tooling and CI, not bundled Core runtime files. Five scanner regressions and +the original fixture test pass locally. The accepted runtime source and MCP +Core pin remain `00726b66c3bab12c8e3836abf450b5a7c4e61e36`; no supplemental +commit SHA or completed PR result is asserted here. + +The [accepted Playground implementation](https://github.com/levencode-labs/deploom-playground/blob/daa9bfa351a3add393e2d26d835fe458f5c6cbb5/docs/hosted-audit.js) +matched the live JavaScript readback. The refreshed +[OSV export](https://github.com/levencode-labs/deploom-playground/tree/e1c1f933546f37b3a5c9b4f31b6b5a3243101314) +retained scores on **10,039 affected-package rows spanning 7,100 distinct +advisory IDs**. These are preserved severity fields, not newly discovered +vulnerabilities. CVSS v4 vectors remain available but are not scored by the +current v3 scorer; unsupported severity remains Unknown without hiding findings. + +### Released-runtime risk boundaries + +The [offline harness](released-core-boundaries.py) exercised **11 synthetic +cases** against the official MCP 0.2.34 wheel's bundled Core 0.1.22, with +manifest file hashes checked and all transports intercepted. The +[released receipt](released-core-boundaries.json) reproduces C01–C03; the +[corrected receipt](corrected-core-boundaries.json) passes all corresponding +fixed-source cases. Retained JSON normalizes only local source paths, preserves +all outcomes, hashes and provenance, and records the raw receipt SHA-256. No +private identity or real credential was transmitted. + +C02 establishes a generic helper and credential-isolation defect. Current +release-building code constructs canonical GitHub URLs; the reproducer does +not demonstrate a remote exploit through current registry metadata. C03 +establishes a public transition API boundary defect: ordinary planner callers +use solver-validated targets, so this does not demonstrate an unsafe complete +planner result. These limits do not remove the need to deliver the corrections +to installed release users. + +## Verification and retained uncertainty + +All applicable gates for the four accepted fix PRs passed, including native +platform jobs: +[Core CI](https://github.com/levencode-labs/deploom-core/actions/runs/46579108086), +[MCP CI](https://github.com/levencode-labs/deploom-mcp/actions/runs/46580547353) +and its five auxiliary workflows, +[npm package CI](https://github.com/levencode-labs/deploom-npm/actions/runs/46579411587), +and [Playground CI](https://github.com/levencode-labs/deploom-playground/actions/runs/46578432972). +These are PR qualification results, separate from C05's pending PR gate and +installed-release acceptance. The +[MCP main CI](https://github.com/levencode-labs/deploom-mcp/actions/runs/46581636331) +and three main auxiliary workflows also passed. The supplemental C05 correction +still requires the exact CI result of the commit carrying this report. + +The successful [npm Pages run](https://github.com/levencode-labs/deploom-npm/actions/runs/46581955083) +retains [both installed-reader receipts](published-data-readback.json). +The exact released MCP 0.2.34 wheel verified signatures, full v2/v3 parity for +all 1,532 records at revision 88, OSV manifest/database integrity and expiry +refusal. A separately qualified historical MCP 0.2.35 data reader verified +signed freshness as FRESH. Its scope is explicitly `KNOWLEDGE_DATA_GATE_ONLY`; +it is not the newly corrected MCP head or an accepted replacement runtime. +Independent live index reads confirmed revision 88 and the unchanged corpus +source digests. The receipts are extracted JSON from the successful native job +log, with reader identities preserved. + +Local full-suite limitations remain explicit. Core baseline/corrected runs +executed 849/858 tests, each with six failures, 11 errors and 95 skips. MCP +executed 1392/1403, each with 76 failures, 95 errors and 108 skips; this comparison +preceded the final Core repin. Failure identities were unchanged. This host +lacks the required `/proc/self/task//children` capability, so ownership +guards correctly refused native work; MCP also encountered proxy dependency +limitations. Neither local full suite was green. No ownership guard or test +matrix was weakened. Focused Core tests, MCP repin/integrity checks, 38 npm +Node tests, four probe tests, and 96 Playground Node plus three builder tests +passed; component reports retain their precise scopes. + +The npm Windows PR run passed on **attempt 2**. Attempt 1 is retained in PR182: +the v1 index body was unchanged, SHA-256 +`bd175e44ab1e1dd4bbccc7e4035024505ccaf89a79657d588aebc3495720954f`, +while ETag digests differed. The root cause is not established. Improved +diagnostics preserve bounded body/ETag comparisons; the strict empty-304 +requirement is unchanged. The rerun does not explain the earlier incident. + +## Knowledge checkpoint and next work + +The accepted [coverage map](https://github.com/levencode-labs/deploom-npm/blob/b3b65d20ae8fce2d181486699ae38125d2e18a3f/docs/COVERAGE.md) +records **1,532 cards, 697 packages and 1,521 exact transitions**: 228 +fixture-behavior, 27 typecheck, 124 module-load, 70 source-inspection and 1,083 +source-pinned-metadata. Of the packages, 472 currently have metadata-only +evidence. This audit did not manufacture execution evidence or rerun a corpus +registry campaign. + +The [major-priority milestone](https://github.com/levencode-labs/deploom-npm/blob/b3b65d20ae8fce2d181486699ae38125d2e18a3f/knowledge/review/MAJOR_MIGRATION_PRIORITIES.md) +is **24/30**: 22 packages have fixture-behavior/typecheck; Babel and jest-dom +have module-load only. Counting requires an exact adjacent-major replay with +both majors present in the pinned consumer index. These are evidence counts, +not a compatibility percentage. + +### 1. Close the six major gaps + +Prioritize React Testing Library **15→16** and Vite React plug-in **5→6**, then +Vue **2→3**, Angular Core **21→22**, react-i18next **16→17** and webpack +**4→5**. Existing Vue/webpack minor or patch fixtures and Angular 18→19 do not +satisfy these boundaries. Select pinned consumers and real render, build, +translation or application contracts. Acceptance is six retained exact-version +cases: baseline passes, an asserted migration break reproduces on the unchanged +target, and the repair passes the same behavioral contract. Promote the metric +to 30/30 only after evidence admission; an unobserved break cannot become an +execution-verified card. + +### 2. Strengthen existing evidence + +Extend Babel **7.0.0→8.0.0** from loading to real plug-in transformation and +output execution; extend jest-dom **5.17.0→6.1.5** to actual DOM matcher +assertions. TypeScript **6.0.2→7.0.2 already has retained typecheck evidence**. +Its next step is two pinned consumers, Node and frontend, proving clean emitted +output and runtime/bundler alias resolution. Acceptance is two stronger +behavioral records plus two consumer reports with negative controls against +stale output and unresolved imports. Together with package 1, the stronger +major-coverage target becomes 30/30; arbitrary-project compatibility remains +unproven. + +### 3. Expand environment qualification + +Current evidence identifies Linux/Windows for five cards, Chromium for two, +and pnpm/yarn for three each. macOS, Firefox, WebKit and physical mobile devices +are not claimed. Preserve the existing +[ten qualification legs](https://github.com/levencode-labs/deploom-npm/blob/b3b65d20ae8fce2d181486699ae38125d2e18a3f/knowledge/review/stage-b/qualification/manifest.json). +Add macOS npm/pnpm/yarn for Prettier/Zod (three legs), Linux/Windows pnpm/yarn +for the composite workspace (four), macOS npm workspace (one), and desktop +React UI on Linux Firefox/macOS WebKit (two). Acceptance is **20 mandatory +legs**, with exact toolchain/browser pins, retained receipts and unchanged +negative controls. Freeze scenario lists before execution; failed required +cells remain open. Desktop WebKit and viewport emulation do not establish +native Safari or physical-device acceptance. + +## Remaining delivery and historical gates + +Deliver the accepted Core/MCP source chain through reviewed runtime archives, +signed manifests and new package releases, then verify ordinary clean install, +update, interrupted recovery and rollback on each required native profile. +Recheck public signed knowledge bytes and installed readers for the resulting +edition. Source pins and passing PR jobs alone do not satisfy these gates. + +The historical corrective-release **NO_GO** is not retroactively cleared. +[MCP issue #53](https://github.com/levencode-labs/deploom-mcp/issues/53) retains +an unavailable original Windows failure receipt and an unestablished cause; +later success does not close it. Complete ordinary Codex, OpenCode and Claude +Code project acceptance with retained client receipts. Preserve every earlier +implementation, source, publication and installed-acceptance state until its +own evidence changes. diff --git a/docs/audits/2026-12-01/published-data-readback.json b/docs/audits/2026-12-01/published-data-readback.json new file mode 100644 index 0000000..9e3639b --- /dev/null +++ b/docs/audits/2026-12-01/published-data-readback.json @@ -0,0 +1,171 @@ +{ + "schemaVersion": 1, + "source": { + "run": "https://github.com/levencode-labs/deploom-npm/actions/runs/46581955083", + "job": "https://github.com/levencode-labs/deploom-npm/actions/runs/46581955083/job/142420495940", + "format": "JSON objects extracted from decoded successful GitHub Actions job log; no fields rewritten." + }, + "releaseQualification": "These receipts verify published data compatibility and freshness. The staged data-only reader is historical and does not qualify the new MCP audit fixes for release.", + "releasedRuntimeReadback": { + "aggregateRefresh": { + "ok": true, + "schemaVersion": 1, + "sources": { + "knowledgeV1": { + "status": "READY" + }, + "knowledgeV2": { + "status": "READY" + }, + "knowledgeV3": { + "status": "READY" + }, + "osv": { + "edition": "osv-1796038397-d847d5e30c66e469", + "status": "READY" + } + }, + "status": "READY" + }, + "coreRevision": "8c65fc7311062169d1b1e058c5463a39efaed3d9", + "expiredSnapshot": { + "reason": "SNAPSHOT_STALE", + "status": "UNKNOWN" + }, + "installedRuntime": { + "coreFilesVerified": 158, + "coreRevision": "8c65fc7311062169d1b1e058c5463a39efaed3d9", + "installedRecordFilesVerified": 294, + "mcpCommit": "0c990137e3b713f944cd7a053f04d0e8470af337", + "mcpVersion": "0.2.34", + "runtimeOrigin": "installed-published-wheel", + "sourceImportsAllowed": false, + "status": "EXACT_PUBLISHED_WHEEL_INSTALLED", + "wheelSha256": "38bf385854cedb97734d5f86d38803d2bba49ce106a1e36d3bded2b89cabc5ad", + "wheelUrl": "https://github.com/levencode-labs/deploom-mcp/releases/download/v0.2.34/deploom_mcp-0.2.34-py3-none-any.whl" + }, + "knowledge": { + "evidenceLevels": { + "fixture-behavior": 228, + "module-load": 124, + "source-inspection": 70, + "source-pinned-metadata": 1083, + "typecheck": 27 + }, + "reviewedRecordParity": true, + "v1": { + "revision": 88, + "signatureVerified": true + }, + "v2": { + "records": 1532, + "revision": 88, + "signatureVerified": true, + "sourceSha256": "56eecca8f25ba1436d02707baa3a327d7b8efa4d7c68188aa24b4d2561423073" + }, + "v3": { + "records": 1532, + "revision": 88, + "signatureVerified": true, + "sourceSha256": "14002b40ba0f4670f3db243a96fda71f7c330fbb0be8c5ba65e931d4dc484db8" + } + }, + "mcpVersion": "0.2.34", + "osv": { + "expires": 1796643197, + "manifestAndDatabaseVerified": true, + "published": 1796038397, + "sha256": "d847d5e30c66e469b4637f043869ac1eb1e3c81995e2c3795604fed20c75b680", + "tag": "osv-1796038397-d847d5e30c66e469" + } + }, + "knowledgeDataOnlyReadback": { + "aggregateRefresh": { + "historyRecorded": true, + "ok": true, + "schemaVersion": 1, + "sources": { + "knowledgeV1": { + "status": "READY" + }, + "knowledgeV2": { + "status": "READY" + }, + "knowledgeV3": { + "status": "READY" + }, + "osv": { + "edition": "osv-1796038397-d847d5e30c66e469", + "status": "READY" + } + }, + "status": "READY" + }, + "coreRevision": "725cce877300630f1ebf1d4fb4402bbc1687c168", + "expiredSnapshot": { + "reason": "SNAPSHOT_STALE", + "status": "UNKNOWN" + }, + "installedRuntime": { + "artifactId": 15336900967, + "artifactSha256": "ba7dbe48c72f6e3f7d27cbaeac876446b0b868d3fd12f870c131a4c6db6af82a", + "coreHead": "725cce877300630f1ebf1d4fb4402bbc1687c168", + "coreVersion": "0.1.23", + "installedArchiveFilesVerified": 314, + "mcpHead": "0ff43ef1fcf4fdd050c75139c83bb3d633842dc2", + "mcpRunId": 46327460279, + "mcpVersion": "0.2.35", + "runtimeReleaseAccepted": false, + "scope": "KNOWLEDGE_DATA_GATE_ONLY", + "sourceImportsAllowed": false, + "status": "EXACT_QUALIFIED_CI_WHEEL_INSTALLED", + "wheelSha256": "275cabb262e9192043f517f5c45cb2f66a0b168d400583d0a2a887a7e3c1810f" + }, + "knowledge": { + "evidenceLevels": { + "fixture-behavior": 228, + "module-load": 124, + "source-inspection": 70, + "source-pinned-metadata": 1083, + "typecheck": 27 + }, + "reviewedRecordParity": true, + "v1": { + "revision": 88, + "signatureVerified": true + }, + "v2": { + "expiresAt": 1796707271, + "freshness": "FRESH", + "freshnessSha256": "5390edb456b4930a0cadf53b8153f82315aa0556468116e78cfa8d11aa855239", + "freshnessSignatureSha256": "1aafaf3d3f7a31568e7e6cff5695cf141857eceacd3c5ed7809fea3f1985a191", + "indexSha256": "4f2d04bf0de970699c47137c8da7dca6aa0f09f2b8ef447c7f82e97f1aef407c", + "issuedAt": 1796102471, + "records": 1532, + "revision": 88, + "signatureVerified": true, + "sourceSha256": "56eecca8f25ba1436d02707baa3a327d7b8efa4d7c68188aa24b4d2561423073" + }, + "v3": { + "expiresAt": 1796707271, + "freshness": "FRESH", + "freshnessSha256": "8cf48c01e7f14cadf4b770cbb01613b70f02084146c9c17b8f2b37089e3c9618", + "freshnessSignatureSha256": "63763d83e5bb6fffa09a1e1c78459a1e9ed7dca8377f2003ac8dc63a4ae452ef", + "indexSha256": "12c6f62d4339af88276a84f6845b8be498fd3d6f984ffba15145bd141962e93a", + "issuedAt": 1796102471, + "records": 1532, + "revision": 88, + "signatureVerified": true, + "sourceSha256": "14002b40ba0f4670f3db243a96fda71f7c330fbb0be8c5ba65e931d4dc484db8" + } + }, + "mcpVersion": "0.2.35", + "osv": { + "expires": 1796643197, + "manifestAndDatabaseVerified": true, + "published": 1796038397, + "sha256": "d847d5e30c66e469b4637f043869ac1eb1e3c81995e2c3795604fed20c75b680", + "tag": "osv-1796038397-d847d5e30c66e469" + } + } +} diff --git a/docs/audits/2026-12-01/released-core-boundaries.json b/docs/audits/2026-12-01/released-core-boundaries.json new file mode 100644 index 0000000..b53c354 --- /dev/null +++ b/docs/audits/2026-12-01/released-core-boundaries.json @@ -0,0 +1,145 @@ +{ + "coreDirectory": "installed-official-wheel/_core", + "expected": "vulnerable", + "loaded": { + "dependency_live_roadmap_generator": "installed-official-wheel/_core/dependency_live_roadmap_generator.py", + "migration_research": "installed-official-wheel/_core/migration_research.py", + "peer_solver_model": "installed-official-wheel/_core/peer_solver_model.py", + "peer_solver_transition": "installed-official-wheel/_core/peer_solver_transition.py" + }, + "fileSha256": { + "dependency_live_roadmap_generator.py": "7aa5cea3b14ea4148a1f7f1a74dd0ddb97170ab36f223a6c39157eaf58ed59b6", + "migration_research.py": "f95a8c7de05a867374f20582838ce7313504c8717b3d36ebf3bdebfd30b8c4d9", + "peer_solver_model.py": "7653535756327a2c2e30f7971374e11b9a64e237546af79ea6cbb44a24408b7b", + "peer_solver_transition.py": "80a00cec7aa2a2ebbf7907c121682dcae8a56a9f1c1aec6669df5b779b3a78eb" + }, + "C01": [ + { + "scope": "collect", + "environment": { + "DEPLOOM_DRAFT_PRIVATE_SCOPES": "@company" + }, + "package": "@company/private", + "publicCallbackCalls": 1, + "unknown": [], + "outboundPackage": "@company/private" + }, + { + "scope": "collect", + "environment": { + "DEPLOOM_MCP_PRIVATE_SCOPES": "@company" + }, + "package": "@company/private", + "publicCallbackCalls": 1, + "unknown": [], + "outboundPackage": "@company/private" + }, + { + "scope": "collect", + "environment": { + "DEPLOOM_DRAFT_DISABLE_EXTERNAL_EVIDENCE": "1" + }, + "package": "public-name", + "publicCallbackCalls": 1, + "unknown": [], + "outboundPackage": "public-name" + }, + { + "scope": "collect", + "environment": { + "DEPLOOM_MCP_LOCAL_CACHE_ONLY": "1" + }, + "package": "public-name", + "publicCallbackCalls": 1, + "unknown": [], + "outboundPackage": "public-name" + }, + { + "scope": "release-builder", + "status": "unavailable", + "jsonCalls": 1, + "textCalls": 10, + "summary": "Не удалось получить changelog/release notes; breaking changes не проверены; список промежуточных версий недоступен" + } + ], + "C02": [ + { + "scope": "github-origin", + "method": "fetch_text", + "url": "https://evil.invalid/github/changelog", + "syntheticBearerPresent": true + }, + { + "scope": "github-origin", + "method": "fetch_json_url", + "url": "https://api.github.com.evil.invalid/releases", + "syntheticBearerPresent": true + }, + { + "scope": "github-origin", + "method": "fetch_json_url", + "url": "http://api.github.com/repos/example/project/releases", + "syntheticBearerPresent": true + }, + { + "scope": "registry-session", + "basicAuth": true, + "customHeader": true, + "cookie": true, + "queryParameter": true, + "clientCertificate": true + } + ], + "C03": [ + { + "reason": "USER_BASELINE_REQUIRED_UPDATE: router must change", + "modelRejectsTarget": "USER_BASELINE_REQUIRED_UPDATE: router must change", + "safe": true, + "groups": [ + [ + "router" + ] + ], + "unresolved": [] + }, + { + "reason": "USER_EXACT_TARGET: router must be 2.0.0", + "modelRejectsTarget": "USER_EXACT_TARGET: router must be 2.0.0", + "safe": true, + "groups": [ + [ + "router" + ] + ], + "unresolved": [] + } + ], + "network": "All transports intercepted; socket.connect/connect_ex forbidden", + "releaseIdentity": { + "mcpVersion": "0.2.34", + "coreVersion": "0.1.22", + "coreRevision": "8c65fc7311062169d1b1e058c5463a39efaed3d9", + "manifestFileHashesMatch": { + "dependency_live_roadmap_generator.py": true, + "migration_research.py": true, + "peer_solver_model.py": true, + "peer_solver_transition.py": true + }, + "directUrl": { + "archive_info": { + "hash": "sha256=38bf385854cedb97734d5f86d38803d2bba49ce106a1e36d3bded2b89cabc5ad", + "hashes": { + "sha256": "38bf385854cedb97734d5f86d38803d2bba49ce106a1e36d3bded2b89cabc5ad" + } + }, + "url": "https://github.com/levencode-labs/deploom-mcp/releases/download/v0.2.34/deploom_mcp-0.2.34-py3-none-any.whl" + } + }, + "scenarioCount": 11, + "result": "PASS_EXPECTED_VULNERABLE", + "harnessSha256": "cb3737b1f3e1480a0281c769899aafe3ae490bd10caafa6d2fe3d527629391b3", + "retainedReceipt": { + "locationRedaction": "Only local absolute source paths were replaced by role-relative paths. Scenario results, module hashes, release identity and harness hash are unchanged.", + "originalReceiptSha256": "751101b18ac560a4a3796a0f176a96f15be72ef5a10353d8fbddf550fa376d71" + } +} diff --git a/docs/audits/2026-12-01/released-core-boundaries.py b/docs/audits/2026-12-01/released-core-boundaries.py new file mode 100644 index 0000000..26661d6 --- /dev/null +++ b/docs/audits/2026-12-01/released-core-boundaries.py @@ -0,0 +1,192 @@ +#!/usr/bin/env python3 +"""Reproduce C01/C02/C03 without external requests or repository mutations. + +Run once per Core directory in a fresh interpreter. All values are synthetic. +The published fixture intentionally reproduces defects; PASS_EXPECTED_VULNERABLE +means reproduction succeeded, not that the affected runtime is safe. +""" +from __future__ import annotations + +import argparse +import hashlib +import importlib +import json +import os +from pathlib import Path +import socket +import sys +import tempfile +from unittest.mock import Mock, patch + + +def sha256(path): + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def run(core_root, expected): + sys.path.insert(0, str(core_root)) + import requests + + core = importlib.import_module("dependency_live_roadmap_generator") + research = importlib.import_module("migration_research") + model_module = importlib.import_module("peer_solver_model") + transition_module = importlib.import_module("peer_solver_transition") + modules = (core, research, model_module, transition_module) + loaded = {module.__name__: str(Path(module.__file__).resolve()) for module in modules} + assert all(Path(path).parent == core_root for path in loaded.values()), loaded + files = {Path(path).name: sha256(Path(path)) for path in loaded.values()} + out = {"coreDirectory": str(core_root), "expected": expected, "loaded": loaded, + "fileSha256": files, "C01": [], "C02": [], "C03": [], + "network": "All transports intercepted; socket.connect/connect_ex forbidden"} + manifest_path = core_root.parent / "resources/release-manifest.json" + if manifest_path.is_file(): + manifest = json.loads(manifest_path.read_bytes()) + matched = {name: digest == manifest["core"]["files"][name] for name, digest in files.items()} + assert all(matched.values()), matched + out["releaseIdentity"] = { + "mcpVersion": manifest["mcpVersion"], "coreVersion": manifest["core"]["version"], + "coreRevision": manifest["core"]["revision"], "manifestFileHashesMatch": matched, + } + direct_path = core_root.parent.parent / f"deploom_mcp-{manifest['mcpVersion']}.dist-info/direct_url.json" + out["releaseIdentity"]["directUrl"] = json.loads(direct_path.read_bytes()) + + vulnerable = expected == "vulnerable" + cases = ( + ({"DEPLOOM_DRAFT_PRIVATE_SCOPES": "@company"}, "@company/private", "PRIVATE_SCOPE_EXCLUDED"), + ({"DEPLOOM_MCP_PRIVATE_SCOPES": "@company"}, "@company/private", "PRIVATE_SCOPE_EXCLUDED"), + ({"DEPLOOM_DRAFT_DISABLE_EXTERNAL_EVIDENCE": "1"}, "public-name", "EXTERNAL_EVIDENCE_DISABLED_BY_HOST_POLICY"), + ({"DEPLOOM_MCP_LOCAL_CACHE_ONLY": "1"}, "public-name", "EXTERNAL_EVIDENCE_DISABLED_BY_HOST_POLICY"), + ) + for environment, package, reason in cases: + with tempfile.TemporaryDirectory(prefix="deploom-boundary-") as temp, patch.dict(os.environ, environment, clear=True): + fetch = Mock(return_value=({"results": [{}]}, 1, "", "intercepted")) + result = research.collect(package, "1.0.0", "2.0.0", include_osv=True, + fetch=fetch, root=Path(temp)) + assert fetch.call_count == int(vulnerable), (environment, result, fetch.call_count) + if vulnerable: + assert fetch.call_args.args == ("https://api.osv.dev/v1/querybatch",) + assert fetch.call_args.kwargs["payload"]["queries"][0]["package"]["name"] == package + else: + assert reason in result["unknown"], result + out["C01"].append({"scope": "collect", "environment": environment, + "package": package, "publicCallbackCalls": fetch.call_count, + "unknown": result["unknown"], + "outboundPackage": package if fetch.called else None}) + + client = core.LiveDataClient("https://mirror.example.invalid/npm", 1, 8, 0) + try: + with patch.dict(os.environ, {"DEPLOOM_DRAFT_DISABLE_EXTERNAL_EVIDENCE": "1"}, clear=True), patch.object( + client, "fetch_json_url", return_value=[], + ) as json_fetch, patch.object(client, "fetch_text", return_value=None) as text_fetch: + result = core.build_release_intelligence( + client, "public-name", {"repository": "https://github.com/example/project"}, "1.0.0", "2.0.0", + ) + assert (json_fetch.call_count, text_fetch.call_count) == ((1, 10) if vulnerable else (0, 0)) + if not vulnerable: + assert "EXTERNAL_EVIDENCE_DISABLED_BY_HOST_POLICY" in result.summary + out["C01"].append({"scope": "release-builder", "status": result.status, + "jsonCalls": json_fetch.call_count, "textCalls": text_fetch.call_count, + "summary": result.summary}) + finally: + client.session.close() + + captured = [] + + def send(session, request, **kwargs): + captured.append((request, kwargs)) + response = requests.Response() + response.status_code = 200 + response.url = request.url + response.request = request + response._content = b'{"ok":true}' + response._content_consumed = True + return response + + for method, url in ( + ("fetch_text", "https://evil.invalid/github/changelog"), + ("fetch_json_url", "https://api.github.com.evil.invalid/releases"), + ("fetch_json_url", "http://api.github.com/repos/example/project/releases"), + ): + with patch.dict(os.environ, {"GITHUB_TOKEN": "synthetic-token"}, clear=True), patch.object( + requests.Session, "send", autospec=True, side_effect=send, + ): + client = core.LiveDataClient("https://mirror.example.invalid/npm", 1, 8, 0) + try: + before = len(captured) + result = getattr(client, method)(url) + assert result is not None and len(captured) == before + 1 + request, _ = captured[-1] + present = request.headers.get("Authorization") == "Bearer synthetic-token" + assert present == vulnerable, request.headers + out["C02"].append({"scope": "github-origin", "method": method, "url": url, + "syntheticBearerPresent": present}) + finally: + client.session.close() + + with patch.object(requests.Session, "send", autospec=True, side_effect=send): + client = core.LiveDataClient("https://mirror.example.invalid/npm", 1, 8, 0) + try: + client.session.auth = ("synthetic-user", "synthetic-password") + client.session.headers["X-Registry-Api-Key"] = "synthetic-key" + client.session.cookies.set("registry-cookie", "synthetic-cookie") + client.session.params["tenant"] = "synthetic-tenant" + client.session.cert = ("registry-only.crt", "registry-only.key") + before = len(captured) + result = client.fetch_json_url("https://api.github.com/repos/example/project/releases") + assert result is not None and len(captured) == before + 1 + request, kwargs = captured[-1] + credentials = {"basicAuth": str(request.headers.get("Authorization", "")).startswith("Basic "), + "customHeader": "X-Registry-Api-Key" in request.headers, + "cookie": "Cookie" in request.headers, "queryParameter": "tenant=" in request.url, + "clientCertificate": kwargs.get("cert") is not None} + assert all(value == vulnerable for value in credentials.values()), credentials + out["C02"].append({"scope": "registry-session", **credentials}) + finally: + client.session.close() + + for reason, provenance in ( + ("USER_BASELINE_REQUIRED_UPDATE: router must change", "user-baseline-intent"), + ("USER_EXACT_TARGET: router must be 2.0.0", "user-exact-target"), + ): + package = model_module.PackageVariable( + name="router", current_version="1.0.0", domain=("2.0.0", "1.0.0"), + scores=(("2.0.0", (1,)), ("1.0.0", (0,))), + ) + model = model_module.PeerOptimizationModel( + packages=(package,), constraints=(model_module.forbidden( + [("router", "1.0.0")], reason=reason, provenance=provenance, + ),), objective_width=1, + ) + current = {"router": "1.0.0"} + assert model.assignment_issue(current) == reason + result = transition_module.refine_transition_safe_groups(model, current, current) + assert result.safe == vulnerable + assert result.groups == (("router",),) if vulnerable else result.groups == () + assert result.unresolved == (() if vulnerable else ("INVALID_TARGET_ENDPOINT: " + reason,)) + out["C03"].append({"reason": reason, "modelRejectsTarget": model.assignment_issue(current), + "safe": result.safe, "groups": result.groups, "unresolved": result.unresolved}) + out["scenarioCount"] = sum(len(out[key]) for key in ("C01", "C02", "C03")) + out["result"] = "PASS_EXPECTED_VULNERABLE" if vulnerable else "PASS_EXPECTED_FIXED" + return out + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--core", type=Path, required=True) + parser.add_argument("--expect", choices=("vulnerable", "fixed"), required=True) + parser.add_argument("--output", type=Path) + args = parser.parse_args() + root = args.core.resolve(strict=True) + with patch.dict(os.environ, {}, clear=True), patch.object( + socket.socket, "connect", side_effect=AssertionError("external sockets forbidden"), + ), patch.object(socket.socket, "connect_ex", side_effect=AssertionError("external sockets forbidden")): + result = run(root, args.expect) + result["harnessSha256"] = sha256(Path(__file__)) + encoded = json.dumps(result, ensure_ascii=False, indent=2) + "\n" + if args.output: + args.output.write_text(encoded, encoding="utf-8") + print(encoded, end="") + + +if __name__ == "__main__": + main() diff --git a/scripts/check-public-sanitization.py b/scripts/check-public-sanitization.py index bd0967c..7e36ec3 100644 --- a/scripts/check-public-sanitization.py +++ b/scripts/check-public-sanitization.py @@ -48,6 +48,12 @@ ('url-credentials', re.compile(r'https?://[^\s/:]+:[^\s/@]+@')), ('npm-auth-token', re.compile(r'(?i)(?:_authToken|npmAuthToken)\s*[=:]\s*[^$\s{][^\s]{7,}')), ] +# This intercepted proxy fixture contains no real credentials. Only the exact +# quoted URL in its reviewed test is exempt from the URL-credentials rule; +# other values, destinations, paths and secret rules remain blocking. +REVIEWED_SYNTHETIC_URL_LITERALS = { + 'tests/test_plan_registry_facts.py': ('"http://' 'fixture:fixture@proxy.invalid:8080"',), +} FORBIDDEN_NAMES = {'.npmrc', '.netrc', '.yarnrc', 'id_rsa', 'id_ed25519'} FORBIDDEN_SUFFIX = {'.pem', '.key', '.p12', '.pfx', '.jks', '.keystore'} TOKEN_RE = re.compile(r'@[A-Za-z0-9._-]+/|[A-Za-z0-9_@.-]+(?:/[A-Za-z0-9_@.-]+)*') @@ -128,7 +134,11 @@ def main() -> int: except UnicodeDecodeError: continue for label, pattern in SECRETS: - match = pattern.search(text) + scan_text = text + if label == 'url-credentials': + for literal in REVIEWED_SYNTHETIC_URL_LITERALS.get(rel, ()): + scan_text = scan_text.replace(literal, '') + match = pattern.search(scan_text) if match: errors.append(f'{label}: {rel}: {match.group(0)[:120]!r}') private_ip = PRIVATE_IP_RE.search(text) diff --git a/tests/test_public_sanitization.py b/tests/test_public_sanitization.py new file mode 100644 index 0000000..b767fad --- /dev/null +++ b/tests/test_public_sanitization.py @@ -0,0 +1,79 @@ +"""Exercise the complete sanitizer against synthetic tracked release inputs.""" +from __future__ import annotations + +from contextlib import redirect_stdout +import importlib.util +import io +from pathlib import Path +import tempfile +import unittest +from unittest.mock import patch + + +ROOT = Path(__file__).resolve().parents[1] +SPEC = importlib.util.spec_from_file_location("public_sanitization", ROOT / "scripts/check-public-sanitization.py") +sanitizer = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(sanitizer) +REVIEWED_PATH = "tests/test_plan_registry_facts.py" +FIXTURE_URL = "http://" + "fixture:fixture@proxy.invalid:8080" +FIXTURE_LITERAL = '"' + FIXTURE_URL + '"' + + +class PublicSanitizationTests(unittest.TestCase): + def scan(self, relative, text): + with tempfile.TemporaryDirectory() as raw: + root = Path(raw) + path = root / relative + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(text, encoding="utf-8") + output = io.StringIO() + with patch.object(sanitizer, "ROOT", root), patch.object( + sanitizer, "files", side_effect=lambda: iter((path,)), + ), redirect_stdout(output): + status = sanitizer.main() + return status, output.getvalue() + + def test_exact_reviewed_fixture_source_passes(self): + source = (ROOT / REVIEWED_PATH).read_text(encoding="utf-8") + self.assertIn(FIXTURE_LITERAL, source) + status, output = self.scan(REVIEWED_PATH, source) + self.assertEqual(0, status, output) + + def test_same_fixture_is_rejected_outside_its_reviewed_path(self): + for path in ("tests/unreviewed.py", "dependency_live_roadmap_generator.py"): + with self.subTest(path=path): + status, output = self.scan(path, "proxy = " + FIXTURE_LITERAL) + self.assertEqual(1, status, output) + self.assertIn("url-credentials: " + path, output) + + def test_changed_credentials_or_url_are_not_covered_by_fixture_exception(self): + for value in ( + FIXTURE_URL.replace("fixture:fixture", "other-user:fixture"), + FIXTURE_URL.replace("fixture:fixture", "fixture:other-password"), + FIXTURE_URL.replace("proxy.invalid", "another.invalid"), + FIXTURE_URL.replace("8080", "8081"), + FIXTURE_URL.replace("http:", "https:"), + FIXTURE_URL + "/another-path", + FIXTURE_URL + ".another.invalid", + ): + with self.subTest(url=value): + status, output = self.scan(REVIEWED_PATH, 'proxy = "' + value + '"') + self.assertEqual(1, status, output) + self.assertIn("url-credentials: " + REVIEWED_PATH, output) + + def test_reviewed_first_match_does_not_hide_later_credentials(self): + different = "https://" + "synthetic-user:synthetic-password@another.invalid" + status, output = self.scan(REVIEWED_PATH, "proxy = " + FIXTURE_LITERAL + '\nother = "' + different + '"') + self.assertEqual(1, status, output) + self.assertIn("url-credentials: " + REVIEWED_PATH, output) + self.assertIn("synthetic-user:synthetic-password", output) + + def test_other_secret_rules_still_apply_to_reviewed_file(self): + synthetic_token = "ghp_" + "a" * 36 + status, output = self.scan(REVIEWED_PATH, "proxy = " + FIXTURE_LITERAL + '\ntoken = "' + synthetic_token + '"') + self.assertEqual(1, status, output) + self.assertIn("github-token: " + REVIEWED_PATH, output) + + +if __name__ == "__main__": + unittest.main()