Skip to content

Enforce web CSP, patch runtime packages and rescan security risks - #597

Merged
Collaboration95 merged 2 commits into
devfrom
guru/security-rescan-loop
Nov 1, 2026
Merged

Collaboration95 merged 2 commits into
devfrom
guru/security-rescan-loop

Conversation

@Collaboration95

@Collaboration95 Collaboration95 commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

The deployed web shell enforced only frame-ancestors; its fuller CSP was report-only. The runtime's digest-pinned Alpine base also retained zlib and musl packages with available fixes. This change enforces CSP with hashes of the exported inline scripts, permits only the configured exact S3 upload origin, adds browser isolation/permissions headers, hides nginx versions and upgrades runtime packages while retaining the base and ffmpeg pins.

References #458. This is post-baseline work from 1 November 2026, based on dev 2390589. It overlaps #569 only in the minimal runtime apk upgrade step; package manifests are unchanged (#593).

  • Fresh hosted passive ZAP before: four Medium CSP categories and five qualified Low header categories. Local image rescan: one Medium inline-style category remains because react-native-web needs inline styles. Hosted AFTER is PENDING, for the orchestrator after merge/deploy.
  • Runtime Trivy: three vulnerable package entries (two CVEs, Medium zlib and Unknown musl/musl-utils) to zero; non-empty Alpine inventory retained. Web image: zero before and after.
  • Terraform source: replace unrestricted S3 actions with explicit bucket-scoped operations, and log dev backups to the existing audit bucket. These require owner plan/apply. No apply was run. Raw IaC findings 15 to 11; two disappeared through scanner log-destination reclassification rather than separate fixes. Six High exceptions were renewed to 31 January 2027 as accepted risks. SSE-S3 remains unchanged.
  • Semgrep: eight findings before/after. Two qualified CloudFront TLS configuration findings remain: hosted dev accepts TLS 1.0/1.1; AWS's default certificate forces the legacy minimum. Fixing this needs a custom domain/certificate. Other findings have reachability-based triage. npm audit still reports 19 affected package names (18 Moderate, one Low) in build/test chains; none of the three underlying advisory packages is shipped in the 60-package server runtime closure. Container package matches were patched, but exact exploit reachability was not established: the musl entry has no description and the zlib non-blocking gzwrite/gzprintf trigger was not traced to an app call path. No forced Expo/minimatch upgrade is claimed.

Validation: test:fast (133 root, 985 server and 1,674 frontend passed), deployment fixtures, slow/PWA/browser tests, accessibility, frontend/server coverage, format, lint, typecheck, architecture, Python security-policy fixtures and Terraform format passed. New tests check exact inline-script hashes, startup S3-origin/header-injection validation and Terraform policy/logging boundaries. Docker startup negative cases passed.

The CSP app journey passed developer registration/sign-in, group creation, chat SSE and photo-file upload with zero CSP violations, then failed to navigate to video. A separate focused check passed real H264/AAC playback from self/blob URLs, manifest loading and activation of the actual exported service worker, also with zero CSP violations. This does not claim a complete private-media/S3/Cognito/device/push journey.

Authenticated local ZAP sent active API attacks but failed to finish/export after two attempts (disk exhaustion, then scanner connection reset). Owner/outsider probes denied group, members, contributions, chat and Archive access; invalid media-token tests do not prove valid-capability authorisation. The optional nginx gateway fixture also hit startup/readiness failures after two attempts. These are recorded gaps, not clean scans. No hosted active scan or new scanner/workflow was added. The default-branch code-scanning export had zero open alerts; branch-specific exports were used after CI reported an alert. Standalone CodeQL was skipped because the CLI download alone was ~984 MB. Existing PR CI did run security-extended (CodeQL 2.27.3): it flagged a High HTML-regex edge case in the new script-hash extractor. The extractor hashes trusted build output rather than sanitising user HTML, so this was not a demonstrated product XSS path; the malformed closing-tag case was fixed with a regression. Final JS/TS, Python and Actions analyses have zero results, and intermediate/final SARIF is retained. The final web rebuild returned the same image ID, so local scan/browser evidence remains bound to identical exported bytes.

Raw commands, versions, timestamps and reports are in the report-final rescan evidence bundle; research/rescan/triage.md, before-after.md and loop-log.md contain the qualified comparison and limitations. Leave merging and hosted AFTER to the owner/orchestrator.

Final head 04a643d2d789811ec026e78508fae31aba445dde: aggregate Quality run, CodeQL, release-security and secret-scan checks are green. CI web/browser checks are skipped by the existing dev-PR policy; local browser limits remain as described. Automated security review COMMENTED on the now-fixed intermediate alert. No human approval or merge is claimed.

Comment thread deploy/render-security-headers.mjs Fixed
@Collaboration95
Collaboration95 merged commit cd25fb5 into dev Nov 1, 2026
24 checks passed
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