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

Aperta
#19 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
62/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
html, typescript, vite
Ambito
frontend, security

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
TypeScript
Stelle
3
Fork
3
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TMHSDigital/GH-Arcade

Tutte le issue di TMHSDigital/GH-Arcade

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.