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

fix: fix deny exception policy #272

Merged
merged 10 commits into from
Aug 28, 2024
Merged

fix: fix deny exception policy #272

merged 10 commits into from
Aug 28, 2024

Conversation

githubjianli
Copy link
Collaborator

@githubjianli githubjianli commented Aug 27, 2024

📝 Description

Fixed

  • Fixed schema deny exception policy.
  • Added apiary_governance_iamroles into deny exception policy.
  • Added new variable apiary_managed_service_iamroles to handle tagging service IAM roles in deny exception policy.
  • Added new variable system_schema_producer_iamroles to support system schema producer IAM roles.

🔗 Related Issues

@githubjianli githubjianli requested a review from a team as a code owner August 27, 2024 22:30
@@ -85,7 +85,36 @@
%{endif}
%{endfor ~}
%{endif}
%{if deny_global_write_access == "true" && producer_roles != "" }
%{if deny_exception_iamroles != "" }
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe roles have access by default if it is from the same account, right?

%{endif}
%{if length(var.system_schema_producer_iamroles) > 0}
{
"Sid": "system schema customer account permissions",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this section specifically for system bucket?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the producer iam role does not apply to system buckets and s3 access log, as well as s3 inventory buckets

@@ -26,8 +26,7 @@ locals {
governance_iamroles = join("\",\"", var.apiary_governance_iamroles)
consumer_prefix_roles = lookup(var.apiary_consumer_prefix_iamroles, schema["schema_name"], {})
common_producer_iamroles = join("\",\"", var.apiary_common_producer_iamroles)
deny_global_write_access = lookup(schema, "deny_global_write_access", var.deny_global_write_access)
producer_roles = lookup(schema, "producer_roles", var.producer_roles)
deny_exception_iamroles = lookup(schema, "deny_exception_iamroles", "") == "" ? "" : join("\",\"", compact(concat(split(",", schema["deny_exception_iamroles"]), var.apiary_managed_service_iamroles, var.apiary_governance_iamroles)))
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure about this anymore.

If you add apiary_governance_iamroles and apiary_managed_service_iamroles by default, this means that all buckets will restrict writing from now on. Because in many clauses deny_exception_iamroles != 0

Before, with my last update, only 1 bucket was affected, and the rest of buckets were with same functionality, but now with these changes, you are forcing all buckets to be restricted.

Is that correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nope, there is a condition, add it to default only when deny_exception_iamroles is not null, which mean you have deny exception defined. once you have it then add governace and egdl managed service roles as default.

@githubjianli githubjianli merged commit 4d6a9e1 into master Aug 28, 2024
2 checks passed
@githubjianli githubjianli deleted the fix/fix_deny_exception branch August 28, 2024 15:56
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.

4 participants