-
Notifications
You must be signed in to change notification settings - Fork 853
revert HTTP return code change for user API, add tests #11331
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
Changes from all commits
2b7558c
9009fe8
4740069
bf4ffef
c03c95e
bd03f0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -606,8 +606,9 @@ CommTask::Flow CommTask::canAccessPath(auth::TokenCache::Entry const& token, | |
|
||
VocbaseContext* vc = static_cast<VocbaseContext*>(req.requestContext()); | ||
TRI_ASSERT(vc != nullptr); | ||
// deny access to database with NONE, (except /_api/user) | ||
if (vc->databaseAuthLevel() == auth::Level::NONE/* && !StringUtils::isPrefix(path, ApiUser)*/) { | ||
// deny access to database with NONE | ||
if (result == Flow::Continue && | ||
vc->databaseAuthLevel() == auth::Level::NONE) { | ||
result = Flow::Abort; | ||
LOG_TOPIC("0898a", TRACE, Logger::AUTHORIZATION) << "Access forbidden to " << path; | ||
} | ||
|
@@ -629,7 +630,6 @@ CommTask::Flow CommTask::canAccessPath(auth::TokenCache::Entry const& token, | |
|
||
if (result == Flow::Abort && _auth->authenticationSystemOnly()) { | ||
// authentication required, but only for /_api, /_admin etc. | ||
|
||
if (!path.empty()) { | ||
// check if path starts with /_ | ||
// or path begins with / | ||
|
@@ -660,7 +660,7 @@ CommTask::Flow CommTask::canAccessPath(auth::TokenCache::Entry const& token, | |
// `/_api/users/<name>` to check their passwords | ||
result = Flow::Continue; | ||
vc->forceReadOnly(); | ||
} else if (StringUtils::isPrefix(path, ApiUser)) { | ||
} else if (userAuthenticated && StringUtils::isPrefix(path, ApiUser)) { | ||
result = Flow::Continue; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually do not get why this is not equivalent ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I debugged it and the difference is that the broken code sets the status from
The correct behavior (as in 3.6 and the code of this PR) is to not make this change, and leave the status on
For the particular problem, the initial status is already There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh ok, so the problem is the user is not authenticated at all, why not just check for that later then ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, did. |
||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bit unnecessary to do this check then is it?