Skip to content
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

Allow content-security-policy headers to be defined #28

Open
guusdk opened this issue Nov 4, 2021 · 3 comments
Open

Allow content-security-policy headers to be defined #28

guusdk opened this issue Nov 4, 2021 · 3 comments

Comments

@guusdk
Copy link
Member

guusdk commented Nov 4, 2021

The specification suggests that content-security-policy HTTP headers are added to GET requests.

@Fishbowler
Copy link
Member

I started having a play with this in the HTPPFileUploadComponent, but something I'm doing is refusing to use the default.
@guusdk If you get chance, can you spot my bug?
Fishbowler/httpfileuploadcomponent@b76a98e

@guusdk
Copy link
Member Author

guusdk commented Jan 21, 2024

Oh, I missed this completely. In the component, I raised and fixed guusdk/httpfileuploadcomponent#46 which got released as its 1.7.0 version. In #62 this release got included in this plugin, which was then released as version 1.4.0.

My fix was very blunt: just a hard-coded value. Yours seems more versatile.

@guusdk
Copy link
Member Author

guusdk commented Jan 21, 2024

@Fishbowler I'm not reproducing your problem, I think. I've rebased your branch to the current master, and connected the resulting application to a local instance of Openfire. Without any configuration (apart from the configuration needed to make it connect to Openfire), I can use a client to upload an image. When I then look at that image in a browser, I seem to get the default CSP header values:

image

I had problem setting this option (to make it use anything but the default). This is because the option definition does not allow for an argument (which is thus being ignored if it's provided).

To fix this, change:

options.addOption(
    Option.builder()
        .longOpt( "contentSecurityPolicy" )
        .desc( "The value of the Content-Security-Policy header that is returned by the servlet. Defaults to 'default-src 'none'; frame-ancestors 'none';'." )
        .build()
);

into

options.addOption(
    Option.builder()
        .longOpt( "contentSecurityPolicy" )
        .hasArg()
        .desc( "The value of the Content-Security-Policy header that is returned by the servlet. Defaults to 'default-src 'none'; frame-ancestors 'none';'." )
        .build()
);

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

No branches or pull requests

2 participants