Skip to content

Commit 7fd90d1

Browse files
author
Kerkesni
committed
always evaluate policies in backbeat routes
Issue: CLDSRV-731
1 parent 4d7d1b3 commit 7fd90d1

File tree

2 files changed

+2
-33
lines changed

2 files changed

+2
-33
lines changed

lib/routes/routeBackbeat.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,17 +1596,8 @@ function routeBackbeat(clientIP, request, response, log) {
15961596
request.accountQuotas = infos?.accountQuota;
15971597
return next(err, userInfo, authorizationResults);
15981598
}, 's3', requestContexts),
1599-
(userInfo, authorizationResults, next) => {
1600-
// Using the same flag used to bypass user bucket policies
1601-
// for internal mode, so that we can bypass policy evaluation
1602-
// on backbeat routes. This ensures we don't break operations
1603-
// coming from internal services like backbeat
1604-
if (request.bypassUserBucketPolicies) {
1605-
return next(null, userInfo);
1606-
}
1607-
return handleAuthorizationResults(
1608-
request, authorizationResults, apiMethods[0], undefined, log, err => next(err, userInfo));
1609-
},
1599+
(userInfo, authorizationResults, next) => handleAuthorizationResults(
1600+
request, authorizationResults, apiMethods[0], undefined, log, err => next(err, userInfo)),
16101601
(userInfo, next) => {
16111602
// TODO: understand why non-object requests (batchdelete) were not authenticated
16121603
if (!isObjectRequest) {

tests/unit/routes/routeBackbeat.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,28 +1012,6 @@ describe('routeBackbeat authorization', () => {
10121012
const err = JSON.parse(response.end.getCall(0).args[0]);
10131013
assert.strictEqual(err.code, 'AccessDenied');
10141014
});
1015-
1016-
it('should bypass policy evaluation', async () => {
1017-
sinon.stub(auth.server, 'doAuth').yields(null, new AuthInfo({
1018-
canonicalID: 'abcdef/lifecycle',
1019-
accountDisplayName: 'Lifecycle Service Account',
1020-
}), [{
1021-
isAllowed: false,
1022-
implicitDeny: true,
1023-
action: 'objectReplicate',
1024-
}], undefined, undefined);
1025-
1026-
request.bypassUserBucketPolicies = true;
1027-
1028-
routeBackbeat('127.0.0.1', request, response, log);
1029-
1030-
void await endPromise;
1031-
1032-
if (testCase.expect) {
1033-
const errCode = response.writeHead.getCall(0).args[0];
1034-
assert.strictEqual(errCode, testCase.expect.code);
1035-
}
1036-
});
10371015
});
10381016
});
10391017
});

0 commit comments

Comments
 (0)