github-actions[bot] commented on code in PR #41591:
URL: https://github.com/apache/beam/pull/41591#discussion_r4670454109


##########
infra/enforcement/account_keys.py:
##########
@@ -337,12 +341,11 @@ def check_compliance(self) -> List[str]:
         extracted_secrets = 
[f"{self._denormalize_account_email(account['account_id'])}-key" for account in 
file_service_accounts]
 
         # Check for managed secrets that are not declared
-        for secret in managed_secrets:
-            if secret not in extracted_secrets:
-                masked_secret = f"{secret[:4]}***{secret[-4:]}" if len(secret) 
>= 8 else "***"
-                msg = f"Managed secret '{masked_secret}' is not declared in 
the service account keys file."
-                compliance_issues.append(msg)
-                self.logger.warning(msg)
+        undeclared_count = sum(1 for item in managed_secrets if item not in 
extracted_secrets)
+        if undeclared_count:
+            msg = f"{undeclared_count} managed secret(s) in Secret Manager are 
not declared in the service account keys file."

Review Comment:
   **🟡 Medium**: `check_compliance()` output is used directly to populate 
policy drift announcements and GitHub issues (via `create_announcement`). 
Replacing per-secret messages with only an aggregate count (`undeclared_count`) 
means operators receiving the alert will no longer know which specific 
secret(s) in Secret Manager are undeclared without manually cross-referencing 
GCP Secret Manager against the YAML file.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to