-
Notifications
You must be signed in to change notification settings - Fork 16
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
[FEATURE] Add Server Option to Send SAP's Target CSPs by default #179
Conversation
When option cspDefaults:true is given, the server now sends two policies for *.html files, both in report-only mode: - sap-target-level-1, which forbids inline scripts and only allows sources from self - sap-target-level-2, which additionally forbids 'eval' Each policy is sent with its own 'Content-Security-Policy-Report-Only' header. This might look uncommon, but simplifies automated validation of the violation reports that are sent by the browser. Browsers don't consistently report blocked-uri or source-file, but the original-policy is reported consistently. middleware/csp.js: - allow to define and send a 2nd default policy - skip execution for file types other than *.html and for HTTP methods other than POST and GET - use native capabilities of the express request object instead of parsing URLs with NodeJS means - when using the URL parameter, the shorter suffix ":ro" can now be used to activate the report-only mode server.js - add boolean server option 'cspDefaults' (default false) - enrich csp middleware configuration accordingly when option is set test/ - enhance for the new features
Renamed to |
I don't mind. But should we really use |
It should definitely be camelcased: |
@RandomByte why 'definitely' ? Our documentation guidelines state that "Consider the correct spelling of capitalized abbreviations like ID, URL, JSON etc. At the beginning of UI5 development, we decided for the same reg. control properties and APIs. And others give the same guidance, e.g. https://url.spec.whatwg.org/#url-apis-elsewhere :
|
Hm, I see. So far we tried to apply Googles Java Script guidelines for such cases: https://google.github.io/styleguide/jsguide.html#naming-camel-case-defined From my experience, I find this convention rather easy to apply and consume as it is very consistent with abbreviations of all kinds. Anyways, I could not find a public API of the tooling that applies this convention in that way so we can still decide and document it in https://github.com/SAP/ui5-tooling/blob/master/docs/Guidelines.md 👍 |
But this detail should not keep us from merging this. So from my side all uppercase or camel cased is fine and totally up to you in this case. Just the Travis/ESLint still has something to mock about:
|
"Your proposal is acceptable" :-) |
Please use Squash and Merge! @matz3 I think your review comment is resolved? |
When option cspDefaults:true is given, the server now sends two policies
for *.html files, both in report-only mode:
sources from self
Each policy is sent with its own 'Content-Security-Policy-Report-Only'
header. This might look uncommon, but simplifies automated validation of
the violation reports that are sent by the browser. Browsers don't
consistently report blocked-uri or source-file, but the original-policy
is reported consistently.
middleware/csp.js:
other than POST and GET
parsing URLs with NodeJS means
used to activate the report-only mode
server.js
test/
Thank you for your contribution! 🙌
To get it merged faster, kindly review the checklist below:
Pull Request Checklist