Language: Terraform
Rules: S6302, S6400
SonarCloud, SonarLint IntelliJ Plugin 10.7.0.78874
resource "google_secret_manager_secret_iam_member" "secretAccessor" {
project = var.project_id
secret_id = var.secret_id
role = "roles/secretmanager.secretAccessor"
member = var.member
}
SonarCloud message: “Make sure it is safe to grant that member full access to the resource.”
This is a false positive because this resource does not grant full access. It’s a reader role and it’s granted on the lowest level possible (GCP Secret resource).
I suspect that regex patterns used for identifying “full access” roles are too broad:
private static final String SENSITIVE_ROLES = ".*(?:admin|manager|owner|superuser).*";
This matches “roles/secretmanager.secretAccessor” although this is not a manager role but a role related to GCP Sceret Manager.