Skip to content

Commit 3466889

Browse files
authored
chore: more playground scenarios (#1985)
1 parent 654153a commit 3466889

File tree

2 files changed

+466
-0
lines changed

2 files changed

+466
-0
lines changed

playground/csp-violations/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,27 @@ http://localhost:8080
4343

4444
The playground includes examples for different types of CSP violations:
4545

46+
### Basic CSP Violations
47+
4648
1. **Inline Script Violation** - Tests violations of inline scripts
4749
2. **External Script Violation** - Tests loading scripts from non-allowed domains
4850
3. **External Image Violation** - Tests loading images from non-allowed domains
4951
4. **External Style Violation** - Tests loading stylesheets from non-allowed domains
5052
5. **XHR Violation** - Tests making XHR requests to non-allowed domains
5153
6. **Eval Violation** - Tests scripts with `eval` present
5254

55+
### Report-To Debug Cases
56+
57+
These test cases are specifically designed to debug report-to directive issues and test the logging functionality added in [PR #32868](https://github.com/PostHog/posthog/pull/32868):
58+
59+
1. **Debug Enabled** - Tests CSP reports with `debug=true` parameter for verbose logging
60+
2. **Invalid Content Type** - Tests CSP reports sent with incorrect content type to trigger error logging
61+
3. **Report-URI Only** - Tests pages using only `report-uri` directive (no `report-to`)
62+
4. **Report-To Only** - Tests pages using only `report-to` directive (no `report-uri`)
63+
5. **Both Report Directives** - Tests pages using both `report-uri` and `report-to` directives
64+
6. **Malformed Reporting Endpoints** - Tests malformed `Reporting-Endpoints` header to trigger error logging
65+
7. **Sampling Test** - Generates multiple violations rapidly with random query parameters and hashes to bypass URL-based sampling and test sampling behavior and logging
66+
5367
Each example will automatically trigger a CSP violation when the page loads, which will be reported to your configured CSP endpoint.
5468

5569
## How it Works

0 commit comments

Comments
 (0)