Skip to content

fix: clear code-scanning findings without changing behavior - #75

Merged
KFilippopolitis merged 3 commits into
masterfrom
cursor/security-code-scanning-773d
Nov 9, 2026
Merged

KFilippopolitis merged 3 commits into
masterfrom
cursor/security-code-scanning-773d

Conversation

@KFilippopolitis

@KFilippopolitis KFilippopolitis commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

The code-scanning alerts API returned 403 (security_events=read is not granted to this token), so alert numbers below are the ones named in the triage when the rule and file match. Every other row is a finding reproduced with the same OpenGrep 1.33.1 ruleset (semgrep-rules @ 17e31e11) and Hadolint 2.15.1 that CI uploads. Nothing was dismissed.

FIXED

Alert Rule File:line Fix
106 actions/missing-workflow-permissions .github/workflows/ebrains.yml:11 Workflow permissions: contents: read. git-sync pushes to GitLab with its own token.
2 actions/missing-workflow-permissions .github/workflows/publish_images.yml:17 Workflow permissions: contents: read, same as the staging publish workflow.
— javascript.lang.security.html-in-template-string src/app/pages/experiment-studio/visualisations/charts/renderers/box-plot-chart.ts:173 Build the tooltip with concatenation. Escape the label and the formatted number.
— javascript.lang.security.html-in-template-string box-plot-chart.ts:175 Same. Title was already escaped.
— javascript.lang.security.html-in-template-string box-plot-chart.ts:181 Static divider markup is a plain string.
— javascript.lang.security.html-in-template-string grouped-bar-chart.ts:110 Concatenation. Dataset text stays escaped.
— javascript.lang.security.html-in-template-string grouped-bar-chart.ts:114 Concatenation. ECharts marker stays raw HTML; series name stays escaped.
— javascript.lang.security.html-in-template-string k-means-chart.ts:82 Concatenation. Names and variable labels stay escaped.
— javascript.lang.security.html-in-template-string k-means-chart.ts:83 Same.
— javascript.lang.security.html-in-template-string matrix-chart.ts:87 Concatenation. Row and column labels stay escaped.
— javascript.lang.security.html-in-template-string mean-plot-chart.ts:113 Concatenation. Group, axis label, and formatted value are escaped. Ordinary numbers are unchanged.
— javascript.lang.security.html-in-template-string mean-plot-chart.ts:120 Same.
— javascript.lang.security.html-in-template-string pca-heatmap-chart.ts:78 Concatenation. Component label (PC1 · 12.3%) is escaped; that text has no HTML characters.
— javascript.lang.security.html-in-template-string src/app/pages/terms-page/terms-page.component.ts:99 '<p>' + text after formatInline, which already escapes. Rendered terms HTML is unchanged.
— javascript.lang.security.html-in-template-string terms-page.component.ts:145 Same for h1.
— javascript.lang.security.html-in-template-string terms-page.component.ts:152 Same for h2.
— javascript.lang.security.html-in-template-string terms-page.component.ts:180 Same for li.
— javascript.lang.security.html-in-template-string terms-page.component.ts:186 Same for a nested paragraph.
— json.npm.security.package-dependencies-check package.json:35 d3 pinned to locked 7.9.0.
— json.npm.security.package-dependencies-check package.json:37 html2canvas pinned to 1.4.1.
— json.npm.security.package-dependencies-check package.json:38 jspdf pinned to 4.2.1.
— json.npm.security.package-dependencies-check package.json:39 jspdf-autotable pinned to 5.0.9.
— json.npm.security.package-dependencies-check package.json:40 jszip pinned to 3.10.2.
— json.npm.security.package-dependencies-check package.json:41 ngx-echarts pinned to 22.0.0.
— json.npm.security.package-dependencies-check package.json:42 rxjs pinned to 7.8.2.
— json.npm.security.package-dependencies-check package.json:43 tslib pinned to 2.8.1.
263 javascript.lang.security.audit.detect-redos src/app/pages/experiment-studio/visualisations/result-format.ts:118 readable() uses a single-pass scan with the same matches as ^[a-z0-9]+(_[a-z0-9]+)+$.
— javascript.lang.correctness.missing-template-string-indicator src/app/pages/experiment-studio/visualisations/summary/key-figures.component.ts:12 Inline template moved to key-figures.component.html. Markup is unchanged. Two matches on this range.
— javascript.lang.correctness.missing-template-string-indicator key-figures.component.ts:12 Same move.
298 javascript.lang.correctness.no-stringify-keys src/app/services/experiment-studio.service.ts:716 Copy the step out of current[index] before JSON.stringify. Still an equality check, not an object key. The rule was tainting the index expression inside JSON.stringify.
— javascript.lang.security.audit.unsafe-formatstring experiment-studio.service.ts:2040 console.error('%s report is not available:', algorithmName, error). Constant format string.
— javascript.lang.security.audit.unsafe-formatstring.unsafe-formatstring experiment-studio.service.ts:2040 Same call. p/default and the vendored ruleset both reported it.
44 or 288 DL3018 Dockerfile:32 apk add --no-cache gettext-envsubst=1.0-r0 (Alpine 3.24), still after apk upgrade.
288 or 44 DL3066 Dockerfile:53 USER 101, the nginx uid in the official alpine image.

