Repository navigation
Upgrade Astro to 7.4 and add basic security settings - #1
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 states the 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. The build job now holds only contents: read; the Pages and OIDC scopes stay with the deploy job. Add a narrow Content-Security-Policy meta tag (object-src none, base-uri and form-action self), which does not restrict scripts, a weekly Dependabot config that groups minor and patch updates, and a pull-request workflow that builds the site.
This branch had an error being deployed
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, narrows the permissions of the build job, and adds a narrow CSP meta tag, Dependabot version updates and a PR build check.Changes
engines.node >=22.23.4, minimum stated in the README.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.deploy.ymlholds onlycontents: read;pages: writeandid-token: writestay with the deploy job, so packages that run duringnpm ciand the build cannot deploy.Base.astro:object-src 'none'; base-uri 'self'; form-action 'self'. It does not restrict scripts (the password gate and the Bokeh demo are untouched); it blocks plugins,<base>injection and form posts to other hosts. The password gate stays client-side only..github/dependabot.yml: weekly npm and GitHub Actions updates, minor and patch grouped, majors as separate PRs..github/workflows/pr-build.yml:npm ciandnpm run buildon 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: 1 of 7 pages differs, only by minifier variable names in thecollaborationpage script.dist/: 0 on main, 13 on Astro 7 withoutcssTarget, 0 with it.securitypolicyviolationlistener: 0 violations on 7 pages.github-pagesbranch rule, as intended (https://github.com/Interra-Project/Interra-Project.github.io/actions/runs/39746116353).Not checked