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

Fix security bugs in edit_files_panel #2115

Merged
merged 1 commit into from
Oct 19, 2023
Merged

Conversation

bemoody
Copy link
Collaborator

@bemoody bemoody commented Oct 18, 2023

As a followup to pull #2111, I noted that the edit_files_panel has the same security problem as the old files_panel.

(This affects the project_files view as well as copyedit_submission.)

For example, in media/active-projects/SHuKI1APLrwWCqxSQnSk, try renaming subject-100 to subject-100'+alert('Hello world')+' . Then go to the project files page (not the preview; that bug has now been fixed) and click the corresponding link.

When text is included as a string in an inline JavaScript expression,
it must be escaped.

Currently, the upload form does not permit creating files or
directories with names containing quotes or control characters, but
the templates should nonetheless protect against that possibility.
@tompollard
Copy link
Member

Yoiks, good catch

Screenshot 2023-10-19 at 4 57 50 PM

@tompollard tompollard merged commit 76ed4ff into dev Oct 19, 2023
11 checks passed
@tompollard tompollard deleted the edit-files-panel-security branch October 19, 2023 20:59
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.

2 participants