Skip to content

Commit

Permalink
fix: decouple netlify headers from hashesModule
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Correa Casablanca <andreu@kindspells.dev>
  • Loading branch information
castarco committed Sep 17, 2024
1 parent 0a9cd55 commit ea3b3dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
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

0 comments on commit ea3b3dd

Please sign in to comment.