CorsOriginListInvalid
warning native on by defaultGroup: Probable bugs
Send one allowed origin in the CORS header.
Example
Finding:
php
<?php
header("Access-Control-Allow-Origin: https://one.test, https://two.test");Reported:
- line 2: Send one allowed origin in the CORS header.
Detection
- Report builtin header setting Access-Control-Allow-Origin to a literal containing multiple comma-separated or whitespace-separated serialized origins. Accept exactly one valid serialized origin, null or star. Case-insensitive header name; whitespace around value is ignored.
- Emit one finding per violating operation. Flow facts require a reachable path with no intervening mutation, escaped alias or unknown call involving the tracked value. When the proof is inconclusive, nothing is reported.
Exceptions (no report)
- Unknown values and ordinary non-CORS headers are excluded. Do not reinterpret a comma inside an invalid URL as a supported origin list.
- Exclude shadowed builtin symbols, unresolved required types, incomplete syntax and unsupported PHP versions.
Fix
No automatic fix. Choosing a repair requires runtime information, error-handling policy or a semantic decision.
PHP versions
Available throughout PHP 5.3–8.5.
Configure
In custos.json:
json
{
"rules": {
"CorsOriginListInvalid": {
"enabled": false
}
}
}Suppress
Before the statement or declaration (or the first statement of the file):
php
// @custos-ignore CorsOriginListInvalid