diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 0efe038..f01c8ac 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -121,6 +121,16 @@ jobs: run: actionlint .gitea/workflows/*.yml - name: Shell scripts (shellcheck) run: git ls-files -z '*.sh' | xargs -0 shellcheck + - name: Code patterns (semgrep) + # Rule packs come from the semgrep registry, so new rules can surface new + # findings: fix them, or suppress one line with `nosemgrep: ` and a reason. + run: | + apt-get install -y -qq --no-install-recommends python3-venv >/dev/null + python3 -m venv /tmp/semgrep && /tmp/semgrep/bin/pip install -q semgrep==1.184.0 + /tmp/semgrep/bin/semgrep scan --metrics=off --error \ + --config p/javascript --config p/nodejs --config p/expressjs \ + --config p/secrets --config p/security-audit \ + --exclude public/web_template --exclude node_modules ui: name: UI (playwright) diff --git a/README.md b/README.md index fc36e9f..65b8132 100644 --- a/README.md +++ b/README.md @@ -589,7 +589,7 @@ Everything runs from `.gitea/workflows/ci.yml`: | `Lint (eslint)` | `npm run lint`, plus a check that fails on em or en dashes in Pulse-owned files | Every push and PR | | `Test (jest)` | `npm test`: unit tests for `lib/` and the worker, and the deploy-script sandbox tests. Fails if coverage drops below the floors in `package.json` (`lib/` 90% lines, `worker/` 40%) | Every push and PR | | `Security (npm audit)` | `npm audit --audit-level=high`, plus a CycloneDX SBOM of production dependencies (kept 90 days as the `sbom-cyclonedx` artifact of each `main` build) | Every push and PR, and weekly (Monday 06:00) | -| `Scan (secrets, workflows, shell)` | gitleaks over the whole git history, actionlint on the workflow files (with shellcheck on their scripts), and shellcheck on every `*.sh` | Every push and PR | +| `Scan (secrets, workflows, shell)` | gitleaks over the whole git history, actionlint on the workflow files (with shellcheck on their scripts), shellcheck on every `*.sh`, and semgrep (JavaScript, Node.js, Express, secrets and security-audit rule packs). Suppress a reviewed false positive on its line with `nosemgrep: ` and a comment saying why | Every push and PR | | `Integration (api)` | Starts the real server and three workers on Node 20 against MariaDB, then runs `tests/integration/` over HTTP and WebSocket: the Gandalf API contract, HTTP and WebSocket auth, and execution reliability (worker crash, capacity, abort) | Every push and PR | | `UI (playwright)` | Starts the real server and three workers against a MariaDB service container, then runs the Playwright tests in `tests/ui/` (desktop and phone) | Every push and PR | | `Deploy` | Calls the `pulse-deploy` webhook on CT 122, waits until `/healthz` reports the tested commit, then tags it `deploy-*` | Push to `main`, only after all six checks pass | diff --git a/scripts/demo/seed.py b/scripts/demo/seed.py index 24be874..080f6d9 100644 --- a/scripts/demo/seed.py +++ b/scripts/demo/seed.py @@ -18,7 +18,8 @@ def call(method, path, body=None): B + path, method=method, headers=H, data=json.dumps(body).encode() if body is not None else None ) try: - with urllib.request.urlopen(req, timeout=30) as r: + # B is a fixed loopback demo URL, never user input. + with urllib.request.urlopen(req, timeout=30) as r: # nosemgrep: python.lang.security.audit.dynamic-urllib-use-detected.dynamic-urllib-use-detected return json.loads(r.read() or b"{}") except urllib.error.HTTPError as e: return {"error": e.code, "body": e.read().decode()[:200]}