Scoped ranges such as @angular/* are not matches: the rule's key pattern does not allow @.

REMAINING

Alert Rule File Reason
— generic.nginx.security.request-host-used nginx.conf.template:14 proxy_set_header Host $host on /services.
— generic.nginx.security.request-host-used nginx.conf.template:64 Same header on the Jupyter user proxy.
— generic.nginx.security.request-host-used nginx.conf.template:88 Same header on /notebook/hub/home.
— generic.nginx.security.request-host-used nginx.conf.template:106 Same header on the remaining notebook proxy.
— dockerfile.best-practice.avoid-apk-upgrade Dockerfile:32 Removing apk upgrade fails the container OSV gate at CVSS >= 8. Checked on the pinned digest (Alpine 3.24.3) and on current nginx:alpine-slim (Alpine 3.24.4, built 2026-11-05). The packages that clear the gate are newer than that image.

The four nginx rows are the only $host uses. They are upstream Host headers, not redirects. The rule matches the token $host anywhere in the file, and $http_host is the only other per-request host variable. Replacing them with $server_name or a startup env value would send one configured name to the backend and JupyterHub instead of the request host, which changes routing and absolute URLs.

Tests

  • npm ci — lockfile matches the pinned specs. Resolved versions are unchanged.
  • npm run verify — passed (typecheck, dead-code, production build). Pre-existing warning: algorithm-panel.component.css is 2.10 kB over its 20 kB budget. Build still exits 0.
  • npm test -- --watch=false — 79 files, 1148 tests passed. Added cases for readable() (including a 20k-character label) and escapeHtml on ordinary chart text.
  • OpenGrep app scan on this branch — the four nginx rows above, plus avoid-apk-upgrade on the Dockerfile. Hadolint — clean.
  • Local npx playwright test — 42 passed, 1 failed (filters on a numeric and a nominal variable). That failure also happens on unmodified master (8b17318) in this environment.

Head ab4a289 CI is green: CodeQL (actions, javascript-typescript, python), container scan, Playwright, SCA, SAST, typecheck/build, Vitest, and gitleaks all passed. Hadolint, Opengrep OSS, Trivy, and osv-scanner show as skipping because those results are folded into the container and SAST jobs.

Two earlier container-scan runs failed on purpose while apk upgrade was removed: OSV reported CVSS >= 8 (Trivy was only a warning) on both Alpine 3.24.3 and current Alpine 3.24.4. The upgrade step is restored. One intermediate Playwright run timed out on PCA columns then K-means; the rerun on this head passed all 43 tests.

Open in Web Open in Cursor 

Pin the unscoped dependency ranges the npm rule flags, pin the Alpine
envsubst package, and stop upgrading packages inside the image. Give the
publish and EBRAINS workflows contents: read. Build chart and terms HTML
outside template literals, compare transformation steps without using a
stringified value as a key, and scan snake_case labels in linear time.
Dropping apk upgrade left the pinned nginx image on Alpine 3.24.3, and
OSV then failed the container gate at CVSS 8. The current alpine-slim
digest already ships 3.24.4, which is the release that upgrade was applying.
The current nginx:alpine-slim digest is Alpine 3.24.4 and still fails
OSV at CVSS 8 without apk upgrade. The packages that clear the gate are
newer than that image, so the upgrade step has to stay.
@KFilippopolitis
KFilippopolitis merged commit 4be5ece into master Nov 9, 2026
16 checks passed
@KFilippopolitis
KFilippopolitis deleted the cursor/security-code-scanning-773d branch November 9, 2026 17:15
@KFilippopolitis
KFilippopolitis restored the cursor/security-code-scanning-773d branch November 9, 2026 17:58
@KFilippopolitis
KFilippopolitis deleted the cursor/security-code-scanning-773d branch November 11, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants