Cross-Site Scripting
Cross-Site Scripting
Cross-Site Scripting, o XSS, si verifica quando i dati controllati dall'attaccante vengono eseguiti come codice del browser su un sito attendibile.
Un altro esempio
Un post del forum contiene `<img alt="" onerror=…>`. Un template sicuro lo inserisce come testo, pulisce il piccolo insieme consentito di Markdown, blocca URL dannosi e applica CSP. Un test di regressione controlla separatamente i contesti HTML, attributo, URL, CSS e JavaScript.
Parti principali
- 01Fonte non attendibile
- 02contesto dell'interprete e destinazione non sicura
- 03Confine di codifica/sanificazione
Usalo quando
Codifica l'output non attendibile per il suo contesto esatto e utilizza le API DOM sicure. Se l'HTML è consentito, puliscilo con una whitelist rigorosa e aggiungi CSP come ulteriore difesa.
Non usarlo quando
Una funzione di escape non si adatta a tutti i contesti. I controlli di input o il CSP da soli non possono rendere sicuro ogni punto non sicuro.
Nome usato nel codice
contextual output encoding + safe sinks + HTML sanitization + CSP Prima di spedire
Work only within an explicitly authorized and isolated defense test. Check the trust boundary, inert regression case, mitigation, and handling of secrets and personal data. Check redacted detection signals, safe failure, incident owner, recovery, and rollback. Never test a real target.
Outcome: Complete the task with Cross-Site Scripting (Cross-Site Scripting). User context: Un post del forum contiene `<img alt="" onerror=…>`. Un template sicuro lo inserisce come testo, pulisce il piccolo insieme consentito di Markdown, blocca URL dannosi e applica CSP. Un test di regressione controlla separatamente i contesti HTML, attributo, URL, CSS e JavaScript. Risk or control to address: Cross-Site Scripting (Cross-Site Scripting). Why it applies: Codifica l'output non attendibile per il suo contesto esatto e utilizza le API DOM sicure. Se l'HTML è consentito, puliscilo con una whitelist rigorosa e aggiungi CSP come ulteriore difesa. Classification boundary: Una funzione di escape non si adatta a tutti i contesti. I controlli di input o il CSP da soli non possono rendere sicuro ogni punto non sicuro. Safety requirements: Test only in an isolated space with explicit permission. Use inert, harmless inputs. Protect secrets and personal data. Name the trust boundary and record the mitigation. Operational safeguards: Set up detection and logs that hide sensitive data. Name the incident owner. Define a safe failure mode and rollback before release. Acceptance criteria: A defensive regression test fails before the mitigation and passes after it. No real target, secret, or personal data is used. Monitoring and rollback are verified. Evidence and limits (evidence boundary): È ufficiale per quella fonte. Altre piattaforme o team potrebbero usare il termine in modo diverso. Unknowns to confirm: Authorized scope, affected assets, data class, threat actor, incident owner, and rollback limits.
Controlla questa richiesta
Review how Cross-Site Scripting (Cross-Site Scripting) is used now. Definition: Cross-Site Scripting, o XSS, si verifica quando i dati controllati dall'attaccante vengono eseguiti come codice del browser su un sito attendibile. Release checks: Work only within an explicitly authorized and isolated defense test. Check the trust boundary, inert regression case, mitigation, and handling of secrets and personal data. Check redacted detection signals, safe failure, incident owner, recovery, and rollback. Never test a real target. Before changing code, list the evidence, gaps, severity, and the smallest safe fix.