Register filters & servlets later + CSP improvements#7550
Open
labkey-adam wants to merge 5 commits intorelease26.3-SNAPSHOTfrom
Open
Register filters & servlets later + CSP improvements#7550labkey-adam wants to merge 5 commits intorelease26.3-SNAPSHOTfrom
labkey-adam wants to merge 5 commits intorelease26.3-SNAPSHOTfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale
Change #1: We were registering filters and servlets with Tomcat very early in the startup process, before the list of modules had even been finalized. Also, one client deployment ran into this issue: https://github.com/LabKey/internal-issues/issues/1008; unclear what caused this, but deferring registration might help. This change moves filter and servlet registration much later, to just before we start Tomcat.
Change #2: Previously, our CSP filter would check the base server URL to determine if the server supported https and, if so, always include the
report-todirective and related header, regardless of the current request's schema. The header would be configured with an absolute (https:) URL. This was an attempt to ensure the browser would use report-to regardless of the request's scheme. In reality, (on Chrome, at least), with report-to configured, an http: request would result in no report being sent (neither report-to nor not report-uri). While it's not critical that we support this corner case (CSP violations occurring from an http request to a server configured for https), switching to an approach that determines whether to add report-to directive and header based solely on the current request's scheme removes unnecessary complexity from the filter. We also switch to adding a singleReporting-Endpointsheader instead of one per CSP filter. https://github.com/LabKey/internal-issues/issues/956Existing automated tests should cover both changes.
Related Pull Requests