Repository navigation
Upgrade Astro to 7.4 and add basic security settings - #56
Merged
Merged
Conversation
npm audit reported 12 vulnerable packages in the build tree, one of them critical (astro 5.18.2). Astro 7.4.2 and @astrojs/sitemap 3.7.4 clear all of them; npm audit now reports 0. Astro 7 needs Node 22.23.4 or newer: the deploy workflow moves to Node 24, package.json gets an engines field and the README and contributor notes state the new minimum. Vite 8 targets Safari 16.4 by default and rewrites max-width media queries in the bundled CSS into range syntax, which older Safari ignores; build.cssTarget keeps the CSS readable for Safari 14 and newer. Add a narrow Content-Security-Policy meta tag (object-src none, base-uri and form-action self). It does not restrict scripts. Add a weekly Dependabot config for npm and GitHub Actions that groups minor and patch updates, and a pull-request workflow that runs the Playwright suite, so those updates are built and tested before a merge.
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.
Summary
npm auditon main reports 12 vulnerable packages (1 critical, 10 high, 1 low), the critical one being astro 5.18.2. This upgrades Astro to 7.4.2, which clears all of them, and adds a few low-risk hardening settings: a narrow CSP meta tag, Dependabot version updates, and a PR build check so those updates get tested before a merge.Changes
engines.node >=22.23.4, README and contributor notes updated.vite.build.cssTargetset to Safari 14 and the other Vite 6 browsers. Without it, Vite 8 rewrites the bundled max-width media queries into range syntax that Safari before 16.4 ignores.Base.astro:object-src 'none'; base-uri 'self'; form-action 'self'. It does not restrict scripts, so GTM and the inline scripts are untouched; it blocks plugins,<base>injection and form posts to other hosts..github/dependabot.yml: weekly npm and GitHub Actions updates, minor and patch grouped, majors as separate PRs..github/workflows/pr-build.yml: runs the Playwright suite (which builds the site) on every PR.Validation
npm audit: 12 vulnerabilities on main, 0 on this branch.npm run buildon main and on this branch, then a diff ofdist/with hashed asset names,<style>blocks, whitespace and the CSP tag stripped: 0 of 9 pages differ. The remaining differences are CSS minifier output (property order) and HTML whitespace.dist/(grep -rhoE '@media ?\([^)]*(<|>)[^)]*\)' dist): 0 on main, 6 on Astro 7 withoutcssTarget, 0 with it.npx playwright test --workers=1withCI=1: 7 passed.securitypolicyviolationlistener: 0 violations on 9 pages. The same listener reports all 3 directives on a canary page that breaks them.Not checked