Skip to content

chore(deps): update vulnerable deps and fix dompurify config #101

Closed

Description

@Ardnived

Summary

pnpm audit --prod currently reports 65 vulnerabilities — 1 critical, 24 high (2026-08-06 run; the readiness report counted 64/23). The lockfile sits at the exact floor of the declared semver ranges: react-router declared ^7.1.2 resolves to exactly 7.1.2 (7 HIGH advisories — XSS via ScrollRestoration, XSS via open redirects, DoS — patched >=7.18.0, in range), and dompurify declared ^3.2.3 resolves to 3.2.3 (15 advisories per the readiness audit, patched >=3.4.11, in range), plus undici/postcss transitives. A plain in-range pnpm update fixes all of these with zero code change. The one exception — swiper (the critical, needs the v12 major) — is explicitly excluded: a sibling ticket owns that bump.

Same subsystem, second finding: the DOMPurify allowlist on CMS event descriptions is silently a no-op. In src/components/organisms/EventDetails/EventDetails.tsx:92-110, USE_PROFILES: { html: true } (line 93) overwrites the configured ALLOWED_TAGS (12 tags) / ALLOWED_ATTR: ['href'] — the effective allowlist is the full HTML profile (~117 tags / 113 attributes, including style, class, img src, form/input). Not script execution (the profile is safe), but CMS-authored prose can overlay the host page (style="position:fixed;inset:0" — a clickjacking surface), fire image beacons, or render forms inside a trusted page.

Proposed changes

  • Run an in-range pnpm update so the lockfile picks up patched react-router (>=7.18.0), dompurify (>=3.4.11), and the undici/postcss transitive fixes. No package.json range changes needed; do NOT touch swiper (sibling ticket owns the major).
  • Drop USE_PROFILES: { html: true } from the DOMPurify.sanitize call (EventDetails.tsx:92-110) so the explicit 12-tag / href-only allowlist actually applies. Keep ADD_ATTR: ['target'] and the existing afterSanitizeAttributes rel-hardening hook (EventDetails.tsx:19-23, forces rel="noopener noreferrer" on target links).
  • Re-verify the sanitize config against the updated dompurify version's semantics — the current advisory set includes "DOMPurify ADD_ATTR predicate skips URI validation"; confirm ADD_ATTR: ['target'] remains safe under the new version (target is not a URI attribute) and that config-precedence behaviour hasn't shifted between 3.2.x and the resolved 3.4.x.
  • Defense-in-depth context: one react-router advisory (backslash open redirect in Link/useNavigate, patched 7.18) is the upstream form of the exact bug this repo hand-patched in safePath (src/lib/shape/path.ts:56-57, commit 368e1f7). The update complements — does not replace — that guard; the existing safePath tests (src/lib/shape/path.test.ts) must stay green.

Acceptance criteria

  • pnpm audit --prod reports zero high or critical advisories with paths through react-router or dompurify
  • swiper remains at 11.2.1 in this ticket's diff (the major bump is owned by the sibling carousel ticket)
  • USE_PROFILES is removed and a co-located unit test (node lane, renderToStaticMarkup-free — assert on the sanitizer output string, per .claude/rules/tests.md) proves the allowlist: strips a <div style="position:fixed"> (both the tag and the style attr), <img src>, <form>/<input>; keeps all 12 allowed tags and href; and an <a target="_blank" href> comes out with target preserved plus rel="noopener noreferrer" (the hook). Extract the sanitize call to a testable module-scoped seam in the same folder if needed.
  • Existing safePath tests stay green
  • pnpm lint && pnpm typecheck && pnpm test:run && pnpm build pass
  • Write an implementation report to .claude/reports/<issue-number>-<short-slug>.md — in the MAIN checkout at /Users/devindra/Documents/Projects/SahajAtlasWeb even when implementing from a worktree (the folder is gitignored) — covering what changed, what was deliberately NOT changed, and which readiness-report findings are resolved.

Files affected

  • pnpm-lock.yaml (shared — see note)
  • src/components/organisms/EventDetails/EventDetails.tsx
  • src/components/organisms/EventDetails/EventDetails.test.tsx (new, co-located sanitizer test)

Parallel implementation: this ticket OWNS the files listed above; sibling release-hardening tickets run concurrently — avoid edits outside owned files except strictly additive ones. The pnpm lockfile is shared with two sibling tickets; conflicts there are expected and resolved by re-running pnpm install.

References

  • .claude/reports/RELEASE_READINESS.md §3.6 (dependency posture) + §3.2 (XSS posture) — ship-blocker 3 (repo-local, gitignored)
  • Verified 2026-08-06: package.json ranges vs pnpm-lock.yaml resolutions ([email protected], [email protected]); pnpm audit --prod totals above
  • Commit 368e1f7 — the hand-patched backslash/whitespace guard in safePath

Activity

  1. added 2 commits that reference this issue on Aug 8, 2026
    435d755
    56c6b0d
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

    No labels
    No labels

    Type

    No type

    Fields

    Hold Until

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions