-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Update configuration to always download HTML/JS/XML Bitstreams (no inline display) #9638
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks right but seems to be failing integration tests.
@mwoodiupui : Thanks for the note! It appears we have an IT which is still hardcoding a specific count of BitstreamFormats (sigh). Since this PR added a single new BitstreamFormat those counts all failed. So, it's really a flawed test & not a sign of an issue in this PR. Nonetheless, I'll get the test fixed (hopefully later today) so that it succeeds. (If I can figure out a way to easily remove the hardcoded numbers, I'll do so...but not sure how much effort that'd be) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with this PR except for the IT fix that I would recommend to fix keeping the number of types hardcoded
dspace-server-webapp/src/test/java/org/dspace/app/rest/BitstreamFormatRestRepositoryIT.java
Outdated
Show resolved
Hide resolved
@mwoodiupui : Nevermind, I changed it to update the hardcoded value per @abollini 's feedback above. See 8d81c14 |
1b16836
to
8d81c14
Compare
Perhaps, separate from this issue, we should have a discussion about why the test should depend on a magic number that has to be changed when unrelated improvements are made. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 by inspection
XML files (text/xml) also allow JavaScript execution. |
…ormats so that it can be recognized by DSpace.
8d81c14
to
e6bfb83
Compare
I've updated this PR today to include the following:
|
…ed. Update test to prove behavior.
I hate to drag this out further, but if we list |
…ly. Add a new wildcard setting to allow sites to force all files to download only.
@abollini and @mwoodiupui : I've made some changes to this PR today which I hope are improvements, so I'd appreciate a re-review. See the updated PR description for all the details...but here are the highlights:
|
@mwoodiupui : Per your comment, we don't need to include Any file format that is NOT in that registry will be downloaded as |
Final note for today: Because everything that comes back as (We could also wait until this week's Developer's Meeting to discuss all this in greater detail together.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a code review. It looks good to me. I have one comment: while I understand why we have a hard-coded restriction on html, javascript and xml, we do not have a way to override this. There are probably repositories that want to be able to show html after properly reviewing it or by allowing very trusted users to submit anything. I think it would be less than one hour to introduce a new configuration property that allows to switch off this hardcoded list.
Seeing the timeline for DSpace 8 and the importance of this patch I'm +1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with the current PR. Unfortunately, in DSpace 7+ we loose the possibility to serve properly html content that wourl require relative url to work to download css and additional content in the same item. So force the download is the safer and easier solution at this time. We could reconsider it when we have a full functional html support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 tested successfully and the code looks good to me.
Yes, it is a 'hard-coded' fix, but sets the safest defaults, and I think any implementer who is willing to take the risk (perhaps they have extra validation of uploaded html/xml/js) of serving this content inline could reasonably be expected to apply a patch that reverts this change for DSpace 8.x
Successfully created backport PR for |
Description
This PR updates our default settings for
webui.content_disposition_format
to include HTML, JavaScript, XML and RDF by default.The changes in this PR are the equivalent of these settings in
dspace.cfg
. These settings will work in any DSpace 7.6 or 7.6.1 installation to provide the same fixes as this PR.This ensures that bitstreams of these formats are always downloaded and never opened inline by a user's browser. Opening these formats inline may cause the browser to execute any JavaScript contained within them. (Execution of embedded JavaScript may not always occur for all sites, but it is possible.)
New Wildcard Option
This PR also provides sites the ability to force all formats to download only. This means that no files will ever be opened inline in a user's browser. To force all formats to download only, use a wildcard/asterisk:
Add JavaScript to Format Registry
This PR also adds JavaScript to the list of default formats in the Bitstream Format Registry to ensure it is a recognized format (by default).
Instructions for Reviewers
webui.content_disposition_format = *
in your local.cfg or dspace.cfgRelated work
For more on
webui.content_disposition_format
see #8891