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

PublicAccessBlock Support #8571

Merged

Conversation

tangledbytes
Copy link
Member

@tangledbytes tangledbytes commented Dec 3, 2024

Explain the changes

This PR attempts to add basic support for PublicAccessBlock.

Issues: Fixed #xxx / Gap #xxx

  1. https://issues.redhat.com/browse/RHSTOR-6623

Testing Instructions:

  1. ./node_modules/.bin/jest src/test/unit_tests/jest_tests/test_s3_utils.test.js
  2. ./node_modules/.bin/mocha src/test/unit_tests/test_public_access_block.js
  3. NC_CORETEST=true NC_NSFS_NO_DB_ENV=true ./node_modules/.bin/mocha src/test/unit_tests/test_public_access_block.js
  • Doc added/updated
  • Tests added

@tangledbytes tangledbytes changed the title PublicAccess Support PublicAccessBlock Support Dec 3, 2024
@tangledbytes tangledbytes force-pushed the utkarsh/feat/public-access-block branch from f9f367e to f26335e Compare December 5, 2024 03:30
@tangledbytes tangledbytes force-pushed the utkarsh/feat/public-access-block branch from f26335e to 0144b3b Compare January 10, 2025 16:56
@tangledbytes tangledbytes marked this pull request as ready for review January 10, 2025 16:56
@jackyalbo
Copy link
Contributor

@tangledbytes Can we add tests here? I can also see ceph s3-tests have some tests regarding this feature - maybe also we can add those.
Also, some more information about this feature can be added to the PR explanation.

Copy link
Contributor

@jackyalbo jackyalbo left a comment

Choose a reason for hiding this comment

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

In general looks ok to me, maybe also ask someone from nc to take a look.
adding tests will be very valuable here.

@@ -168,14 +173,19 @@ function _is_action_fit(method, statement) {
return statement.Action ? action_fit : !action_fit;
}

function _is_principal_fit(account, statement) {
function _is_principal_fit(account, statement, ignore_anon_principal = false) {
Copy link
Contributor

@jackyalbo jackyalbo Mar 5, 2025

Choose a reason for hiding this comment

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

why not call it "disallow_public_access" as in the earlier parts of the flow? I think this name is more clear; we know why we should ignore the fit.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually it seems semantically different. _is_principal_fit shouldn't really be concerned disallow_public_access as it seems a higher level construct. That's why even in invocation I used the keyword disallow_public_access however in definition I used ignore_anon_principal.

I can change it though if it seems confusing to follow (easily readable code is I think more important than my "semantically better" code).

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm just not sure I fully get the flow. If we want to disallow public access. Shouldn't we have it only for Allow statement and not for Deny? It seems to me that we should not ignore a fit in case of a Deny statement.
Also, If the issue is with semantics, we need a better name for this as * is not just for anonymous principals it is for any principal.
Maybe some more comments in this area will be good to make me and future code readers better understand its use.

Copy link
Contributor

@jackyalbo jackyalbo Mar 18, 2025

Choose a reason for hiding this comment

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

@tangledbytes is this relevant also for deny? no response to my previous comment

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah! I am actually sorry. I actually thought that I responded here but turns out I forgot. Yes, you are right, I should not ignore it in case of DENY.

Also yes, it sounds right that anon isn't the right word. I will replace it with public_principla? How's that?

Again. apologies, missed this 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM, I will approve

@tangledbytes tangledbytes force-pushed the utkarsh/feat/public-access-block branch from 0144b3b to b1e0df2 Compare March 11, 2025 14:18
@tangledbytes tangledbytes force-pushed the utkarsh/feat/public-access-block branch from b1e0df2 to 882f83e Compare March 11, 2025 17:09
@tangledbytes tangledbytes requested a review from jackyalbo March 12, 2025 05:04
@tangledbytes tangledbytes force-pushed the utkarsh/feat/public-access-block branch 2 times, most recently from df1bf16 to 6f9f7ef Compare March 19, 2025 17:53
Signed-off-by: Utkarsh Srivastava <[email protected]>

Complete BlockPublicAccess integration

Signed-off-by: Utkarsh Srivastava <[email protected]>

add NC test for PublicAccessBlock

Signed-off-by: Utkarsh Srivastava <[email protected]>

dont check for disallow_public_access in DENY statements

Signed-off-by: Utkarsh Srivastava <[email protected]>
@tangledbytes tangledbytes force-pushed the utkarsh/feat/public-access-block branch from 6f9f7ef to 645c917 Compare March 20, 2025 13:02
@tangledbytes tangledbytes merged commit 5d9b4e5 into noobaa:master Mar 20, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants