Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container Analysis API need to be enabled wherever the Service Account is hosted #610

Open
CharmanderJieniJieni opened this issue Jul 28, 2021 · 4 comments

Comments

@CharmanderJieniJieni
Copy link

Our Service Account to run signer is hosted in project-a while our images are hosted in a GCR in project-b. We have given service account all required roles in project-b and enabled Container Analysis API in project-b

However, when we run the signer below is what it is complaining

main.go:191] Error waiting for vulnerability analysis it.Next: rpc error: code = PermissionDenied desc = Container Analysis API has not been used in project {project-a} before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/containeranalysis.googleapis.com/overview?project={project-a} then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

Why do we need to enable that in project-a as all activities happen in project-b?

@aysylu
Copy link
Contributor

aysylu commented Aug 3, 2021

I think it's because the metadata (Notes and Occurrences) are created in the same project as the signer. Could you please confirm this is the case @ooq?

@ooq
Copy link
Contributor

ooq commented Aug 3, 2021

It looks like the service account in project-a was not given permission to Container Analysis in project-b. Specifically, if you go to the tutorial:

# permission to view vulnerability and attestation occurrences
gcloud projects add-iam-policy-binding $PROJECT_ID \
  --member serviceAccount:${SA_NAME}@${PROJECT_ID}.iam.gserviceaccount.com \
  --role roles/containeranalysis.notes.occurrences.viewer

The first PROJECT_ID here should be project-b, and the second should be project-a. Have you tried that?

@CharmanderJieniJieni
Copy link
Author

@ooq Yes we already assigned all listed permission in project-b, however still needed to enable that api in project-a to get it work

@ooq
Copy link
Contributor

ooq commented Aug 3, 2021

@CharmanderJieniJieni You're right. Creating notes and attestations (occurrences) would require the Container Analysis API to be enabled in that project too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants