CORS
Condivisione delle risorse tra origini (Cross-Origin Resource Sharing)
CORS è una regola di sicurezza HTTP del browser. Un server elenca quali altre origini possono leggere le sue risposte. Può limitare metodi, intestazioni e credenziali.
Un altro esempio
Una dashboard su app.example.com chiama api.example.net. L'API controlla il preflight prima delle scritture autenticate e permette solo l'origine di produzione.
Parti principali
- 01Identity or input
- 02Policy or transformation
- 03Stored result and audit evidence
Usalo quando
Imposta CORS sul server o gateway quando il codice del browser deve leggere da un altro dominio.
Non usarlo quando
Non usare origini jolly con credenziali o riflettere origini sconosciute. CORS non sostituisce l'autenticazione o la protezione CSRF.
Nome usato nel codice
Origin / Access-Control-Allow-* / OPTIONS Prima di spedire
Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback.
Outcome: Complete the task with Condivisione delle risorse tra origini (Cross-Origin Resource Sharing) (CORS). User context: Una dashboard su app.example.com chiama api.example.net. L'API controlla il preflight prima delle scritture autenticate e permette solo l'origine di produzione. Technical concept or control: Condivisione delle risorse tra origini (Cross-Origin Resource Sharing) (CORS). Why it fits: Imposta CORS sul server o gateway quando il codice del browser deve leggere da un altro dominio. Do not use it when: Non usare origini jolly con credenziali o riflettere origini sconosciute. CORS non sostituisce l'autenticazione o la protezione CSRF. Engineering requirements: Define inputs, outputs, contracts, and rules that must always hold. Set authorization and input checks. Define failures, timeouts, retries, one-time effects, data moves, and compatibility limits. Operations: Add useful signals and logs that hide sensitive data. Set capacity limits and write an operator guide. Test recovery and rollback. Acceptance criteria: Contract and failure-path tests pass. Data and authorization rules still hold during retries and partial failures. Check performance limits, monitoring, recovery, and rollback. Evidence and limits (evidence boundary): Lo standard copre solo l'ambito elencato. Non sceglie lo stile visivo, la decisione sul prodotto o l'esempio di vocabolario. Unknowns to confirm: Where the code runs, data stores, traffic shape, consistency needs, and the security boundary. Also confirm the compatibility period, service goals, and rollback limits.
Controlla questa richiesta
Review how Condivisione delle risorse tra origini (Cross-Origin Resource Sharing) (CORS) is used now. Definition: CORS è una regola di sicurezza HTTP del browser. Un server elenca quali altre origini possono leggere le sue risposte. Può limitare metodi, intestazioni e credenziali. Release checks: Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback. Before changing code, list the evidence, gaps, severity, and the smallest safe fix.