kindspells / astro-shield

Astro integration to enhance your website's security with SubResource Integrity hashes, Content-Security-Policy headers, and other techniques.
https://astro-shield.kindspells.dev
MIT License
58 stars 6 forks source link

Specifying base in astro config gets duplicated in path update and causes builds to error #144

Closed ndj91 closed 3 weeks ago

ndj91 commented 1 month ago

Hello,

Found a bug which results in unable to build.

When base is set in astro.config -> defineConfig. The value set for base is duplicated when generating sriHashes.

example astro.config.mjs

export defineConfig({
  base: './ap/pr-sit-pr47',
  integrations: [
    vue(),
    shield(
      {
        sri: {
          enableMiddleware: true, // MUST be enabled for dynamic pages!
          hashesModule: modulePath, // SHOULD be set!
        },
      },
    ),
  ],
})

image

Can this be looked into please?

ndj91 commented 1 month ago

Resolved this and opened a PR, can the PR be reviewed please?