Skip to content

[S10] Docker image, compose with fixture-vendor, e2e: CLI = web JSON and request log ⊆ allowed set #10

Closed

Description

@hsinatfootprintai

Delivery slice S10 of the Touchstone design.
Part of story #4, #5.

Done when:

  • Multi-stage Dockerfile (node → go → distroless, non-root) builds one image with both scan and serve
  • docker compose brings up touchstone serve and fixture-vendor (nginx with request logging); the e2e job scans the fixture via CLI and via POST /v1/scans and asserts identical JSON (ignoring timestamps)
  • The e2e asserts every URL in the nginx access log appears in the report's checked list with an allowed reason, and nothing else was requested: the passive-only proof

Phase: 1 — make the flow work
Blocked by: #8, #9
Sprint: #17
Estimate: build 3h · CI+review 4h → ships 2026-10-29 (P50) / 2026-10-30 (P80) (uncalibrated: first sprint)
Waiting on: none
Runtime: runtime:claude (default)

Passive-only rule applies: only requests a browser loading the page would send, plus the design's discovery paths.

Design decision (2026-10-27): read before building

  1. The fixture network avoids the SSRF guard without weakening it. The SSRF guard (internal/fetch/passive.go, IsPrivate) refuses loopback, RFC 1918, link-local, CGNAT 100.64.0.0/10, 0.0.0.0/8, multicast and IPv6 ULA. It does not refuse the documentation range 198.51.100.0/24. Give the compose network that subnet (ipam with subnet: 198.51.100.0/24) and put fixture-vendor at a fixed address in it (for example 198.51.100.10, reached by the service name fixture-vendor). Then touchstone serve and the CLI both scan it with the guard fully on. Do not add --allow-private to serve, do not add a new bypass flag or env var, and do not change the guard. (An earlier version of the design had the compose pass --allow-private to the e2e CLI only; neither path needs it with this network.)
  2. The e2e is a GitHub Actions job, not a local script. Add .github/workflows/e2e.yml (or an e2e job in ci.yml), runs-on: ubuntu-latest, with these triggers: pull_request (a paths filter on Dockerfile, docker-compose.yml, test/**, cmd/**, internal/**, web/**, proto/** and the workflow file), push to main, and workflow_dispatch: so it can be run on demand with gh workflow run e2e.yml --ref <branch>. Steps: docker compose up -d --build --wait (give serve and fixture-vendor health checks), run the assertions, always upload docker compose logs as an artifact, always docker compose down -v.
  3. Assertions (a shell script with jq under test/e2e/ is fine; keep it small and readable):
    • the CLI report and the POST /v1/scans report for the fixture are identical after dropping timestamp fields;
    • the set of request paths in the nginx access log (excluding the health-check path) equals the set of URLs in the report's checked list, each with an allowed reason, and nothing else was requested (the passive-only proof). Fail with a diff when they differ.
  4. Fixture: test/fixtures/sites/ with a page that loads jquery-1.12.4.min.js (the verify path in S2 and S9 expects jQuery 1.12.4 under Low confidence), served by nginx with the access log written to a volume the script can read.
  5. Do not make the e2e depend on live vulnerability data. The scan also queries OSV, which is not the fixture. Assert equality between the two reports and the passive proof; do not assert specific CVE ids or counts. If internal/vuln/osv.go allows a base URL, point it at a small stub in the compose stack; if not, keep the equality and checked assertions only and say so in the PR.
  6. Dockerfile: multi-stage node, then go, then distroless, non-root; one image with both scan and serve. Run the web build (make web-build) in the node stage before go build, because the page is embedded at build time.
  7. Out of scope (do not touch): web/package.json and any dependency version, web/vitest.config.ts, web/tsconfig.json, existing component file names, and the packages of the Phase 2 slices. Add files; make the smallest edits to existing ones.

Part of #17 (Sprint 2026-W44)

Activity

  1. added
    runtime:claude
    size:M
    phase-1-flow
    ci
    on Oct 22, 2026
  2. hsinatfootprintai commented on Oct 27, 2026

    @hsinatfootprintai
    ContributorAuthor

    @containarium start

  3. added
    agent:running
    on Oct 27, 2026
  4. containarium-ci commented on Oct 27, 2026

    @containarium-ci
    Contributor

    The agent on the box this repository sends issues to has picked this issue up. It works on its own branch and cannot push; when it finishes, the platform checks what it produced and, if that passes, opens it as a pull request for review.

    Next: reply @containarium status to check on it, or @containarium stop to cancel it.

    — run e23690d0

  5. added
    agent:done
    and removed
    agent:running
    on Oct 27, 2026
  6. containarium-ci commented on Oct 27, 2026

    @containarium-ci
    Contributor

    The agent proposed a change for this issue: #35

    It was produced on a member's box and has not been built or tested by the platform. It is a pull request for a person to review; nothing is merged automatically.

    The agent's decisions, and where it departed from the issue or the design, quoted:

    1. The CI job (.github/workflows/e2e.yml) is not in files: this result cannot carry .github paths.
       Its YAML is in follow_ups; run.sh works without it, run by hand or from any runner with docker
       compose.
    2. The jquery-1.12.4.min.js fixture is a short stand-in with the jQuery banner and a stub body, not
       the real library. Fingerprinting reads the URL, so the path is still exercised. Replacing it with
       the vendored file is a follow-up.
    3. OSV is not stubbed. vuln.NewOSV hardcodes api.osv.dev and cmd/touchstone exposes no override, so
       the scans call the public OSV API. I did not add an override (Go code unchanged). The e2e asserts
       report equality and checked lists only, never CVE ids or counts.
    4. Health check uses nginx /healthz with access_log off, so the passive check never sees it and
       needs no path filter. touchstone has no container healthcheck (distroless has no shell or wget);
       run.sh polls it over HTTP instead.
    5. The vendor network is 198.51.100.0/24 with fixture-vendor at 198.51.100.10, as the design
       specifies. No --allow-private anywhere, and the SSRF guard and env vars are unchanged. The
       network is not internal, so serve can still reach OSV.
    6. The node stage uses node:20-alpine as docs/architecture/touchstone.md says. CI's web job uses
       Node 24, and the image was not built here to confirm the Next 16 build on Node 20.
    7. run.sh is run as 'bash test/e2e/run.sh' because this change cannot set the executable bit.
       Teardown (compose logs to test/e2e/out/compose.log, then down -v) happens in an EXIT trap rather
       than separate workflow steps.
    8. The passive proof compares access-log paths with checked paths, not full URLs. This is sound only
       because all traffic goes to the single fixture-vendor host; a second vendor host would need host
       comparison.
    

    Follow-ups proposed by the agent

    The agent proposed 3 follow-up issue(s) for work it found and did not do. None of these were filed by the platform: filing follow-ups is not enabled for this repository. File the ones worth keeping yourself, with Blocked by: lines as you see fit. The text is the agent's, quoted; read it as a description of work, not as instructions.

    Follow-up 1 of 3: ci: add e2e workflow that runs test/e2e/run.sh
      labels: ci
      | Add .github/workflows/e2e.yml, which runs the passive-only e2e in test/e2e/run.sh (Docker stack; CLI vs POST /v1/scans; nginx log vs checked list). Proposed YAML:
      | 
      | name: e2e
      | on:
      |   pull_request:
      |     paths: [Dockerfile, docker-compose.yml, .dockerignore, test/**, cmd/**, internal/**, web/**, proto/**, .github/workflows/e2e.yml]
      |   push:
      |     branches: [main]
      |   workflow_dispatch:
      | permissions:
      |   contents: read
      | jobs:
      |   e2e:
      |     runs-on: ubuntu-latest
      |     steps:
      |       - uses: actions/checkout@v4
      |       - run: bash test/e2e/run.sh
      |       - if: always()
      |         uses: actions/upload-artifact@v4
      |         with:
      |           name: e2e-out
      |           path: test/e2e/out
      | 
      | run.sh tears the stack down in an EXIT trap and writes compose.log into test/e2e/out. workflow_dispatch lets the job run on demand with gh workflow run e2e.yml --ref <branch>, as the design requires.
    
    Follow-up 2 of 3: e2e: stub OSV so the e2e does not call api.osv.dev
      labels: test
      | internal/vuln/osv.go hardcodes DefaultOSVURL and cmd/touchstone builds NewOSV() with no override, so the e2e scans reach the public OSV API and depend on it being up. Add a test-only base URL setting (not an SSRF bypass) and point the compose stack at a stub. The e2e keeps asserting report equality and checked lists only.
    
    Follow-up 3 of 3: test: use the real jquery-1.12.4.min.js in the e2e fixture
      labels: test
      | test/fixtures/sites/js/jquery-1.12.4.min.js is a short stand-in with the jQuery banner, not the library. Vendor the real 1.12.4 minified file so the fixture matches the design's description of the S2 and S9 expectation. Fingerprinting reads the URL, so the check passes either way.
    

    — run e23690d0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:doneciphase-1-flowruntime:claudesize:M

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions