-
Notifications
You must be signed in to change notification settings - Fork 13
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
API should respond with 401 not just silently not list embargoed if embargoed are requested #1788
Comments
I believe the reason such dandisets aren't listed at all is to prevent the discovery of their existence. That is, if you don't have permission to view such a resource, then even learning of the existence thereof would violate a specific standard of authorization. In a similar manner, such a policy would give a 404 instead of a 401 when attempting to access unauthorized resources by name or ID. Of course we can do something different here, but this impacts our security model so we need to make the requirements explicit before we make a change. Or maybe I misunderstood your problem? |
@roni I think the point he's making is that if |
I think that behavior should be
It is not about security concern of accessing a resource (and our IDs has no privacy concerns IMHO since they are just incremental numbers). It is about developer (and API "users") experience, and thus marked as such: it is only "internal knowledge" ATM that we are not to list embargoed datasets at all even if requested if not authorized. |
Thanks for clarifying, @AlmightyYakob and @yarikoptic. |
I'd like to revisit this a bit. My model for what Compare the situation of an authenticated user who does not have access to any embargoed dandisets. The argument might run that because they are asking for something that they don't have access to, that too should result in a 401. For both cases, my approach is that the set of embargoed dandisets each user has access to is the empty set; therefore in both cases, the appropriate response is just the open dandisets. Part of my thinking here is practical: if we send back a 401 for unauthenticated users in this situation, we are opening ourselves up to a class of frontend bugs where the app receives a 401 (and therefore breaks) in case it allows for sending But this brings me to a zoom-out question: @yarikoptic, I'm wondering why you need this feature. Is it because you have a script that accidentally runs unauthenticated and therefore returns the "wrong" data? In that case I would recommend simply having the script check whether a user is logged in, and erroring out if not. That solves the problem with zero code changes to the archive, which to me is a win. Of course, that may not be the problem you're having... |
@yarikoptic, an update: I am still interested in your immediate use case, but Jake and I spoke to some of our tech elders here, and we reached a consensus that Jake's design in #1790 is a good one, so I'll withdraw my suggestion that we should close that PR and solve your problem in a different way. |
note my comment in that PR. |
That's a comment on the web app behavior and how it might change--did you mean to link to something else? |
yes, it is on web-app but web-app is part of the |
🚀 Issue was released in |
ATM we have odd behavior that even if I request embargoed dandisets explicitly, I would simply not get them listed in the output listing all dandisets, instead of what would be more appropriate IMHO to provide some feedback that authentication is needed to get that information.
NB not to say that there is no option in swagger to provide examples with proper header field for that, just some insufficient X-CSRFToken.
IMHO 401 with WWW-Authenticate would be most DX friendly to respond if I do request explicitly
embargoed=true
. Ifembargoed=false
or not explicitly provided - then it would be fine to not list them.WDYT @satra @jwodder and @dandi/dandiarchive ?
The text was updated successfully, but these errors were encountered: