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

Multipart upload relies on cookie-based API authentication #41

Open
ThrawnCA opened this issue Nov 8, 2019 · 3 comments
Open

Multipart upload relies on cookie-based API authentication #41

ThrawnCA opened this issue Nov 8, 2019 · 3 comments

Comments

@ThrawnCA
Copy link

ThrawnCA commented Nov 8, 2019

The AJAX-based multipart upload assembles an API call that relies on cookies to authenticate, instead of obtaining the user's API key.

From a security standpoint, allowing cookie-based authentication to an API that cannot properly check for Cross-Site Request Forgery is a very bad idea. We deal with this on our site by stripping cookies for API calls. However, that filter breaks this extension.

@TkTech
Copy link
Owner

TkTech commented Nov 8, 2019

Relying on a cookie to authenticate the API intended to be used from a user's browser on the resource page is completely normal. Maybe I'm misunderstanding your issue.

@ThrawnCA
Copy link
Author

ThrawnCA commented Nov 8, 2019

It's normal, yes, but it's actually a really bad idea. Unlike a regular HTTP form, it's quite difficult for an API endpoint to detect and block cross-site request forgery. Which means that if you're logged in, then any site you visit can send API requests that will have your authentication stamped on them.

There are extensions that add a filter to block this (like https://github.com/data-govt-nz/ckanext-security) but they don't work properly on API endpoints. Dropping cookies on API endpoints is effective, but only feasible when API keys, not cookies, are used for authentication.

@ThrawnCA
Copy link
Author

ThrawnCA commented Feb 9, 2024

There is more information at https://lists-archive.okfn.org/pipermail/security/2014-November/000281.html about the problems with allowing cookie based authentication to APIs.

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