loopbackio / loopbackio/loopback.io
Explorer violates content-security-policy: default-src 'self'
Nessuno ha ancora preso questa issue.
- Lingua principale
- HTML
- Stelle
- 276
- Fork
- 382
- Merge medio
- 6h 17m
- PR unite (30g)
- 18
Descrizione
URL of the page
https://localhost:3000/api/explorer/
Nature of the issue
If the API is served by an Ingress that implements this Response Header:
content-security-policy: default-src 'self'
the api explorer fails to load
Expected behavior
No errors when running with restrictive content-security-policy.
Actual behavior
The following errors appear in the console of Goole Chrome:
explorer/:11 Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-R1cfim84YiZ+NisBAfyCbdN3fV7Y7Uys20qAO4OBGJ0='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.
explorer/:36 Refused to execute inline script because it violates the following Content Security Policy directive: "default-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-DLbdWNBhwD1fyzUBjaE5Up3Y/4UCDB1OYv/c61qHL/I='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
These occur because the HTML contains a <style> and a <script> tag respectively.
Suggested resolution
Move the <style> and <script> contents to separate files.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dalla pagina API Explorer servita in /api/explorer/ e ispeziona l'HTML alla ricerca dei relativi elementi inline style e script. Sposta questi contenuti in file separati e verifica che la pagina venga caricata senza errori nella console con default-src 'self'.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- css, html, javascript
- Ambito
- frontend, security, web-dev
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100