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

No permission to get upload via API #2507

Closed
f-krueger opened this issue Feb 24, 2021 · 4 comments
Closed

No permission to get upload via API #2507

f-krueger opened this issue Feb 24, 2021 · 4 comments

Comments

@f-krueger
Copy link

Describe the bug

When trying to access data uploads via API that was uploaded by userA, userB gets HTTP error 403.

Steps to reproduce

Information

  • Version of eLabFTW (visible in bottom right of a page): 3.6.6
  • Server operating system (e.g: Ubuntu, CentOS): Debian latest stable
  • Docker (yes/no): yes
  • Client operating system (e.g: MacOS, Windows, GNU+Linux): Ubuntu
  • Browser (e.g. firefox, chrome): not applicable
@NicolasCARPi
Copy link
Contributor

Hello,

It is not a bug per se, it's just how it was coded. I even added a comment to acknowledge my laziness:

// check user owns the file
// we could also check if user has read access to the item
// but for now let's just restrict downloading file via API to owned files
if ((int) $uploadData['userid'] !== (int) $this->Users->userData['userid']) {
       return new Response('You do not have permission to access this resource.', 403);
}

(source)

I'll try and fix that later.

@NicolasCARPi
Copy link
Contributor

This has been fixed!

@m6121
Copy link
Contributor

m6121 commented Apr 29, 2021

Are the changes from a27ef8f compatible with the current version 3.6.7 in order to enable download of the attachments prior to the new release version 4?

@NicolasCARPi
Copy link
Contributor

@m6121 yes they are!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants