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

fix: add public key encryption to github secrets #1317

Closed

Conversation

gcbmykola
Copy link

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: #838

Signed-off-by: Mykola Kondratenko [email protected]

Summary

Ticket Link

Fixes

Release Note


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]>
@dlorenc
Copy link
Member

dlorenc commented Jan 15, 2022

cc @developer-guy can you take a look here?

@developer-guy
Copy link
Member

Not yet but it is on my list 😍 but I like the idea 👏👍

@github-actions
Copy link

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions
Copy link

This PR was closed because it has been stalled for 10 days with no activity.

@github-actions github-actions bot closed this Sep 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support GitHub and GitLab services for generate-key-pair
3 participants