derrickaw commented on code in PR #41591:
URL: https://github.com/apache/beam/pull/41591#discussion_r4669829164


##########
infra/enforcement/account_keys.py:
##########
@@ -337,12 +341,11 @@
         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_secret_count = sum(1 for secret in managed_secrets if 
secret not in extracted_secrets)
+        if undeclared_secret_count:
+            msg = f"{undeclared_secret_count} managed secret(s) in Secret 
Manager are not declared in the service account keys file."
+            compliance_issues.append(msg)
+            self.logger.warning(msg)

Review Comment:
   Renamed the integer counter from `undeclared_secret_count` to 
`undeclared_count` so CodeQL's variable-name heuristic does not classify the 
integer count as sensitive secret material.



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