-
Notifications
You must be signed in to change notification settings - Fork 556
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
encrypt values to create the github action secret #1990
Conversation
var peersPubKey [32]byte | ||
copy(peersPubKey[:], decodedPubKey[0:32]) | ||
|
||
var rand io.Reader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if just this is enough or we should create something else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually you want crypto/rand.Reader
https://pkg.go.dev/crypto/rand#pkg-variables
Codecov Report
@@ Coverage Diff @@
## main #1990 +/- ##
=======================================
Coverage 26.16% 26.16%
=======================================
Files 127 127
Lines 7422 7422
=======================================
Hits 1942 1942
Misses 5225 5225
Partials 255 255 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Can I ask for you to test with env:
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
in the CI test (instead of dumping to cosign.key
)?
var peersPubKey [32]byte | ||
copy(peersPubKey[:], decodedPubKey[0:32]) | ||
|
||
var rand io.Reader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually you want crypto/rand.Reader
https://pkg.go.dev/crypto/rand#pkg-variables
if err != nil { | ||
return nil, fmt.Errorf("failed to decode public key: %w", err) | ||
} | ||
var peersPubKey [32]byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the advantage of this extra variable? Maybe a comment explaining why we can't just use decodedPubKey
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i need to copy the 32 first and then pass that as a reference to the function, cannot use that straight
thanks for the review and feedback the job is not dumping the key, it actually using it, see /~https://github.com/cpanato/testing-ci-providers/blob/main/.github/workflows/cosign-key.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @cpanato for taking the responsibility 👍
Sorry, I was unclear. The motivation for pinging this bug was a workflow involving the |
ah, I see now I think that does not work now, but i can test and if that does not work, propose a fix UPDATE: - name: Build and sign a container image
env:
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
run: |
cosign sign --key env://COSIGN_PRIVATE_KEY ghcr.io/cpanato/testing-ci-providers/test:latest |
Signed-off-by: cpanato <ctadeu@gmail.com>
Signed-off-by: cpanato <ctadeu@gmail.com>
Signed-off-by: cpanato <ctadeu@gmail.com>
Signed-off-by: cpanato <ctadeu@gmail.com>
@znewman01 to get back to you |
gently ping to review @developer-guy @dlorenc |
Whoops, I guess that was never expected to work! Sorry for the confusion. And yes, such a PR would be great. |
Oh, actually @cpanato : the |
yep, i've made a comment in the PR for this exactly same thing :) |
Is this one ready to go? |
Summary
Running this patch in a repo
/~https://github.com/cpanato/testing-ci-providers/runs/6864530948?check_suite_focus=true
Ticket Link
Fixes #1431