Permissive origin in postMessage detected.
- Rule ID: javascript_lang_post_message_origin
- Languages: javascript
- Source: post_message_origin.yml
Description
Using "*" (any) as the target origin of a postMessage call allows third-parties to read the message.
Remediations
❌ Avoid using "*" as the target origin:
window.postMessage(message, '*')
✅ Specify the origin for your target application:
window.postMessage(message, 'https://myapp.example.com')
Associated CWE
Configuration
To skip this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --skip-rule=javascript_lang_post_message_origin
To run only this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --only-rule=javascript_lang_post_message_origin
Ready to take the next step? Learn more about Bearer Cloud.