diff --git a/@kindspells/astro-shield/package.json b/@kindspells/astro-shield/package.json index 5092932..2d7fa1d 100644 --- a/@kindspells/astro-shield/package.json +++ b/@kindspells/astro-shield/package.json @@ -64,7 +64,7 @@ }, "devDependencies": { "@types/node": "^22.5.5", - "astro": "^4.15.6", + "astro": "^4.15.7", "get-tsconfig": "^4.8.1", "rollup": "^4.21.3", "rollup-plugin-dts": "^6.1.1", diff --git a/@kindspells/astro-shield/src/e2e/fixtures/dynamic/package.json b/@kindspells/astro-shield/src/e2e/fixtures/dynamic/package.json index 7115400..b1e3b73 100644 --- a/@kindspells/astro-shield/src/e2e/fixtures/dynamic/package.json +++ b/@kindspells/astro-shield/src/e2e/fixtures/dynamic/package.json @@ -11,7 +11,7 @@ "license": "MIT", "dependencies": { "@astrojs/node": "^8.3.3", - "astro": "^4.15.6" + "astro": "^4.15.7" }, "devDependencies": { "@kindspells/astro-shield": "workspace:*" diff --git a/@kindspells/astro-shield/src/e2e/fixtures/hybrid/package.json b/@kindspells/astro-shield/src/e2e/fixtures/hybrid/package.json index 631ea2d..889e1dc 100644 --- a/@kindspells/astro-shield/src/e2e/fixtures/hybrid/package.json +++ b/@kindspells/astro-shield/src/e2e/fixtures/hybrid/package.json @@ -9,7 +9,7 @@ "license": "MIT", "dependencies": { "@astrojs/node": "^8.3.3", - "astro": "^4.15.6" + "astro": "^4.15.7" }, "devDependencies": { "@kindspells/astro-shield": "workspace:*" diff --git a/@kindspells/astro-shield/src/e2e/fixtures/hybrid2/package.json b/@kindspells/astro-shield/src/e2e/fixtures/hybrid2/package.json index ecc1ec2..43041e8 100644 --- a/@kindspells/astro-shield/src/e2e/fixtures/hybrid2/package.json +++ b/@kindspells/astro-shield/src/e2e/fixtures/hybrid2/package.json @@ -9,7 +9,7 @@ "license": "MIT", "dependencies": { "@astrojs/node": "^8.3.3", - "astro": "^4.15.6" + "astro": "^4.15.7" }, "devDependencies": { "@kindspells/astro-shield": "workspace:*" diff --git a/@kindspells/astro-shield/src/e2e/fixtures/hybrid3/package.json b/@kindspells/astro-shield/src/e2e/fixtures/hybrid3/package.json index d6861f3..4287857 100644 --- a/@kindspells/astro-shield/src/e2e/fixtures/hybrid3/package.json +++ b/@kindspells/astro-shield/src/e2e/fixtures/hybrid3/package.json @@ -9,7 +9,7 @@ "license": "MIT", "dependencies": { "@astrojs/node": "^8.3.3", - "astro": "^4.15.6" + "astro": "^4.15.7" }, "devDependencies": { "@kindspells/astro-shield": "workspace:*" diff --git a/@kindspells/astro-shield/src/e2e/fixtures/static/package.json b/@kindspells/astro-shield/src/e2e/fixtures/static/package.json index 4ecffa0..c4d8c45 100644 --- a/@kindspells/astro-shield/src/e2e/fixtures/static/package.json +++ b/@kindspells/astro-shield/src/e2e/fixtures/static/package.json @@ -8,7 +8,7 @@ }, "license": "MIT", "dependencies": { - "astro": "^4.15.6" + "astro": "^4.15.7" }, "devDependencies": { "@kindspells/astro-shield": "workspace:*" diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 1d2563f..9b9432c 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -9,6 +9,12 @@ import { shield } from '@kindspells/astro-shield' import aws from 'astro-sst' import { defineConfig, passthroughImageService } from 'astro/config' +const locales = { + root: { lang: 'en', label: 'English' }, + ca: { lang: 'ca', label: 'Català' }, + es: { lang: 'es', label: 'Español' }, +} + export default defineConfig({ output: 'static', adapter: aws(), @@ -20,27 +26,35 @@ export default defineConfig({ shield({}), starlight({ title: 'Astro-Shield Docs', - defaultLocale: 'en', - locales: { - root: { - label: 'English', - lang: 'en', - }, - en: { - label: 'English', - lang: 'en', - }, - }, + defaultLocale: 'root', + locales, social: { github: 'https://github.com/kindspells/astro-shield', }, sidebar: [ { label: 'Start Here', - items: [{ label: 'Getting Started', link: '/getting-started/' }], + translations: { + ca: 'Comença Aquí', + es: 'Empieza Aquí', + }, + items: [ + { + label: 'Getting Started', + translations: { + ca: 'Començant', + es: 'Empezando', + }, + link: '/getting-started/', + }, + ], }, { label: 'Guides', + translations: { + ca: 'Guies', + es: 'Guías', + }, items: [ { label: 'Subresource Integrity', @@ -50,29 +64,68 @@ export default defineConfig({ }, { label: 'Security Headers', + translations: { + ca: 'Capçaleres de Seguretat', + es: 'Cabeceras de Seguridad', + }, autogenerate: { directory: 'guides/security-headers', }, }, + { + label: 'Hosting Integrations', + translations: { + ca: "Proveïdors d'Allotjament", + es: 'Proveedores de Alojamiento', + }, + autogenerate: { + directory: 'guides/hosting-integrations', + }, + }, + ], + }, + { + label: 'Reference', + translations: { + ca: 'Referència', + es: 'Referencia', + }, + items: [ + { + label: 'Configuration', + translations: { + ca: 'Configuració', + es: 'Configuración', + }, + link: '/reference/configuration/', + }, ], }, { label: 'Other', + translations: { + ca: 'Altres', + es: 'Otros', + }, items: [ { label: 'Known Limitations', + translations: { + ca: 'Problemes Coneguts', + es: 'Problemas Conocidos', + }, link: '/other/known-limitations/', }, { label: 'Contributing', + translations: { + ca: 'Contribució', + es: 'Contribución', + }, link: 'https://github.com/kindspells/astro-shield/blob/main/CONTRIBUTING.md', }, ], }, - // { - // label: 'Reference', - // autogenerate: { directory: 'reference' }, - // }, ], }), ], diff --git a/docs/package.json b/docs/package.json index 38eafd9..64da53f 100644 --- a/docs/package.json +++ b/docs/package.json @@ -13,14 +13,14 @@ "dependencies": { "astro-sst": "^2.43.5", "sharp": "0.33.5", - "sst": "^3.1.13" + "sst": "^3.1.17" }, "devDependencies": { "@astrojs/check": "^0.9.3", - "@astrojs/starlight": "^0.27.1", + "@astrojs/starlight": "^0.28.1", "@astrojs/ts-plugin": "^1.10.2", "@kindspells/astro-shield": "workspace:^", - "astro": "^4.15.6", + "astro": "^4.15.7", "typescript": "^5.6.2" } } diff --git a/docs/src/content/docs/ca/getting-started.mdx b/docs/src/content/docs/ca/getting-started.mdx new file mode 100644 index 0000000..0d3a2b6 --- /dev/null +++ b/docs/src/content/docs/ca/getting-started.mdx @@ -0,0 +1,56 @@ +--- +# SPDX-FileCopyrightText: 2024 KindSpells Labs S.L. +# +# SPDX-License-Identifier: MIT + +title: Començant +description: Comença a protegir els teus llocs web Astro amb Astro-Shield. +--- + +## Introducció + +Astro-Shield t'ajudarà a millorar la seguretat dels teus llocs web Astro +permetent-te aplicar un conjunt ampli de bones pràctiques de seguretat, com ara: +- [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) +- [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) + + +## How to install + +import { Code, Tabs, TabItem } from '@astrojs/starlight/components'; + +Per a instal·lar-lo, executa la següent comanda al teu terminal: + + + +```bash +npm install --save-dev @kindspells/astro-Shield +``` + + +```bash +pnpm add --save-dev @kindspells/astro-shield +``` + + +```bash +yarn add --dev @kindspells/astro-shield +``` + + + +## Activant la integració + +Al teu fitxer de configuració `astro.config.mjs`, importa Astro-Shield i +afegeix-lo a la llista: + +```js +import { defineConfig } from 'astro/config' +import { shield } from '@kindspells/astro-shield' + +export default defineConfig({ + integrations: [ + shield({}) + ] +}) +``` diff --git a/docs/src/content/docs/ca/index.mdx b/docs/src/content/docs/ca/index.mdx new file mode 100644 index 0000000..42fd105 --- /dev/null +++ b/docs/src/content/docs/ca/index.mdx @@ -0,0 +1,43 @@ +--- +# SPDX-FileCopyrightText: 2024 KindSpells Labs S.L. +# +# SPDX-License-Identifier: MIT + +title: Benvingut a Astro-Shield +description: Protegeix les teves pàgines web Astro amb Astro-Shield. +template: splash +hero: + tagline: Comença a protegir la teva pàgina web amb Astro-Shield! + image: + file: ../../../assets/astro-shield.webp + actions: + - text: Començar + link: /getting-started/ + icon: right-arrow + variant: primary + - text: Aprèn sobre les integracions d'Astro + link: https://docs.astro.build/en/guides/integrations-guide/ + icon: external +--- + +import { Card, CardGrid } from '@astrojs/starlight/components'; + +## Què fa + + + + Astro-Shield s'encarrega de calcular els hashes SRI i de configurar l'atribut + `integrity` a les etiquetes de script i estil per a tu. + + + Astro-Shield pot configurar automàticament les capçaleres de `Content-Security-Policy` + per a tu. + + + Quan Astro-Shield detecta un script sospitós (és a dir, probablement injectat per + un atacant), l'eliminarà de l'HTML renderitzat. + + {/* + Blablablah... + */} + diff --git a/docs/src/content/docs/es/getting-started.mdx b/docs/src/content/docs/es/getting-started.mdx new file mode 100644 index 0000000..bc30a15 --- /dev/null +++ b/docs/src/content/docs/es/getting-started.mdx @@ -0,0 +1,55 @@ +--- +# SPDX-FileCopyrightText: 2024 KindSpells Labs S.L. +# +# SPDX-License-Identifier: MIT + +title: Empezando +description: Empieza a proteger tus sitios web Astro con Astro-Shield. +--- + +## Introducción + +Astro-Shield te ayudará a mejorar la seguridad de tu sitio Astro permitiéndote +aplicar muchas de las mejores prácticas de seguridad, tales como: +- [Integridad de Subrecursos](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) +- [Política de Seguridad de Contenidos](https://developer.mozilla.org/es/docs/Web/HTTP/CSP) + +## Cómo instalar + +import { Code, Tabs, TabItem } from '@astrojs/starlight/components'; + +Para instalar, ejecuta el siguiente comando en tu terminal: + + + +```bash +npm install --save-dev @kindspells/astro-Shield +``` + + +```bash +pnpm add --save-dev @kindspells/astro-shield +``` + + +```bash +yarn add --dev @kindspells/astro-shield +``` + + + +## Activando la integración + +En tu archivo `astro.config.mjs`, importa Astro-Shield y agrégalo a la lista +de integraciones: + +```js +import { defineConfig } from 'astro/config' +import { shield } from '@kindspells/astro-shield' + +export default defineConfig({ + integrations: [ + shield({}) + ] +}) +``` diff --git a/docs/src/content/docs/es/index.mdx b/docs/src/content/docs/es/index.mdx new file mode 100644 index 0000000..2432287 --- /dev/null +++ b/docs/src/content/docs/es/index.mdx @@ -0,0 +1,43 @@ +--- +# SPDX-FileCopyrightText: 2024 KindSpells Labs S.L. +# +# SPDX-License-Identifier: MIT + +title: Bienvenido a Astro-Shield +description: Protege tus sitios web Astro con Astro-Shield. +template: splash +hero: + tagline: ¡Empieza a proteger tu sitio web con Astro-Shield! + image: + file: ../../../assets/astro-shield.webp + actions: + - text: Empezando + link: /getting-started/ + icon: right-arrow + variant: primary + - text: Aprende sobre las integraciones de Astro + link: https://docs.astro.build/en/guides/integrations-guide/ + icon: external +--- + +import { Card, CardGrid } from '@astrojs/starlight/components'; + +## Qué hace + + + + Astro-Shield se encarga de calcular los hashes SRI y de establecer el + atributo `integrity` en las etiquetas de script y estilo por ti. + + + Astro-Shield puede establecer automáticamente los encabezados de `Content-Security-Policy` + por ti. + + + Cuando Astro-Shield detecta un script sospechoso (es decir, probablemente inyectado por + un atacante), lo eliminará del HTML renderizado. + + {/* + Blablablah... + */} + diff --git a/docs/src/content/docs/getting-started.mdx b/docs/src/content/docs/getting-started.mdx index 3477f1d..7c5e27f 100644 --- a/docs/src/content/docs/getting-started.mdx +++ b/docs/src/content/docs/getting-started.mdx @@ -23,13 +23,19 @@ To install, run the following command in your terminal: - +```bash +npm install --save-dev @kindspells/astro-Shield +``` - +```bash +pnpm add --save-dev @kindspells/astro-shield +``` - +```bash +yarn add --dev @kindspells/astro-shield +``` @@ -38,9 +44,7 @@ To install, run the following command in your terminal: In your `astro.config.mjs` file, import the integration and add it to the integrations array: - +``` diff --git a/docs/src/content/docs/guides/security-headers/netlify-static-content.mdx b/docs/src/content/docs/guides/hosting-integrations/netlify.mdx similarity index 76% rename from docs/src/content/docs/guides/security-headers/netlify-static-content.mdx rename to docs/src/content/docs/guides/hosting-integrations/netlify.mdx index 5ccf484..d36d690 100644 --- a/docs/src/content/docs/guides/security-headers/netlify-static-content.mdx +++ b/docs/src/content/docs/guides/hosting-integrations/netlify.mdx @@ -3,12 +3,14 @@ # # SPDX-License-Identifier: MIT -title: Configuring CSP headers for static content on Netlify -description: How to configure the Content-Security-Policy headers of your static pages on Netlify with Astro-Shield +title: Netlify +description: How to configure Astro-Shield to work on Netlify --- import { Aside, Code } from '@astrojs/starlight/components'; +## `Content-Security-Policy` for Static Content + Ensuring that Netlify serves your static content with the correct `Content-Security-Policy` headers requires some additional configuration. Specifically, set `securityHeaders.enableOnStaticPages.provider` to the value @@ -16,9 +18,7 @@ Specifically, set `securityHeaders.enableOnStaticPages.provider` to the value See a more complete example: - +```