cors.py
python
sha256:c07f2f34a0db9f43fe866f157d1935322008545ff8940c06c7c921eb219c55ab
NXP-b DONE: independent BV-r2 pass + ISR (SD-17)
Human
minor
⚠ breaking
21 hours ago
| 1 | """CORS allowlist for hosted dashboard (§HGD.6.3).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | |
| 6 | def origin_allowed(origin: str | None, cors_origins: tuple[str, ...]) -> bool: |
| 7 | """Return whether Origin is allowed. |
| 8 | |
| 9 | Missing Origin (same-origin / non-browser) is allowed. |
| 10 | When cors_origins is empty, any explicit Origin is denied (fail closed for |
| 11 | cross-origin) except missing Origin. |
| 12 | """ |
| 13 | if origin is None or origin == "": |
| 14 | return True |
| 15 | return origin in cors_origins |
File History
1 commit
sha256:c07f2f34a0db9f43fe866f157d1935322008545ff8940c06c7c921eb219c55ab
NXP-b DONE: independent BV-r2 pass + ISR (SD-17)
Human
minor
⚠
21 hours ago