Skip to content

Enlever les inline scripts sur datagouv pour un header CSP sécurisé #1557

@bolinocroustibat

Description

@bolinocroustibat

Nous sommes en train d'implémenter un header CSP.

Voir le contexte infra

Le header Content-Security-Policy à date et imparfait :

default-src 'none'; form-action 'self' https://dev-static.data.gouv.fr https://stats.data.gouv.fr; img-src 'self' https://dev-static.data.gouv.fr https://stats.data.gouv.fr; object-src 'self' https://dev-static.data.gouv.fr https://stats.data.gouv.fr; script-src 'self' https://dev-static.data.gouv.fr https://stats.data.gouv.fr 'unsafe-inline' blob: 'unsafe-eval'; style-src 'self' https://stats.data.gouv.fr https://dev-static.data.gouv.fr 'unsafe-inline'; font-src 'self' https://stats.data.gouv.fr https://dev-static.data.gouv.fr; connect-src 'self' https://stats.data.gouv.fr https://dev-static.data.gouv.fr https://errors.data.gouv.fr;

Nous avons aujourd'hui des inline scripts sur datagouv, notamment

  • importmap
  • piwik
    Il semble possible de bouger ces inline scripts en src à part entière.

D'autres propriétés peuvent poser problème et sont à vérifier :

  • captchetat (à priori script retourné par udata-front)
  • oembed
  • utilisation d'images distantes en markdown

Autres cas de soucis CSP :

Regarder ce qu'il en est sur notre nouveau front en Nuxt au passage :)

1ers objectifs

  • enlever les inline scripts
  • enlever les blob
  • garder les exceptions pour img-src
  • s'assurer que c'est fonctionnel pour Nuxt aussi

Metadata

Metadata

Assignees

Labels

🐻 InfraLes tickets propres à l'infra✨ FrontPour ce qui relève du design de l’interface⭐ PrioritairePrioritaire ce sprint

Type

No type

Projects

Status

📝 Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions