feature/11-support_notprincipal #12

Merged
dkirillov merged 1 commit from dkirillov/policy-engine:feature/11-support_notprincipal into master 2024-09-04 19:51:23 +00:00
Member

close #11

close #11
dkirillov self-assigned this 2023-10-30 13:36:08 +00:00
dkirillov requested review from storage-core-committers 2023-10-30 13:36:15 +00:00
dkirillov requested review from storage-core-developers 2023-10-30 13:36:15 +00:00
dkirillov requested review from storage-services-committers 2023-10-30 13:36:16 +00:00
dkirillov requested review from storage-services-developers 2023-10-30 13:36:16 +00:00
dstepanov-yadro reviewed 2023-10-31 17:01:35 +00:00
iam/converter.go Outdated
@ -72,2 +69,3 @@
var op policyengine.ConditionType
if _, ok := statement.Principal[Wildcard]; ok {
statementPrincipal, inverted := statement.principal()
if _, ok := statementPrincipal[Wildcard]; ok { // this can be true only if 'inverted' false

I didn't catch the thought. Please explain.

I didn't catch the thought. Please explain.
Author
Member

Only Principal can be *:

{
	"Statement": {
		"Principal": "*",
	}
}

The following json is invalid according to spec

{
	"Statement": {
		"NotPrincipal": "*",
	}
}
Only `Principal` can be `*`: ```json { "Statement": { "Principal": "*", } } ``` The following json is invalid according to [spec](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_notprincipal.html) ```json { "Statement": { "NotPrincipal": "*", } } ```
dstepanov-yadro marked this conversation as resolved
aarifullin reviewed 2023-10-31 20:15:36 +00:00
chain.go Outdated
@ -86,0 +128,4 @@
case CondNumericGreaterThanEquals:
return "NumericGreaterThanEquals"
default:
return "unknown condition type"
Member

Didn't you consdier to panic here? I am afraid that this can be taken for fine invocation and may cause many problems for the side that invokes this convertation

Didn't you consdier to _panic_ here? I am afraid that this can be taken for fine invocation and may cause many problems for the side that invokes this convertation
Author
Member

I supposed in our case it's enough to have panic here

I supposed in our case it's enough to have panic [here](https://git.frostfs.info/dkirillov/policy-engine/src/commit/08deadaa4cae569609540c58491ddb3d47d76922/chain.go#L148)
aarifullin marked this conversation as resolved
aarifullin reviewed 2023-10-31 20:47:39 +00:00
iam/policy.go Outdated
@ -178,0 +229,4 @@
if len(statement.Action) != 0 && len(statement.NotAction) != 0 {
return errors.New("'Actions' and 'NotAction' are mutually exclusive")
}
if len(statement.Resource) != 0 && len(statement.NotResource) != 0 {
Member

It is good that you intend to check mutual exclusion of these fields and this semantically correct but:

  1. I would insist on statement.Resource != nil check instead length checking. If these types weren't be slices or maps you would define a pointer to a type and use check for nil-ness
  2. Is it right that "one of" must surely defined? Are there situtation when neither "Resource" nor "NotResource" are defined?
It is good that you intend to check mutual exclusion of these fields and this semantically correct but: 1. I would insist on `statement.Resource != nil` check instead length checking. If these types weren't be slices or maps you would define a pointer to a type and use check for `nil`-ness 2. Is it right that "one of" must surely defined? Are there situtation when neither "Resource" nor "NotResource" are defined?
Author
Member
  1. Ok, I'll fix this
  2. Yes. No, there isn't such situation
1. Ok, I'll fix this 2. Yes. No, there isn't such situation
aarifullin marked this conversation as resolved
dkirillov force-pushed feature/11-support_notprincipal from 08deadaa4c to 2e66408638 2023-11-02 06:45:00 +00:00 Compare
dkirillov force-pushed feature/11-support_notprincipal from 2e66408638 to 29b40b02cb 2023-11-02 07:50:52 +00:00 Compare
dkirillov force-pushed feature/11-support_notprincipal from 29b40b02cb to a0017c205f 2023-11-02 07:52:26 +00:00 Compare
dkirillov force-pushed feature/11-support_notprincipal from a0017c205f to c3bbe0263f 2023-11-02 09:25:06 +00:00 Compare
dkirillov force-pushed feature/11-support_notprincipal from c3bbe0263f to 63ecf63a08 2023-11-02 11:56:05 +00:00 Compare
dstepanov-yadro approved these changes 2023-11-02 13:58:50 +00:00
fyrchik approved these changes 2023-11-07 11:43:44 +00:00
dkirillov merged commit 63ecf63a08 into master 2023-11-07 11:50:54 +00:00
dkirillov deleted branch feature/11-support_notprincipal 2023-11-07 11:50:55 +00:00
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-core-developers
TrueCloudLab/storage-services-committers
TrueCloudLab/storage-services-developers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/policy-engine#12
No description provided.