Add a Content-Security-Policy meta tag to the hub and game pages

Ouverte
#19 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
62/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
html, typescript, vite
Domaine
frontend, security

Piste de recherche

Read index.html and games/_template/index.html, then compare the game pages to see how they are built and whether a shared build step can add the policy. Run npm install and npm run dev, then check the hub and games online and offline for CSP violations while testing Phaser, Google Fonts, and the service worker. Done when every page loads without CSP violations; run npm run typecheck and npm run build.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

enhancement severity: low

Summary

No page sets a Content-Security-Policy. GitHub Pages cannot send custom response headers, so a <meta http-equiv> tag is the only way to add one. This is defence in depth for a static site.

Where

  • index.html:3-14
  • games/_template/index.html:1-13 and each games/*/index.html

Suggested fix

Add a policy along these lines and test Phaser, Google Fonts and the service worker against it:

default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;
font-src https://fonts.gstatic.com; img-src 'self' data: blob:; worker-src 'self';
connect-src 'self' https://fonts.googleapis.com https://fonts.gstatic.com; base-uri 'none'; object-src 'none'

Phaser may need blob: or data: in further directives. Injecting the tag from one place at build time avoids editing eleven HTML files.

Acceptance criteria

  • Hub and all games load with no CSP violations in the console, online and offline

Getting started

  • Relevant files: index.html, games/_template/index.html, games/*/index.html
  • Run locally: npm install, then npm run dev
  • Checks: npm run typecheck and npm run build (there is no test suite yet)
  • Related docs: README.md

Filed by repo-audit/full-audit at b001f5d. Severity: low. Effort: M. audit-key: security|index.html|Content-Security-Policy

Langage dominant
TypeScript
Étoiles
3
Forks
3
Métriques de merge des PR
Aucune PR mergée en 30 j

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de TMHSDigital/GH-Arcade

Toutes les issues de TMHSDigital/GH-Arcade

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.