Repository navigation
fix: clear code-scanning findings without changing behavior - #75
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The code-scanning alerts API returned 403 (
security_events=readis 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
.github/workflows/ebrains.yml:11permissions: contents: read. git-sync pushes to GitLab with its own token..github/workflows/publish_images.yml:17permissions: contents: read, same as the staging publish workflow.src/app/pages/experiment-studio/visualisations/charts/renderers/box-plot-chart.ts:173box-plot-chart.ts:175box-plot-chart.ts:181grouped-bar-chart.ts:110grouped-bar-chart.ts:114markerstays raw HTML; series name stays escaped.k-means-chart.ts:82k-means-chart.ts:83matrix-chart.ts:87mean-plot-chart.ts:113mean-plot-chart.ts:120pca-heatmap-chart.ts:78PC1 · 12.3%) is escaped; that text has no HTML characters.src/app/pages/terms-page/terms-page.component.ts:99'<p>' + textafterformatInline, which already escapes. Rendered terms HTML is unchanged.terms-page.component.ts:145h1.terms-page.component.ts:152h2.terms-page.component.ts:180li.terms-page.component.ts:186package.json:35d3pinned to locked7.9.0.package.json:37html2canvaspinned to1.4.1.package.json:38jspdfpinned to4.2.1.package.json:39jspdf-autotablepinned to5.0.9.package.json:40jszippinned to3.10.2.package.json:41ngx-echartspinned to22.0.0.package.json:42rxjspinned to7.8.2.package.json:43tslibpinned to2.8.1.src/app/pages/experiment-studio/visualisations/result-format.ts:118readable()uses a single-pass scan with the same matches as^[a-z0-9]+(_[a-z0-9]+)+$.src/app/pages/experiment-studio/visualisations/summary/key-figures.component.ts:12key-figures.component.html. Markup is unchanged. Two matches on this range.key-figures.component.ts:12src/app/services/experiment-studio.service.ts:716current[index]beforeJSON.stringify. Still an equality check, not an object key. The rule was tainting the index expression insideJSON.stringify.experiment-studio.service.ts:2040console.error('%s report is not available:', algorithmName, error). Constant format string.experiment-studio.service.ts:2040p/defaultand the vendored ruleset both reported it.Dockerfile:32apk add --no-cache gettext-envsubst=1.0-r0(Alpine 3.24), still afterapk upgrade.Dockerfile:53USER 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
nginx.conf.template:14proxy_set_header Host $hoston/services.nginx.conf.template:64nginx.conf.template:88/notebook/hub/home.nginx.conf.template:106Dockerfile:32apk upgradefails the container OSV gate at CVSS >= 8. Checked on the pinned digest (Alpine 3.24.3) and on currentnginx: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
$hostuses. They are upstreamHostheaders, not redirects. The rule matches the token$hostanywhere in the file, and$http_hostis the only other per-request host variable. Replacing them with$server_nameor 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.cssis 2.10 kB over its 20 kB budget. Build still exits 0.npm test -- --watch=false— 79 files, 1148 tests passed. Added cases forreadable()(including a 20k-character label) andescapeHtmlon ordinary chart text.avoid-apk-upgradeon the Dockerfile. Hadolint — clean.npx playwright test— 42 passed, 1 failed (filters on a numeric and a nominal variable). That failure also happens on unmodifiedmaster(8b17318) in this environment.Head
ab4a289CI 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 upgradewas 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 onPCA columns then K-means; the rerun on this head passed all 43 tests.