Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: decouple netlify headers from hashesModule #103

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion @kindspells/astro-shield/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kindspells/astro-shield",
"version": "1.5.0",
"version": "1.5.1",
"description": "Astro integration to enhance your website's security with SubResource Integrity hashes, Content-Security-Policy headers, and other techniques.",
"private": false,
"type": "module",
Expand Down
20 changes: 9 additions & 11 deletions @kindspells/astro-shield/src/core.mts
Original file line number Diff line number Diff line change
Expand Up @@ -753,17 +753,6 @@ export const processStaticFiles = async (
sri,
)

if (!sri.hashesModule) {
return
}

await generateSRIHashesModule(
logger,
h,
sri.hashesModule,
sri.enableMiddleware,
)

if (securityHeaders?.enableOnStaticPages !== undefined) {
const provider = securityHeaders.enableOnStaticPages.provider
switch (provider) {
Expand All @@ -789,6 +778,15 @@ export const processStaticFiles = async (
exhaustiveGuard(provider, 'provider')
}
}

if (sri.hashesModule) {
await generateSRIHashesModule(
logger,
h,
sri.hashesModule,
sri.enableMiddleware,
)
}
}

export const getMiddlewareHandler = (
Expand Down
Loading