Install the pinned reachability engine in the Docker image - #345
Conversation
The image installed @coana-tech/cli unpinned while the launcher asks npx for DEFAULT_COANA_CLI_VERSION. npx reuses the global install only when the versions match, so once the two diverged every scan re-downloaded the engine (~119 MB) and the launcher took roughly three times as long, silently. The Dockerfile now reads the pinned version out of reachability.py, so the image and the runtime cannot drift and the pin stays bumped in exactly one place. Splitting the coana install out of the toolchain RUN keeps a pin bump to a 353 MB layer rather than rebuilding the 2.3 GB combined layer. Marking a release stable now builds that version from its own tag, so an older wheel is no longer paired with the default branch's build recipe and pin. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 21a802d. Configure here.
| # socketsecurity==inputs.version from PyPI, and the Dockerfile reads the pinned | ||
| # @coana-tech/cli version out of the checked-out source, so building from the | ||
| # default branch would pair an old wheel with a newer build recipe and pin. | ||
| ref: v${{ inputs.version }} |
There was a problem hiding this comment.
Stable build ignores tag checkout
Medium Severity
The new tag checkout does not feed the image build. docker/build-push-action still uses the workflow Git context from the dispatch branch, so the Dockerfile and reachability.py come from that branch while CLI_VERSION installs the requested wheel. Rebuilding an older stable after main has moved recreates the pin mismatch.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 21a802d. Configure here.


Problem
Dockerfileinstalled@coana-tech/cliunpinned, while the launcher asks npx for the version inDEFAULT_COANA_CLI_VERSION. npx reuses the image's global install only when the versions match; on a mismatch it downloads the engine again on every scan.Measured in the published image:
The two agreed only because release rebuilds happened to follow the pin bumps. Nothing enforced it, and the failure mode is silent — no error, no test failure, just slower scans and extra egress.
Change
reachability.pyand installs exactly that, failing the build if the value cannot be read. The pin stays bumped in one place, so the image and the runtime cannot drift.RUN. A pin bump now rebuilds a 353 MB layer instead of the 2.3 GB combined layer.socketsecurity==inputs.versionfrom PyPI, so building from the default branch paired an old wheel with a newer build recipe and pin.tests/unit/test_dockerfile_coana_pin.pyruns the Dockerfile's own extraction expression against the real source and rejects an unpinned install.Dockerfilewas added to the unit-test path filter so the guard runs on Dockerfile-only changes.Verification
15.10.36;socketcli --helpandcoana-cliboth work.Could not read DEFAULT_COANA_CLI_VERSION from reachability.pyrather than silently installing unpinned.sed.e2e-reachability needs to run here — this changes how the engine is installed, so it is the meaningful gate.
Not included
socketnpm is still installed unpinned and the npm cache is still shipped in the image. Both are tracked separately.Refs: CE-431
Note
Medium Risk
Changes how the published Docker image installs the reachability engine and how stable releases are built; wrong pinning would affect every containerized scan but is guarded by build failure and new unit tests.
Overview
Fixes a silent mismatch where the Docker image installed unpinned
@coana-tech/cliwhile scans invokenpxwithDEFAULT_COANA_CLI_VERSIONfromreachability.py— when versions diverged, npx re-downloaded the engine on every scan (extra time and egress).The Dockerfile now copies
reachability.py, extracts the pin with the samesedlogic used at build time, andnpm installs that exact version (build fails if the constant cannot be read). The Coana install is split into its own layer so pin bumps rebuild a smaller layer instead of the full toolchain step. Release 2.7.2 bumps package version and changelog accordingly.Mark release stable (
docker-stable.yml) now checks outv${{ inputs.version }}so stable images are built from that tag’s Dockerfile/pin, notmainpaired with an older PyPI wheel.CI adds
tests/unit/test_dockerfile_coana_pin.py(sed extraction + no unpinned Coana install) and runs unit tests whenDockerfilechanges.Reviewed by Cursor Bugbot for commit 21a802d. Configure here.