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
Nous sommes en train d'implémenter un header CSP.
Voir le contexte infra
Le header
Content-Security-Policyà date et imparfait :Nous avons aujourd'hui des inline scripts sur datagouv, notamment
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 :
Autres cas de soucis CSP :
blobunsafe_eval: Content-Security-Policy: The page’s settings blocked a script (script-src-elem) at blob:https://dev.data.gouv.fr/7cb261b7-9248-4768-88d9-b6e9ac46f53a from being executed because it violates the following directive: “script-src 'self' https://dev-static.data.gouv.fr https://stats.data.gouv.fr 'unsafe-inline' 'unsafe-eval'”img-src: Content-Security-Policy : Les paramètres de la page ont empêché le chargement d’une ressource (img-src) à l’adresse data:image/svg+xml;base64,PHN2ZyB3aWR0aD… car elle enfreint la directive suivante : « img-src 'self' https://dev-static.data.gouv.fr/ https://stats.data.gouv.fr/ » (pour la marianne dans le header)Regarder ce qu'il en est sur notre nouveau front en Nuxt au passage :)
1ers objectifs