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

Multi file upload lacks CSRF #504

Open
4 tasks done
abhi-markan opened this issue Jul 14, 2023 · 0 comments
Open
4 tasks done

Multi file upload lacks CSRF #504

abhi-markan opened this issue Jul 14, 2023 · 0 comments

Comments

@abhi-markan
Copy link

Prerequisites

  • Reproduced the problem
  • Followed all applicable steps in the debugging guide
  • Checked the FAQs on the message board for common solutions
  • Checked that your issue doesn't exist: https://github.com/ministryofjustice/moj-frontend/issues
  • Checked that there is not already a package that provides the described functionality

Description

Lack of CSRF when uploading files and unable to add custom fields to specify CSRF unless appended to query string as a parameter for uplodUrl and deleteUrl.

Steps to Reproduce

if(typeof MOJFrontend.MultiFileUpload !== 'undefined') {
  new MOJFrontend.MultiFileUpload({
    container: $('.moj-multi-file-upload'),
    uploadUrl: '/ajax-upload-url',
    deleteUrl: '/ajax-delete-url'
  });
}
  • Above does not provide a clean mechanism of providing token unless appended as a query parameter as ?csrf=abc to uploadUrl and deleteUrl.

Expected behaviour: Upload and delete URL can only be invoked with a CSRF token.

Actual behaviour: Upload and delete URL can be invoked without any CSRF token, thus a malicious user can invoke the endpoint without any authentication.

Reproduces how often: 100%

Versions

"@ministryofjustice/frontend": "1.6.4",

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

1 participant