SKY-D431 · Security in code
Unvalidated browser message origin
Skylos reports browser Window messages that send runtime data to a wildcard origin or pass unchecked incoming data to a supported sensitive action. The finding points to the send or the action that uses the message.
- Languages
- TypeScript/JavaScript
- Quality gate
- counted toward the gate limits (full and diff scans)
- Finding type
- review
Why it matters
A runtime value sent to a wildcard origin can reach a page other than the intended recipient. A handler that accepts messages from any origin can also let an unrelated page influence an application action.
What Skylos flags
function notify(accountId: string) { window.parent.postMessage({accountId}, "*");}What Skylos leaves alone
function notify(accountId: string) { window.parent.postMessage({accountId}, "https://app.example");}Why Skylos leaves it alone
The browser delivers messages only when the recipient has the configured origin.
More languages
TypeScript
Flagged
window.addEventListener("message", event => { fetch("/preferences", {method: "POST", body: JSON.stringify(event.data)});});Not flagged
window.addEventListener("message", event => { if (event.origin !== "https://app.example") return; fetch("/preferences", {method: "POST", body: JSON.stringify(event.data)});});Why Skylos leaves it alone
The request runs only for events from the chosen origin. Validate the payload before using it.
How Skylos decides
- For sending, resolves a browser Window receiver and reports runtime data sent with the wildcard targetOrigin.
- For receiving, follows event data from a supported Window message handler to a sensitive action. An exact origin check must protect the action on that path.
How to fix it
Supply the expected target origin when sending. When receiving, check the exact expected origin and validate the message shape before acting on the payload.
When it can be wrong
- A public readiness message can intentionally use a wildcard. Keep private or runtime payloads on a channel constrained to the intended origin.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
Mark the reviewed line with a rule-scoped Skylos ignore for SKY-D431. Record the evidence that justifies the exception.