@apostrophecms/security-headers module setup. - #225
Conversation
|
🔍 Vulnerabilities of
|
| digest | sha256:888537f6840e7859fd9be5a3f1831979f85a273a0dd14db41f57a1152d160a54 |
| vulnerabilities | |
| platform | linux/amd64 |
| size | 291 MB |
| packages | 985 |
📦 Base Image node:23-alpine
| also known as |
|
| digest | sha256:b9d38d589853406ff0d4364f21969840c3e0397087643aef8eede40edbb6c7cd |
| vulnerabilities |
Description
| ||||||||||||
Description
| ||||||||||||
Description
| ||||||||||||
Description
| ||||||||||||
Description
|
Walkthrough
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Pre-merge checks (1 passed, 2 warnings)❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
website/app.js (1)
13-15: Enhance CSP and HSTS Configuration
The @apostrophecms/security-headers module applies strict defaults—
• Strict-Transport-Security: max-age=31536000
• X-Frame-Options: SAMEORIGIN
• X-Content-Type-Options: nosniff
• Referrer-Policy: same-origin
• Permissions-Policy: disabled
• Content-Security-Policy: computed from default policy groups (general, googleFonts, oembed, analytics etc.) with a per-request nonce available as {{ nonce }} in templates (github.com).Override any header via module options (e.g., override options.policies for CSP or options.legitimateHosts; set Content-Security-Policy to false or a custom string) (github.com). To run CSP in report-only mode, add a Content-Security-Policy-Report-Only option with your policy string.
Before rolling this out to production:
- Deploy CSP in report-only to monitor violations.
- Whitelist expected origins (e.g., GTM/GA via the SEO module, your domain/CDN/upload hosts, YouTube/Vimeo embeds).
- Enable HSTS only on HTTPS production.
- Smoke-test the Apostrophe admin UI, preview routes, and any embedded widgets.
Let me know if you’d like a tailored CSP draft.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
website/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
website/app.js(1 hunks)website/package.json(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: lint
- GitHub Check: e2e-tests
- GitHub Check: security-scan
- GitHub Check: unit-tests
🔇 Additional comments (1)
website/app.js (1)
13-15: LGTM: module registration is correct.
| "@apostrophecms/security-headers": "^1.0.2", | ||
| "@barba/core": "^2.10.3", |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Add looks good; verify version and security posture.
Before merge, confirm @apostrophecms/security-headers@^1.0.2 is the latest compatible release with your Apostrophe/Node stack and check for advisories. Also ensure the lockfile is updated in this PR to avoid drift in CI.
Run:
🏁 Script executed:
#!/bin/bash
# Check latest, peer deps, and advisories
npm view @apostrophecms/security-headers version engines peerDependencies
npm info apostrophe version
node -v
npm audit --omit=devLength of output: 369
🏁 Script executed:
#!/bin/bash
set -e
echo "PeerDependencies of @apostrophecms/security-headers@1.0.2:"
npm view @apostrophecms/security-headers@1.0.2 peerDependencies
echo ""
echo "Lockfiles found in repo:"
find . -type f \( -name 'package-lock.json' -o -name 'yarn.lock' \)
echo ""
echo "Detecting lockfile changes relative to base branch:"
BASE=$(git merge-base HEAD main 2>/dev/null || git merge-base HEAD origin/main 2>/dev/null || echo HEAD)
echo "Base commit: $BASE"
git diff --name-only $BASE...HEAD | grep -E 'package-lock.json|yarn.lock' || echo "No lockfile changes detected"Length of output: 277
🏁 Script executed:
#!/bin/bash
set -e
echo "Checking security advisories in website directory:"
cd website
npm audit --omit=dev || true
echo ""
echo "Engines field for @apostrophecms/security-headers@1.0.2:"
npm view @apostrophecms/security-headers@1.0.2 enginesLength of output: 1619
security-headers upgrade and lockfile verified
@apostrophecms/security-headers@1.0.2 is the latest published version, exposes no peerDependencies or engine constraints (Node v24.3.0 is compatible) and your PR includes the updated website/package-lock.json.
npm audit --omit=dev reports 8 vulnerabilities (1 critical in form-data, 5 high in connect-multiparty, linkifyjs, on-headers, plus 2 low); run npm audit fix or otherwise resolve these before merging.
🤖 Prompt for AI Agents
In website/package.json around lines 43 to 44, npm audit (prod) reports 8
vulnerabilities after upgrading @apostrophecms/security-headers; run npm audit
--omit=dev to confirm, then run npm audit fix --omit=dev to auto-resolve what
can be fixed, manually update or replace any remaining vulnerable transitive
packages (notably form-data and connect-multiparty) by bumping direct dependency
versions or switching to maintained alternatives, regenerate and commit
website/package-lock.json, re-run the app’s test/build to verify no regressions,
and include the updated lockfile in the PR before merging.



No description provided.