π§ Google API Key is not restricted for unused APIs - prod.logic.yaml π’
- Contextual name: π§ prod.logic.yaml π’
- ID:
/ce/ca/google/api/api-key-for-application/prod.logic.yaml
- Located in: π Google API Key is not restricted for unused APIs π’
Flagsβ
- π’ Logic test success
- π’ Logic with extracts
- π’ Logic with test data
Input Typeβ
Type | API Name | Extracts | Extract Files | Logic Files | |
---|---|---|---|---|---|
π | π Google API Key | CA10G1__CaGoogleApiKey__c | 6 | 1 | 2 |
Usesβ
Test Results π’β
Generated at: 2025-04-24T23:46:43.735542393Z Open
Result | Id | Condition Index | Condition Text | Runtime Error |
---|---|---|---|---|
π’ | a0n11 | βοΈ 199 | βοΈ extract('CA10G1__restrictionsApiTargets__c').isEmpty() | βοΈ null |
π’ | a0n22 | βοΈ 299 | βοΈ extract('CA10G1__restrictionsApiTargets__c').contains('service: \'cloudapis.googleapis.com\'') | βοΈ null |
π’ | a0n33 | βοΈ 300 | βοΈ otherwise | βοΈ null |
Generationβ
File | MD5 | |
---|---|---|
Open | /ce/ca/google/api/api-key-for-application/policy.yaml | 134CEF9E73DD5B1270BC892064968F28 |
Open | /ce/ca/google/api/api-key-for-application/prod.logic.yaml | 3DE7685CC67AA08E568334A5315B254F |
Open | /types/CA10G1__CaGoogleApiKey__c/object.extracts.yaml | 406AEFB1FA1BD7FD242EC239A00FF313 |
Open | /ce/ca/google/api/api-key-for-application/test-data.json | 278C312A34C5F26A42DB149761BC8F6B |
Generate FULL scriptβ
java -jar repo-manager.jar policies generate FULL /ce/ca/google/api/api-key-for-application/prod.logic.yaml
Generate DEBUG scriptβ
java -jar repo-manager.jar policies generate DEBUG /ce/ca/google/api/api-key-for-application/prod.logic.yaml
Generate CAPTURE_TEST_DATA scriptβ
java -jar repo-manager.jar policies generate CAPTURE_TEST_DATA /ce/ca/google/api/api-key-for-application/prod.logic.yaml
Generate TESTS scriptβ
java -jar repo-manager.jar policies generate TESTS /ce/ca/google/api/api-key-for-application/prod.logic.yaml
Execute testsβ
java -jar repo-manager.jar policies test /ce/ca/google/api/api-key-for-application/prod.logic.yaml
Contentβ
---
inputType: "CA10G1__CaGoogleApiKey__c"
testData:
- file: test-data.json
importExtracts:
- file: /types/CA10G1__CaGoogleApiKey__c/object.extracts.yaml
conditions:
- status: "INCOMPLIANT"
currentStateMessage: "Key Restrictions section is empty."
remediationMessage: "Set API restrictions for the API Key."
check:
IS_EMPTY:
arg:
EXTRACT: CA10G1__restrictionsApiTargets__c
- status: "INCOMPLIANT"
currentStateMessage: "API Restrictions are set to Google Cloud APIs, this option allows access to all services offered by Google Cloud."
remediationMessage: "Set API Restrictions for the API Key."
check:
CONTAINS:
arg:
EXTRACT: CA10G1__restrictionsApiTargets__c
substring:
TEXT: "service: 'cloudapis.googleapis.com'"
otherwise:
status: "COMPLIANT"
currentStateMessage: "API Key should only be used for services where other authentication methods are unavailable."