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

Improvement/cldsrv 431 misc api implicit deny #5479

Merged
merged 3 commits into from
Dec 14, 2023

Conversation

benzekrimaha
Copy link
Contributor

@benzekrimaha benzekrimaha commented Dec 7, 2023

Bucket policies are not correctly interpreted, this is part of the following epic to fix that: scality/Arsenal#2181

This PR is aiming to update get apis since object and bucket authorisations are made at API level and need to support implicit denies, ticket linked to this issue here : https://scality.atlassian.net/browse/CLDSRV-431

PRs providing implicit Deny logic to CS for processing in this PR
scality/Arsenal#2181 and scality/Arsenal#2193
https://github.com/scality/Vault/pull/2135
#5322
#5420
#5432
#5456
#5462
#5470

Here CI links for zenko tests :
https://github.com/scality/Zenko/actions/runs/7209044767
https://github.com/scality/Zenko/actions/runs/7209077500
https://github.com/scality/Zenko/actions/runs/7209082617

@benzekrimaha benzekrimaha force-pushed the improvement/CLDSRV-431-misc-api-implicitDeny branch from f545cc1 to c65aefb Compare December 8, 2023 13:26
Comment on lines 1152 to 1153
// eslint-disable-next-line no-param-reassign
request.actionImplicitDenies = false;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be done in the _normalizeBackbeatRequest function:

