mirror of https://gitee.com/bigwinds/arangodb
Fix deleting rocksdb views and dump_authentication (#5779)
* fix deleting rocksdb views and dump_authentication * fix changelog, fix test
This commit is contained in:
parent
222f77249f
commit
f699d32664
|
@ -1,6 +1,9 @@
|
||||||
devel
|
devel
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
* if authentication is turned on requests to databases by users with insufficient rights
|
||||||
|
will be answered with the HTTP forbidden (401) response.
|
||||||
|
|
||||||
* upgraded bundled RocksDB library version to 5.14
|
* upgraded bundled RocksDB library version to 5.14
|
||||||
|
|
||||||
* added key generators `uuid` and `padded`
|
* added key generators `uuid` and `padded`
|
||||||
|
|
|
@ -136,16 +136,21 @@ bool resolveRequestContext(GeneralRequest& req) {
|
||||||
/// response if execution is supposed to be aborted
|
/// response if execution is supposed to be aborted
|
||||||
GeneralCommTask::RequestFlow GeneralCommTask::prepareExecution(
|
GeneralCommTask::RequestFlow GeneralCommTask::prepareExecution(
|
||||||
GeneralRequest& req) {
|
GeneralRequest& req) {
|
||||||
if (!::resolveRequestContext(req)) {
|
if (!::resolveRequestContext(req)) { // false if db not found
|
||||||
if (_auth->isActive()) {
|
if (_auth->isActive()) {
|
||||||
// prevent guessing of database names (issue #5030)
|
// prevent guessing database names (issue #5030)
|
||||||
addErrorResponse(rest::ResponseCode::UNAUTHORIZED,
|
auth::Level lvl = auth::Level::NONE;
|
||||||
req.contentTypeResponse(), req.messageId(),
|
if (req.authenticated()) {
|
||||||
TRI_ERROR_FORBIDDEN);
|
lvl = _auth->userManager()->databaseAuthLevel(req.user(), req.databaseName());
|
||||||
} else {
|
}
|
||||||
addErrorResponse(rest::ResponseCode::NOT_FOUND, req.contentTypeResponse(),
|
if (lvl == auth::Level::NONE) {
|
||||||
req.messageId(), TRI_ERROR_ARANGO_DATABASE_NOT_FOUND);
|
addErrorResponse(rest::ResponseCode::UNAUTHORIZED, req.contentTypeResponse(),
|
||||||
|
req.messageId(), TRI_ERROR_FORBIDDEN);
|
||||||
|
return RequestFlow::Abort;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
addErrorResponse(rest::ResponseCode::NOT_FOUND, req.contentTypeResponse(),
|
||||||
|
req.messageId(), TRI_ERROR_ARANGO_DATABASE_NOT_FOUND);
|
||||||
return RequestFlow::Abort;
|
return RequestFlow::Abort;
|
||||||
}
|
}
|
||||||
TRI_ASSERT(req.requestContext() != nullptr);
|
TRI_ASSERT(req.requestContext() != nullptr);
|
||||||
|
|
|
@ -332,7 +332,7 @@ RocksDBKeyBounds RocksDBIndex::getBounds(Index::IndexType type,
|
||||||
return RocksDBKeyBounds::GeoIndex(objectId);
|
return RocksDBKeyBounds::GeoIndex(objectId);
|
||||||
#ifdef USE_IRESEARCH
|
#ifdef USE_IRESEARCH
|
||||||
case RocksDBIndex::TRI_IDX_TYPE_IRESEARCH_LINK:
|
case RocksDBIndex::TRI_IDX_TYPE_IRESEARCH_LINK:
|
||||||
return RocksDBKeyBounds::Empty();
|
return RocksDBKeyBounds::DatabaseViews(objectId);
|
||||||
#endif
|
#endif
|
||||||
case RocksDBIndex::TRI_IDX_TYPE_UNKNOWN:
|
case RocksDBIndex::TRI_IDX_TYPE_UNKNOWN:
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -495,7 +495,7 @@ function AuthSuite() {
|
||||||
"preferred_username": "root",
|
"preferred_username": "root",
|
||||||
"iss": "arangodb", "exp": Math.floor(Date.now() / 1000) + 3600
|
"iss": "arangodb", "exp": Math.floor(Date.now() / 1000) + 3600
|
||||||
}, 'HS256');
|
}, 'HS256');
|
||||||
// should respond with unauthorized name guessing
|
// should respond with not-found because we are root
|
||||||
var res = request.get({
|
var res = request.get({
|
||||||
url: baseUrl() + "/_db/nonexisting/_api/version",
|
url: baseUrl() + "/_db/nonexisting/_api/version",
|
||||||
auth: {
|
auth: {
|
||||||
|
@ -503,7 +503,14 @@ function AuthSuite() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
expect(res).to.be.an.instanceof(request.Response);
|
expect(res).to.be.an.instanceof(request.Response);
|
||||||
expect(res).to.have.property('statusCode', 401);
|
expect(res).to.have.property('statusCode', 404);
|
||||||
|
|
||||||
|
// should prevent name guessing by unauthorized users
|
||||||
|
var res = request.get({
|
||||||
|
url: baseUrl() + "/_db/nonexisting/_api/version"
|
||||||
|
});
|
||||||
|
expect(res).to.be.an.instanceof(request.Response);
|
||||||
|
expect(res).to.have.property('statusCode', 404);
|
||||||
},
|
},
|
||||||
|
|
||||||
testDatabaseListNonSystem: function() {
|
testDatabaseListNonSystem: function() {
|
||||||
|
|
Loading…
Reference in New Issue