Skip to content

Conversation

@labkey-adam
Copy link
Contributor

@labkey-adam labkey-adam commented Jun 19, 2025

Rationale

https://www.labkey.org/home/Developer/issues/issues-details.view?issueId=53319

Adding the context path to the report-uri does the trick -- tested both with and without a context path. Note: for this to work correctly, any provided contextPath value must start with a slash. Credit to @labkey-tchad for current approach.

Related Pull Requests

@labkey-adam labkey-adam self-assigned this Jun 19, 2025
Copy link
Contributor

@labkey-matthewb labkey-matthewb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, this might not be right. This CSP will also be used for static pages. In that case this might be a nonsense URL. E.g. looks like an ActionURL with an improper container path.

Copy link
Member

@labkey-tchad labkey-tchad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CSPs in application.properties are only used for dev enlistments, which use a root contextPath without some modification to the file. If they do that, I think it's reasonable to expect them to modify the CSP as well.

The CSP defined in Java has access to the contextPath and could just include it in the CSP's report-uri, right?

Copy link
Member

@labkey-tchad labkey-tchad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spring boot support property interpolation. If we prepend the report URI with ${context.contextPath:}, it will fill in the context path (if it is defined)

@labkey-adam
Copy link
Contributor Author

The CSPs in application.properties are only used for dev enlistments, which use a root contextPath without some modification to the file. If they do that, I think it's reasonable to expect them to modify the CSP as well.

The CSP defined in Java has access to the contextPath and could just include it in the CSP's report-uri, right?

Given that these are dev-only and short lived (removed starting in 25.6), and the fact that @labkey-willm automation relies on this URI (I think), I'm going to leave the application.properties URIs as is.

@labkey-adam
Copy link
Contributor Author

On second thought, this might not be right. This CSP will also be used for static pages. In that case this might be a nonsense URL. E.g. looks like an ActionURL with an improper container path.

Approach was changed to continue to use an absolute URI but explicitly include the context path

@labkey-adam labkey-adam merged commit 032176f into release25.3-SNAPSHOT Jun 20, 2025
9 checks passed
@labkey-adam labkey-adam deleted the 25.3_fb_report_uri branch June 20, 2025 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants