cosign icon indicating copy to clipboard operation
cosign copied to clipboard

Missing visibility body parameter when creating organization secrets

Open mark-trellix opened this issue 1 year ago • 1 comments

Attempted to generate a key pair for GitHub (self-hosted enterprise) organization and resulted in a error 422 Invalid request

After attempting to generate keys with the GitHub organization method/option:

export GITHUB_HOST="<ENTERPRISE_GITHUB>"
export GITHUB_TOKEN="github_pat_xxxxxxxxxxxxxx"
cosign generate-key-pair github://<ORG>

The following error occurs:

Error: could not create "COSIGN_PASSWORD" github actions secret: PUT https://<ENTERPRISE_GITHUB>/api/v3/orgs/<ORG>/actions/secrets/COSIGN_PASSWORD: 422 Invalid request.

"visibility" wasn't supplied. []
main.go:74: error during command execution: could not create "COSIGN_PASSWORD" github actions secret: PUT https://<ENTERPRISE_GITHUB>/api/v3/orgs/<ORG>/actions/secrets/COSIGN_PASSWORD: 422 Invalid request.

"visibility" wasn't supplied. []

It appears that possibly the required request body parameter visibility is missing when making the create organization secret request as noted in the GitHub docs create-or-update-an-organization-secret

The docs specify that visibility should either be all, private, or selected. I believe ours is set to private for our case, but in this case there is not even a default selected.

Bug: missing visibility body parameter when creating organization secrets.

Related Issue: #3566
Related PR: #3567

Version

GitVersion: v2.2.4 GitCommit: fb651b4ddd8176bd81756fca2d988dd8611f514d GitTreeState: clean BuildDate: 2024-04-10T21:57:27Z GoVersion: go1.21.8 Compiler: gc Platform: linux/amd64

mark-trellix avatar Jul 11 '24 06:07 mark-trellix