π§ Google IAM Roles related to KMS are not assigned to separate users - prod.logic.yaml π’
- Contextual name: π§ prod.logic.yaml π’
- ID:
/ce/ca/google/iam/kms-related-roles-to-users/prod.logic.yaml
- Located in: π Google IAM Roles related to KMS are not assigned to separate users π’
Flagsβ
- π’ Logic test success
- π’ Logic with extracts
- π’ Logic with test data
Input Typeβ
Type | API Name | Extracts | Extract Files | Logic Files | |
---|---|---|---|---|---|
π | π Google User | CA10G1__CaGoogleUser__c | 2 |
Usesβ
- π Google IAM Policy Binding - object.extracts.yaml
- π Google IAM Role - object.extracts.yaml
- π§ͺ test-data.json
Test Results π’β
Generated at: 2025-04-24T23:47:01.353215604Z Open
Result | Id | Condition Index | Condition Text | Runtime Error |
---|---|---|---|---|
π’ | INCO001 | βοΈ 299 | βοΈ CA10G1__Google_IAM_Policy_Bindings__r.has(INCOMPLIANT) | βοΈ null |
π’ | CO001 | βοΈ 300 | βοΈ otherwise | βοΈ null |
π’ | aUNVI001 | βοΈ 199 | βοΈ not(CA10G1__Google_IAM_Policy_Bindings__r.has(INAPPLICABLE)) | βοΈ null |
Generationβ
File | MD5 | |
---|---|---|
Open | /ce/ca/google/iam/kms-related-roles-to-users/policy.yaml | AE40BF84A03BF1B4FF2185420CEAC8F9 |
Open | /ce/ca/google/iam/kms-related-roles-to-users/prod.logic.yaml | B508D4F92E36DE62F7469054BB464749 |
Open | /ce/ca/google/iam/kms-related-roles-to-users/test-data.json | C48A1F22E160DD43A7A187B3CC2019AF |
Open | /types/CA10__CaGoogleIamPolicyBinding__c/object.extracts.yaml | DA65DB880E2440923287921FF4E70B30 |
Open | /types/CA10__CaGoogleIamRole__c/object.extracts.yaml | 545CD4D347F041DCDD9980D122D63882 |
Generate FULL scriptβ
java -jar repo-manager.jar policies generate FULL /ce/ca/google/iam/kms-related-roles-to-users/prod.logic.yaml
Generate DEBUG scriptβ
java -jar repo-manager.jar policies generate DEBUG /ce/ca/google/iam/kms-related-roles-to-users/prod.logic.yaml
Generate CAPTURE_TEST_DATA scriptβ
java -jar repo-manager.jar policies generate CAPTURE_TEST_DATA /ce/ca/google/iam/kms-related-roles-to-users/prod.logic.yaml
Generate TESTS scriptβ
java -jar repo-manager.jar policies generate TESTS /ce/ca/google/iam/kms-related-roles-to-users/prod.logic.yaml
Execute testsβ
java -jar repo-manager.jar policies test /ce/ca/google/iam/kms-related-roles-to-users/prod.logic.yaml
Contentβ
---
inputType: "CA10G1__CaGoogleUser__c"
testData:
- file: test-data.json
conditions:
- status: "INAPPLICABLE"
currentStateMessage: "Only for Cloud KMS Admin Users"
check:
NOT:
arg:
RELATED_LIST_HAS:
status: "INAPPLICABLE"
relationshipName: "CA10G1__Google_IAM_Policy_Bindings__r"
- status: "INCOMPLIANT"
currentStateMessage: "User has 'Cloud KMS Admin' and Cloud KMS CryptoKey Encrypter or Decrypter roles assigned at the same time."
remediationMessage: "Remove an extra role from the user."
check:
RELATED_LIST_HAS:
status: "INCOMPLIANT"
relationshipName: "CA10G1__Google_IAM_Policy_Bindings__r"
otherwise:
status: "COMPLIANT"
currentStateMessage: "The principle of 'Separation of Duties' is enforced."
relatedLists:
- relationshipName: "CA10G1__Google_IAM_Policy_Bindings__r"
importExtracts:
- file: "/types/CA10__CaGoogleIamPolicyBinding__c/object.extracts.yaml"
- file: /types/CA10__CaGoogleIamRole__c/object.extracts.yaml
recordTypes:
- "caGoogleIamPolicyBindingOrganization"
- "caGoogleIamPolicyBindingFolder"
- "caGoogleIamPolicyBindingProject"
conditions:
- status: "COMPLIANT"
currentStateMessage: "Empty policy binding"
check:
IS_EMPTY_LOOKUP: "CA10__iamRole__r"
- status: "INAPPLICABLE"
currentStateMessage: "User has a KMS Admin role assigned"
check:
IS_EQUAL:
left:
EXTRACT: "CA10__iamRole__r.CA10__roleName__c"
right:
TEXT: "roles/cloudkms.admin"
- status: "INCOMPLIANT"
currentStateMessage: "User has a KMS related role assigned"
check:
OR:
args:
- IS_EQUAL:
left:
EXTRACT: "CA10__iamRole__r.CA10__roleName__c"
right:
TEXT: "roles/cloudkms.cryptoKeyEncrypterDecrypter"
- IS_EQUAL:
left:
EXTRACT: "CA10__iamRole__r.CA10__roleName__c"
right:
TEXT: "roles/cloudkms.cryptoKeyEncrypter"
- IS_EQUAL:
left:
EXTRACT: "CA10__iamRole__r.CA10__roleName__c"
right:
TEXT: "roles/cloudkms.cryptoKeyDecrypter"
otherwise:
status: "COMPLIANT"
currentStateMessage: "User doesn't have a KMS related role assigned"