Skip to main content

🧠 Google API Key is not restricted for unused APIs - prod.logic.yaml 🟒

Flags​

Input Type​

TypeAPI NameExtractsExtract FilesLogic Files
πŸ”’πŸ“• Google API KeyCA10G1__CaGoogleApiKey__c612

Uses​

Test Results πŸŸ’β€‹

Generated at: 2025-04-24T23:46:43.735542393Z Open

ResultIdCondition IndexCondition TextRuntime 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​

FileMD5
Open/ce/ca/google/api/api-key-for-application/policy.yaml134CEF9E73DD5B1270BC892064968F28
Open/ce/ca/google/api/api-key-for-application/prod.logic.yaml3DE7685CC67AA08E568334A5315B254F
Open/types/CA10G1__CaGoogleApiKey__c/object.extracts.yaml406AEFB1FA1BD7FD242EC239A00FF313
Open/ce/ca/google/api/api-key-for-application/test-data.json278C312A34C5F26A42DB149761BC8F6B

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​

Open File

---

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."