diff --git a/bin/test/container-dockerfile.test.mjs b/bin/test/container-dockerfile.test.mjs index 47d9792d..ccca8d03 100644 --- a/bin/test/container-dockerfile.test.mjs +++ b/bin/test/container-dockerfile.test.mjs @@ -224,3 +224,37 @@ test('each rule fires on a sources file or lock that breaks it', () => { only({ lock: `--extra-index-url https://example.test/simple\n${ctx.lock}` }, 'lock-line:--extra-index-url'); only({ wanted: `${ctx.wanted}\nnot-in-the-lock\n` }, 'lock-missing:not-in-the-lock'); }); + +const versionKey = (v) => { + const m = /^(\d+(?:\.\d+)*)(?:(a|b|rc)(\d+))?$/.exec(v); + assert.ok(m, `unreadable version ${v}`); + return { release: m[1].split('.').map(Number), pre: m[2] ? [['a', 'b', 'rc'].indexOf(m[2]), Number(m[3])] : [3, 0] }; +}; +const atLeast = (version, floor) => { + const a = versionKey(version), b = versionKey(floor); + for (let i = 0; i < Math.max(a.release.length, b.release.length); i++) { + const d = (a.release[i] || 0) - (b.release[i] || 0); + if (d) return d > 0; + } + return a.pre[0] !== b.pre[0] ? a.pre[0] > b.pre[0] : a.pre[1] >= b.pre[1]; +}; +const overrideFloors = (text) => String(text).split('\n').map((l) => l.replace(/#.*$/, '').trim()).filter(Boolean).map((l) => { + const m = /^([A-Za-z0-9][A-Za-z0-9._-]*)>=([0-9a-z.]+)(?:,<\d+)?$/.exec(l); + assert.ok(m, `container/overrides.txt: unreadable line ${l}`); + return { name: m[1].toLowerCase().replace(/[._]/g, '-'), floor: m[2] }; +}); + +test('the lock installs every overridden package at or above its override floor', () => { + const floors = overrideFloors(read('container', 'overrides.txt')); + assert.ok(floors.length >= 1, 'container/overrides.txt names no package'); + const locked = new Map(lockEntries(read('container', 'requirements.txt')).entries.map((e) => [e.name, e.version])); + for (const { name, floor } of floors) { + assert.ok(locked.has(name), `${name} is overridden and the lock does not install it`); + assert.ok(atLeast(locked.get(name), floor), `${name}: the lock installs ${locked.get(name)}, below the floor ${floor}`); + } +}); + +test('the floor comparison orders releases and pre-releases', () => { + assert.ok(atLeast('1.30.0', '1.30.0') && atLeast('11.2', '11.2') && atLeast('0.66b2', '0.66b0') && atLeast('1.45.2', '1.45.2b1')); + assert.ok(!atLeast('1.29.0', '1.30.0') && !atLeast('8.5.2', '11.2') && !atLeast('0.58b0', '0.66b0') && !atLeast('0.66b0', '0.66')); +}); diff --git a/container/README.md b/container/README.md index 10ede5ea..5e859760 100644 --- a/container/README.md +++ b/container/README.md @@ -1,4 +1,4 @@ - + # Installing commitwork on Linux: the installer and the container Two ways to put commitwork on a Linux machine, and what each one does and does not give you. @@ -157,13 +157,25 @@ header, under the pinned base image: docker run --rm -v "$PWD:/src" -w /src node:22.23.3-bookworm-slim@sha256:c3de60bf2f9dd0ac6370e6117950ff62d6e339527e7472301c9c78a017978392 sh -c ' cp container/debian.sources /etc/apt/sources.list.d/debian.sources && apt-get update && apt-get install -y --no-install-recommends ca-certificates python3-venv && - python3 -m venv /tmp/v && /tmp/v/bin/pip install pip-tools && - /tmp/v/bin/pip-compile --generate-hashes --allow-unsafe --strip-extras --annotation-style=line \ + python3 -m venv /tmp/v && /tmp/v/bin/pip install uv && + /tmp/v/bin/uv pip compile --generate-hashes --annotation-style=line --override container/overrides.txt \ -o container/requirements.txt container/requirements.in' ``` -pip-tools is the one unpinned tool in that command; it writes the lock, and the lock is what gets -reviewed. pip-compile keeps the versions already in the lock unless given `--upgrade`. +uv is the one unpinned tool in that command; it writes the lock, and the lock is what gets +reviewed. It keeps the versions already in the lock unless given `--upgrade`. + +`container/overrides.txt` raises three packages past what semgrep declares. semgrep 1.180.0 and +1.186.0 both require `mcp==1.29.0`, `opentelemetry-api~=1.37.0` and `wcmatch~=8.3`, and each has +advisories fixed only in a later release (mcp 1.30.0, opentelemetry-api 1.45.2, wcmatch 11.2), so no +resolver reaches a fixed version while honouring those pins. The install uses `--no-deps`, so pip +does not re-check them. Measured 2026-11-24 in the pinned base image, on semgrep 1.180.0 with the +old lock and the new one: `semgrep --version` runs, `semgrep mcp --help` prints the same text, and +a scan of one fixture gave the same findings and the same scanned paths with no errors in three +modes (no path flags, `--exclude`, `--include`), the fixture carrying a `.semgrepignore` with +`**` patterns. `pip check` reports the overridden requirements and nothing else. +`bin/test/container-dockerfile.test.mjs` fails when the lock holds a version below an override's +floor. Drop an override once semgrep's own requirement reaches the fixed release. ### Licences and source diff --git a/container/licenses.json b/container/licenses.json index 133da502..784ce637 100644 --- a/container/licenses.json +++ b/container/licenses.json @@ -66,7 +66,7 @@ "$comment": "The scanners venv. A package whose dist-info carries no licence file gets one here, pinned to the version the lock installs. A copyleft package's source is its PyPI sdist unless `sources` names others.", "files": { "semgrep": { "version": "1.180.0", "files": [{ "tree": "container/licenses/semgrep/LICENSE", "sha256": "20c17d8b8c48a600800dfd14f95d5cb9ff47066a9641ddeab48dc54aec96e331", "upstream": "https://raw.githubusercontent.com/semgrep/semgrep/v1.180.0/LICENSE" }] }, - "opentelemetry-util-http": { "version": "0.58b0", "files": [{ "tree": "container/licenses/opentelemetry-util-http/LICENSE", "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", "upstream": "https://raw.githubusercontent.com/open-telemetry/opentelemetry-python-contrib/v0.58b0/LICENSE" }] } + "opentelemetry-util-http": { "version": "0.66b2", "files": [{ "tree": "container/licenses/opentelemetry-util-http/LICENSE", "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", "upstream": "https://raw.githubusercontent.com/open-telemetry/opentelemetry-python-contrib/v0.66b2/LICENSE" }] } }, "licences": { "$comment": "Packages whose metadata names no licence, as their licence file reads.", diff --git a/container/overrides.txt b/container/overrides.txt new file mode 100644 index 00000000..f08e8906 --- /dev/null +++ b/container/overrides.txt @@ -0,0 +1,10 @@ +# semgrep pins these below their fixed releases (mcp==1.29.0, opentelemetry ~=1.37.0, wcmatch ~=8.3), +# so the resolver cannot reach a patched version without an override. container/README.md has the +# measurement that semgrep behaves the same under them. +mcp>=1.30.0,<2 +wcmatch>=11.2,<12 +opentelemetry-api>=1.45.2,<2 +opentelemetry-sdk>=1.45.2,<2 +opentelemetry-exporter-otlp-proto-http>=1.45.2,<2 +opentelemetry-instrumentation-requests>=0.66b0 +opentelemetry-instrumentation-threading>=0.66b0 diff --git a/container/requirements.txt b/container/requirements.txt index 64ce21f1..fb982b86 100644 --- a/container/requirements.txt +++ b/container/requirements.txt @@ -1,9 +1,5 @@ -# -# This file is autogenerated by pip-compile with Python 3.11 -# by the following command: -# -# pip-compile --allow-unsafe --annotation-style=line --generate-hashes --output-file=container/requirements.txt --strip-extras container/requirements.in -# +# This file was autogenerated by uv via the following command: +# uv pip compile --generate-hashes --annotation-style=line --override container/overrides.txt -o container/requirements.txt container/requirements.in annotated-types==0.8.0 \ --hash=sha256:13b2beaad985e05e2d6407ee4c4f35590b11f8d693a258a561055cac8f64cab7 \ --hash=sha256:f072f4d804ea359e4eaf198b1af7a8b0943881a87f31bb764f8bf219bb9419e0 @@ -24,9 +20,9 @@ boltons==21.0.0 \ --hash=sha256:65e70a79a731a7fe6e98592ecfb5ccf2115873d01dbc576079874629e5c90f13 \ --hash=sha256:b9bb7b58b2b420bbe11a6025fdef6d3e5edc9f76a42fb467afe7ca212ef9948b # via face, glom, semgrep -bracex==3.0.1 \ - --hash=sha256:4e38e32392e4a4780fe15d644bfc7c8514057cfc3861e060b11814ce829c25e4 \ - --hash=sha256:6523ad83aeb5098a4ee597cff0f964442ff74e460bd3fafaffab6a013ff2288c +bracex==3.2.4 \ + --hash=sha256:82e9e738b63fca213c33211d30b0b1ca330896a1091736e78da2c1bcda93ab30 \ + --hash=sha256:c1e67eb59f81445dee15b2c588b7c81352b697cfbd6c4931a2943ea6b71eb5ea # via wcmatch certifi==2026.10.19 \ --hash=sha256:035c1e85572b141bf1c3a3eff0e33a8eb74917522f2559075ff8d2fea780a1ae \ @@ -420,10 +416,6 @@ idna==3.20 \ --hash=sha256:a7db850025b95ded1eae8a46181a1a6c56c92c96f0e2b005d9ff8dc0210cab44 \ --hash=sha256:ab7ae7122974553370f0bdb919e1a960b2cd1bc1ef0276416d896db81c14582c # via anyio, httpx, requests -importlib-metadata==8.7.1 \ - --hash=sha256:49fef1ae6440c182052f407c8d34a68f72efc36db9ca90dc0113398f2fdde8bb \ - --hash=sha256:5a1f80bf1daa489495071efbb095d75a634cf28a8bc299581244063b53176151 - # via opentelemetry-api jsonschema==4.25.1 \ --hash=sha256:3fba0169e345c7175110351d456342c364814cfcf3b964ba4587f22915230a63 \ --hash=sha256:e4a9655ce0da0c0b67a085847e00a3a51449e1157f4f75e9fb5aa545e122eb85 @@ -436,53 +428,61 @@ markdown-it-py==4.2.0 \ --hash=sha256:04a21681d6fbb623de53f6f364d352309d4094dd4194040a10fd51833e418d49 \ --hash=sha256:9f7ebbcd14fe59494226453aed97c1070d83f8d24b6fc3a3bcf9a38092641c4a # via rich -mcp==1.29.0 \ - --hash=sha256:52d01f334de1868cc3bb2d6604931126a67631f99a6c5d3b82ba47290315ec36 \ - --hash=sha256:f5a075bb611f23d6f4d080c6a1699fa62772eebc562ba9e66b306ddde1c755f7 - # via semgrep +mcp==1.30.0 \ + --hash=sha256:445414625fce5c295faa505bb11bacece661ab6f4028d57c935db57820b7a3e4 \ + --hash=sha256:666edb5009503e1047c9d60346a756f94b261f05cc2625f23d41c728ffc484d0 + # via semgrep, --override container/overrides.txt mdurl==0.1.2 \ --hash=sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8 \ --hash=sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba # via markdown-it-py -opentelemetry-api==1.37.0 \ - --hash=sha256:540735b120355bd5112738ea53621f8d5edb35ebcd6fe21ada3ab1c61d1cd9a7 \ - --hash=sha256:accf2024d3e89faec14302213bc39550ec0f4095d1cf5ca688e1bfb1c8612f47 - # via opentelemetry-exporter-otlp-proto-http, opentelemetry-instrumentation, opentelemetry-instrumentation-requests, opentelemetry-instrumentation-threading, opentelemetry-sdk, opentelemetry-semantic-conventions, semgrep -opentelemetry-exporter-otlp-proto-common==1.37.0 \ - --hash=sha256:53038428449c559b0c564b8d718df3314da387109c4d36bd1b94c9a641b0292e \ - --hash=sha256:c87a1bdd9f41fdc408d9cc9367bb53f8d2602829659f2b90be9f9d79d0bfe62c +opentelemetry-api==1.45.2 \ + --hash=sha256:2cbd737377e710ee740d261c94e93fa0f08e6d037c18f17513cc0a2d94479a34 \ + --hash=sha256:d7b0008e21e5fd61cbe7a7f34ca3b6905a78ab677d9bc395e299359c75cda6b4 + # via opentelemetry-exporter-http-transport, opentelemetry-exporter-otlp-proto-http, opentelemetry-instrumentation, opentelemetry-instrumentation-requests, opentelemetry-instrumentation-threading, opentelemetry-sdk, opentelemetry-semantic-conventions, semgrep, --override container/overrides.txt +opentelemetry-exporter-http-transport==0.66b2 \ + --hash=sha256:66d6ed810a515432c8891da9a834464332fd70badeca45bdeeae81b4280c903b \ + --hash=sha256:fd5f5b490c099acda1cd7b909d5e8981436bf18cc8c6098d302d114c271720e9 # via opentelemetry-exporter-otlp-proto-http -opentelemetry-exporter-otlp-proto-http==1.37.0 \ - --hash=sha256:54c42b39945a6cc9d9a2a33decb876eabb9547e0dcb49df090122773447f1aef \ - --hash=sha256:e52e8600f1720d6de298419a802108a8f5afa63c96809ff83becb03f874e44ac - # via semgrep -opentelemetry-instrumentation==0.58b0 \ - --hash=sha256:50f97ac03100676c9f7fc28197f8240c7290ca1baa12da8bfbb9a1de4f34cc45 \ - --hash=sha256:df640f3ac715a3e05af145c18f527f4422c6ab6c467e40bd24d2ad75a00cb705 +opentelemetry-exporter-otlp-common==0.66b2 \ + --hash=sha256:06f5a9b88638e310efa1f1d206cdf6b75393e112aba4e174a963416192bd1028 \ + --hash=sha256:ace86efb75489f925f1ef809856ae5f0c7db534e4afdc624530222228b1236a5 + # via opentelemetry-exporter-otlp-proto-http +opentelemetry-exporter-otlp-proto-common==1.45.2 \ + --hash=sha256:af483b24217028892f017096731b794b196b785025d2e6808874720fd0b05a80 \ + --hash=sha256:f1f2806f3f28ce7938033823e50934fcd91595a39de38e69a28a51e19f40fc6d + # via opentelemetry-exporter-otlp-proto-http +opentelemetry-exporter-otlp-proto-http==1.45.2 \ + --hash=sha256:5984a3fb46bc4628e4e2b85d4a6e72637e03962aae6cf372791137768a4ad939 \ + --hash=sha256:6e4d025138829d0ee57946930c2ccad6491ad4d92a958e9c7eea69278fe60cfc + # via semgrep, --override container/overrides.txt +opentelemetry-instrumentation==0.66b2 \ + --hash=sha256:02b094150e53b76f5906d75e628dbb3833bbc6e62fa109b5c7ba0c081865e923 \ + --hash=sha256:fa9ccfdab147a14af8107d19ef0a7b5015675273c5adced7a1fc38f28b42ec4c # via opentelemetry-instrumentation-requests, opentelemetry-instrumentation-threading -opentelemetry-instrumentation-requests==0.58b0 \ - --hash=sha256:672a0be0bb5b52bea0c11820b35e27edcf4cd22d34abe4afc59a92a80519f8a8 \ - --hash=sha256:ae9495e6ff64e27bdb839fce91dbb4be56e325139828e8005f875baf41951a2e - # via semgrep -opentelemetry-instrumentation-threading==0.58b0 \ - --hash=sha256:eacc072881006aceb5b9b6831bcdce718c67ef6f31ac0b32bd6a23a94d979b4a \ - --hash=sha256:f68c61f77841f9ff6270176f4d496c10addbceacd782af434d705f83e4504862 - # via semgrep -opentelemetry-proto==1.37.0 \ - --hash=sha256:30f5c494faf66f77faeaefa35ed4443c5edb3b0aa46dad073ed7210e1a789538 \ - --hash=sha256:8ed8c066ae8828bbf0c39229979bdf583a126981142378a9cbe9d6fd5701c6e2 +opentelemetry-instrumentation-requests==0.66b2 \ + --hash=sha256:b0ba903a0bd7ebb234c8b32d3d957efc4061ba8571916558dc3f3dcdabb5e5e1 \ + --hash=sha256:bcfbdc3ff3ec8524044908788f0e7f3c25e219053b496fd9926d75f8d7c7bc96 + # via semgrep, --override container/overrides.txt +opentelemetry-instrumentation-threading==0.66b2 \ + --hash=sha256:512e0d4b568eff36ca15a977b507ddc1e64a38f93dbcafa4e701b3555b066991 \ + --hash=sha256:647480ef889595d577fea66d0cfcec395cf5d89888bbe05ca9919355797c85a3 + # via semgrep, --override container/overrides.txt +opentelemetry-proto==1.45.2 \ + --hash=sha256:03a7ca1b43f89fd5b965d5975902bb2515c0c86e2428b456836e9a6149c6235a \ + --hash=sha256:bd8d23cf770605b0af9b7be2071d26a464fea289d35429abfd2a66226114ad64 # via opentelemetry-exporter-otlp-proto-common, opentelemetry-exporter-otlp-proto-http -opentelemetry-sdk==1.37.0 \ - --hash=sha256:8f3c3c22063e52475c5dbced7209495c2c16723d016d39287dfc215d1771257c \ - --hash=sha256:cc8e089c10953ded765b5ab5669b198bbe0af1b3f89f1007d19acd32dc46dda5 - # via opentelemetry-exporter-otlp-proto-http, semgrep -opentelemetry-semantic-conventions==0.58b0 \ - --hash=sha256:5564905ab1458b96684db1340232729fce3b5375a06e140e8904c78e4f815b28 \ - --hash=sha256:6bd46f51264279c433755767bb44ad00f1c9e2367e1b42af563372c5a6fa0c25 +opentelemetry-sdk==1.45.2 \ + --hash=sha256:7eec4de13dd21ff3a1670dcb0e02079e692736f94d733dfdce5af461d884248d \ + --hash=sha256:ff974ea70ee4f1d51e2ec152db37c2b626c7bf82bb3f7d86114fd8704e7199c6 + # via opentelemetry-exporter-otlp-common, opentelemetry-exporter-otlp-proto-http, semgrep, --override container/overrides.txt +opentelemetry-semantic-conventions==0.66b2 \ + --hash=sha256:4cbe61e5f9275d57ab31708446e7938ef4291ebbe6a7fca6f7a629c5acae87d8 \ + --hash=sha256:7da5f1a5dc4383eb66711d4d3d3e71824d9403ac1559fea021cc103c1a4c4976 # via opentelemetry-instrumentation, opentelemetry-instrumentation-requests, opentelemetry-sdk -opentelemetry-util-http==0.58b0 \ - --hash=sha256:6c6b86762ed43025fbd593dc5f700ba0aa3e09711aedc36fd48a13b23d8cb1e7 \ - --hash=sha256:de0154896c3472c6599311c83e0ecee856c4da1b17808d39fdc5cce5312e4d89 +opentelemetry-util-http==0.66b2 \ + --hash=sha256:7ba066ea609202e474679ddf1d0f753a1e6619bd206b36afaecba4bbb86e25d0 \ + --hash=sha256:c4bb5d6744e60353bcaa3e325bc529a1515346b51cb4d9c8e5b730579337e06d # via opentelemetry-instrumentation-requests packaging==26.3 \ --hash=sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79 \ @@ -753,7 +753,7 @@ referencing==0.37.0 \ requests==2.34.2 \ --hash=sha256:2a0d60c172f83ac6ab31e4554906c0f3b3588d37b5cb939b1c061f4907e278e0 \ --hash=sha256:f288924cae4e29463698d6d60bc6a4da69c89185ad1e0bcc4104f584e960b9ed - # via opentelemetry-exporter-otlp-proto-http, semgrep + # via opentelemetry-exporter-http-transport, opentelemetry-exporter-otlp-proto-http, semgrep rich==15.0.0 \ --hash=sha256:33bd4ef74232fb73fe9279a257718407f169c09b78a87ad3d296f548e27de0bb \ --hash=sha256:edd07a4824c6b40189fb7ac9bc4c52536e9780fbbfbddf6f1e2502c31b068c36 @@ -1066,10 +1066,10 @@ uvicorn==0.54.0 \ --hash=sha256:505bdb0f318731d45f1f712071fc781a8981f6847a31c902c9f5e652d4f67faf \ --hash=sha256:a2e33cbfaa0306f8e6b0c13e0cb89d7d7a2da3e62b90c66e18c33d9807b28620 # via mcp -wcmatch==8.5.2 \ - --hash=sha256:17d3ad3758f9d0b5b4dedc770b65420d4dac62e680229c287bf24c9db856a478 \ - --hash=sha256:a70222b86dea82fb382dd87b73278c10756c138bd6f8f714e2183128887b9eb2 - # via semgrep +wcmatch==11.2 \ + --hash=sha256:1605bde546fbde4c063628c7d89eda486909fd4337e51d73a873987fbcb2554c \ + --hash=sha256:952bab83c75c233836007a69550a3a8753cf06964c1eb3b84ff11ad5bff1c272 + # via semgrep, --override container/overrides.txt wrapt==1.17.3 \ --hash=sha256:02b551d101f31694fc785e58e0720ef7d9a10c4e62c1c9358ce6f63f23e30a56 \ --hash=sha256:042ec3bb8f319c147b1301f2393bc19dba6e176b7da446853406d041c36c7828 \ @@ -1153,10 +1153,6 @@ wrapt==1.17.3 \ --hash=sha256:fbd3c8319de8e1dc79d346929cd71d523622da527cca14e0c1d257e31c2b8b10 \ --hash=sha256:fd341868a4b6714a5962c1af0bd44f7c404ef78720c7de4892901e540417111c # via opentelemetry-instrumentation, opentelemetry-instrumentation-threading -zipp==4.1.1 \ - --hash=sha256:7ebb7a44c021b29fd8dbd7cce6812d0d7b5b454521f93cc71af6ccd155aaa70b \ - --hash=sha256:8979f52d874162f485ff2981e3891f3a3317b7a3dd43ff1e1775b9304f307a9c - # via importlib-metadata zizmor==1.30.1 \ --hash=sha256:06e039fae8e185e2a1a8b002f2d95a6f5c3b548048bdd79e004dcb501fcd0868 \ --hash=sha256:15679642e8c4f825ba3f22537c698b1bbbad19ead23640f62ec45ebbe7abc803 \ diff --git a/package.json b/package.json index 25380fc2..9677cb4a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "commitwork", - "version": "0.6.314", + "version": "0.6.315", "description": "Repository security scanner, local CI runner and scheduled monitor, with remediation and compliance-evidence tooling. Manifest-driven; runs against any git repository.", "homepage": "https://www.commitwork.online", "repository": {