-
Notifications
You must be signed in to change notification settings - Fork 615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CONSOLE-4430: Content Security Policy E2E testing with Puppeteer & Chrome #14675
base: master
Are you sure you want to change the base?
CONSOLE-4430: Content Security Policy E2E testing with Puppeteer & Chrome #14675
Conversation
@vojtechszocs: This pull request references CONSOLE-4430 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.19.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: vojtechszocs The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
42563ab
to
4f210a5
Compare
4f210a5
to
aa52aeb
Compare
@vojtechszocs: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
/retest |
This PR adds a script to allow automated testing of Console application for CSP violations.
Console currently implements CSP via Content-Security-Policy-Report-Only HTTP response header, reporting any CSP violations detected in production env. via SecurityPolicyViolationEvent handler to telemetry service.
Summary of changes
frontend/.puppeteer
directory. Chrome browser is installed only when necessary, i.e. when runningyarn test-puppeteer-csp
script, so the typicalyarn install
dependency update flow is not affected.yarn test-puppeteer-csp
infrontend
directory to launch the CSP test script. This script assumes that Console Bridge server is already running locally and will test http://localhost:9000/dashboards page for CSP violations using Chrome DevTools Protocol (CDP).General test flow
resourceType
=Document
). Modify the request by adding customTest-CSP-Reporting-Endpoint
header, instructing the server to use the given CSP reporting endpoint for testing purposes and then resume the modified request.resourceType
=CSPViolationReport
). Upon receiving such request, report the error and then fulfill the request with 200 status code (i.e. avoid the need to run a server that actually handles the requests for CSP violation reports).As a follow-up, we should add a CI job that invokes
test-csp.sh
as the entry point.