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

Support GitHub and GitLab services for generate-key-pair #838

Closed
Dentrax opened this issue Oct 4, 2021 · 2 comments · Fixed by #848
Closed

Support GitHub and GitLab services for generate-key-pair #838

Dentrax opened this issue Oct 4, 2021 · 2 comments · Fixed by #848
Labels
enhancement New feature or request

Comments

@Dentrax
Copy link
Member

Dentrax commented Oct 4, 2021

Description

Consider the following example:

$ cosign generate-key-pair -kms github://repository/project
$ cosign generate-key-pair -kms gitlab://repository/project

What these providers going to do is that simply calling secret API to create or update the generated private key in the secret variables. Something like: [UPSERT] /repos/:owner/:repo/actions/secrets into $COSIGN_PRIVATE_KEY variable.

GitHub: https://docs.github.com/en/rest/reference/actions#secrets
GitLab: https://docs.gitlab.com/ee/api/project_level_variables.html

P.S: I am not so sure if we should call GitHub and GitLab as a KMS provider. What about -git flag?

^ @developer-guy @erkanzileli 🤗

@Dentrax Dentrax added the enhancement New feature or request label Oct 4, 2021
@dlorenc
Copy link
Member

dlorenc commented Oct 4, 2021

I like it!

@hectorj2f
Copy link
Contributor

+1 😄

gcbmykola added a commit to gcbmykola/cosign that referenced this issue Jan 14, 2022
Current cosign github:// URI reference key generation feature
is not using the repository public key for secrets encryption.
The key reference is only added for Github secrets API request,
the actual secret is provisioned in clear text, is not encrypted
before it reaches the GitHub.

As a result, when the secret is decrypted when used in a codespace
(for example by Github Action) latter fails silently, and the
resulting secret value is empty.

Fix use libsodium sealed box to encrypt secrets before they reach
GitHub as per API guidelines.

Manual test:
Before fix
1) $cosign generate-key-pair github://[OWNER]/[PROJECT_NAME]
2) Run action that uses COSIGN_PASSWORD, COSIGN_PRIVATE_KEY secrets
Actual result
Secret sizes are equal to 0

After fix
1) $cosign generate-key-pair github://[OWNER]/[PROJECT_NAME]
2) Run action that uses COSIGN_PASSWORD, COSIGN_PRIVATE_KEY secrets
Actual result
Secret sizes are as provisioned by cosign

Fixes: sigstore#838

Signed-off-by: Mykola Kondratenko <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants