To reach a secret stored in GCP's Secret Manager I need a user with the permission todo that, like for instance a SA+roles/secretManages.Accessor. There's no other way we can access the secrets from secret manager. Right?
Is it safe to assume that giving a GCP default account the role above would be safe? projnumber-compute@developer.gserviceaccount.com - Compute Engine default service account
With the above I could potentially build an app to get the secret using the default account and then authenticate with the credential(pseudo-code):
project = "myproject"
# The lines below will use the default account
client = secretmanager.SecretManagerServiceClient()
request = {"name": f"projects/11111111/secrets/mysecret/versions/latest"}
response = client.access_secret_version(request)
payload = response.payload.data.decode("UTF-8")
json_acct_info = json.loads(payload)
# Then use the credential from another SA to authenticate and list buckets
credentials = service_account.Credentials.from_service_account_info(json_acct_info)
storage_client = storage.Client(credentials=credentials, project=project)
buckets = list(storage_client.list_buckets())
Is this safe? :-)