function _normalizeBackbeatRequest(req) {

@@ -22,10 +22,11 @@ function abortMultipartUpload(authInfo, bucketName, objectKey, uploadId, log,
// but the requestType is the more general 'objectDelete'
const metadataValParams = Object.assign({}, metadataValMPUparams);
metadataValParams.requestType = 'objectPut';
const authzIdentityResult = request ? request.actionImplicitDenies : true;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not useful anymore if we default to true (implicit deny) when the request is mising the property?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed even if it's not changing the behaviour setting it to false makes more sens , good catch

Comment on lines 317 to 322
const actionImplicitDenies = authorizationResults.reduce((acc, curr, idx) => {
const apiMethod = requestContextParams[idx].apiMethod;
return Object.assign({}, acc, { [apiMethod]: curr.isImplicit });
}, {});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as in other PR here to optimize the logic and avoid re-creating objects

log,
request);

return cb(areAllActionsAllowed ? null : errors.AccessDenied);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was from the PoC but I would suggest being very strict on the check:

Suggested change
return cb(areAllActionsAllowed ? null : errors.AccessDenied);
return cb(areAllActionsAllowed === true ? null : errors.AccessDenied);

@benzekrimaha benzekrimaha force-pushed the improvement/CLDSRV-430-delete-api-implicitDeny branch from 76b8d1f to 74425d0 Compare December 8, 2023 17:29
Base automatically changed from improvement/CLDSRV-430-delete-api-implicitDeny to development/7.10 December 11, 2023 07:53
@bert-e
Copy link
Contributor

bert-e commented Dec 11, 2023

Hello benzekrimaha,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Status report is not available.

@scality scality deleted a comment from bert-e Dec 11, 2023
@benzekrimaha
Copy link
Contributor Author

ping

@bert-e
Copy link
Contributor

bert-e commented Dec 11, 2023

Incorrect fix version

The Fix Version/s in issue CLDSRV-431 contains:

  • 7.70.35

Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:

  • 7.10.38

  • 7.70.35

  • 8.6.16

  • 8.7.36

  • 8.8.10

Please check the Fix Version/s of CLDSRV-431, or the target
branch of this pull request.

@benzekrimaha
Copy link
Contributor Author

ping

@bert-e
Copy link
Contributor

bert-e commented Dec 11, 2023

Request integration branches

Waiting for integration branch creation to be requested by the user.

To request integration branches, please comment on this pull request with the following command:

/create_integration_branches

Alternatively, the /approve and /create_pull_requests commands will automatically
create the integration branches.

@benzekrimaha benzekrimaha changed the base branch from development/7.10 to improvement/CLDSRV-474-fix-multiObjectDelete-api-aut December 12, 2023 15:13
@benzekrimaha benzekrimaha force-pushed the improvement/CLDSRV-431-misc-api-implicitDeny branch 2 times, most recently from 98e5efd to 55d741c Compare December 12, 2023 17:53
Base automatically changed from improvement/CLDSRV-474-fix-multiObjectDelete-api-aut to development/7.10 December 13, 2023 07:44
@benzekrimaha benzekrimaha force-pushed the improvement/CLDSRV-431-misc-api-implicitDeny branch from 304181e to 4897b3c Compare December 13, 2023 10:14
@benzekrimaha benzekrimaha force-pushed the improvement/CLDSRV-431-misc-api-implicitDeny branch from ab42bc4 to dc39b37 Compare December 14, 2023 11:22
@benzekrimaha
Copy link
Contributor Author

/create_integration_branches

@bert-e
Copy link
Contributor

bert-e commented Dec 14, 2023

Conflict

A conflict has been raised during the creation of
integration branch w/7.70/improvement/CLDSRV-431-misc-api-implicitDeny with contents from improvement/CLDSRV-431-misc-api-implicitDeny
and development/7.70.

I have not created the integration branch.

Here are the steps to resolve this conflict:

 $ git fetch
 $ git checkout -B w/7.70/improvement/CLDSRV-431-misc-api-implicitDeny origin/development/7.70
 $ git merge origin/improvement/CLDSRV-431-misc-api-implicitDeny
 $ # <intense conflict resolution>
 $ git commit
 $ git push -u origin w/7.70/improvement/CLDSRV-431-misc-api-implicitDeny

The following options are set: create_integration_branches

@benzekrimaha
Copy link
Contributor Author

ping

@bert-e
Copy link
Contributor

bert-e commented Dec 14, 2023

Conflict

A conflict has been raised during the creation of
integration branch w/8.6/improvement/CLDSRV-431-misc-api-implicitDeny with contents from w/7.70/improvement/CLDSRV-431-misc-api-implicitDeny
and development/8.6.

I have not created the integration branch.

Here are the steps to resolve this conflict:

 $ git fetch
 $ git checkout -B w/8.6/improvement/CLDSRV-431-misc-api-implicitDeny origin/development/8.6
 $ git merge origin/w/7.70/improvement/CLDSRV-431-misc-api-implicitDeny
 $ # <intense conflict resolution>
 $ git commit
 $ git push -u origin w/8.6/improvement/CLDSRV-431-misc-api-implicitDeny

The following options are set: create_integration_branches

@benzekrimaha
Copy link
Contributor Author

ping

@bert-e
Copy link
Contributor

bert-e commented Dec 14, 2023

Conflict

A conflict has been raised during the creation of
integration branch w/8.7/improvement/CLDSRV-431-misc-api-implicitDeny with contents from w/8.6/improvement/CLDSRV-431-misc-api-implicitDeny
and development/8.7.

I have not created the integration branch.

Here are the steps to resolve this conflict:

 $ git fetch
 $ git checkout -B w/8.7/improvement/CLDSRV-431-misc-api-implicitDeny origin/development/8.7
 $ git merge origin/w/8.6/improvement/CLDSRV-431-misc-api-implicitDeny
 $ # <intense conflict resolution>
 $ git commit
 $ git push -u origin w/8.7/improvement/CLDSRV-431-misc-api-implicitDeny

The following options are set: create_integration_branches

@benzekrimaha
Copy link
Contributor Author

ping

@bert-e
Copy link
Contributor

bert-e commented Dec 14, 2023

Conflict

A conflict has been raised during the creation of
integration branch w/8.8/improvement/CLDSRV-431-misc-api-implicitDeny with contents from w/8.7/improvement/CLDSRV-431-misc-api-implicitDeny
and development/8.8.

I have not created the integration branch.

Here are the steps to resolve this conflict:

 $ git fetch
 $ git checkout -B w/8.8/improvement/CLDSRV-431-misc-api-implicitDeny origin/development/8.8
 $ git merge origin/w/8.7/improvement/CLDSRV-431-misc-api-implicitDeny
 $ # <intense conflict resolution>
 $ git commit
 $ git push -u origin w/8.8/improvement/CLDSRV-431-misc-api-implicitDeny

The following options are set: create_integration_branches

@benzekrimaha
Copy link
Contributor Author

/create_pull_requests

@bert-e
Copy link
Contributor

bert-e commented Dec 14, 2023

Integration data created

I have created the integration data for the additional destination branches.

The following branches will NOT be impacted:

  • development/7.4

Follow integration pull requests if you would like to be notified of
build statuses by email.

The following options are set: create_pull_requests, create_integration_branches

@bert-e
Copy link
Contributor

bert-e commented Dec 14, 2023

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • 2 peers

The following options are set: create_pull_requests, create_integration_branches

Copy link
Contributor

@anurag4DSB anurag4DSB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this PR with E2E tests
LGTM
I was closely following there branch and code changes before the PR was opened, hence review was quick.
Integration PR: https://github.com/scality/Integration/pull/1215

@benzekrimaha
Copy link
Contributor Author

@bert-e approve

@bert-e
Copy link
Contributor

bert-e commented Dec 14, 2023

In the queue

The changeset has received all authorizations and has been added to the
relevant queue(s). The queue(s) will be merged in the target development
branch(es) as soon as builds have passed.

The changeset will be merged in:

  • ✔️ development/7.10

  • ✔️ development/7.70

  • ✔️ development/8.6

  • ✔️ development/8.7

  • ✔️ development/8.8

The following branches will NOT be impacted:

  • development/7.4

There is no action required on your side. You will be notified here once
the changeset has been merged. In the unlikely event that the changeset
fails permanently on the queue, a member of the admin team will
contact you to help resolve the matter.

IMPORTANT

Please do not attempt to modify this pull request.

  • Any commit you add on the source branch will trigger a new cycle after the
    current queue is merged.
  • Any commit you add on one of the integration branches will be lost.

If you need this pull request to be removed from the queue, please contact a
member of the admin team now.

The following options are set: approve, create_pull_requests, create_integration_branches

@bert-e
Copy link
Contributor

bert-e commented Dec 14, 2023

I have successfully merged the changeset of this pull request
into targetted development branches:

  • ✔️ development/7.10

  • ✔️ development/7.70

  • ✔️ development/8.6

  • ✔️ development/8.7

  • ✔️ development/8.8

The following branches have NOT changed:

  • development/7.4

Please check the status of the associated issue CLDSRV-431.

Goodbye benzekrimaha.

@bert-e bert-e merged commit cdcdf8e into development/7.10 Dec 14, 2023
13 checks passed
@bert-e bert-e deleted the improvement/CLDSRV-431-misc-api-implicitDeny branch December 14, 2023 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants