-
Notifications
You must be signed in to change notification settings - Fork 590
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(commonPipelineEnvironment): encrypt CPE (#4504)
* encrypt CPE - init * fix * disable encrypt on Jenkins * get PIPER_pipelineEnv_SECRET from vault * reuse artifactPrepareVersionOptions * encrypt only with orchestrator.GitHubActions * Workaround: orchestrators expect json * add encryptedCPE flag * remove JSON workaround * throw error if stepConfigPassword is empty * fix log messages --------- Co-authored-by: Egor Balakin <[email protected]>
- Loading branch information
Showing
3 changed files
with
155 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"strings" | ||
"testing" | ||
) | ||
|
||
func TestCpeEncryption(t *testing.T) { | ||
secret := []byte("testKey!") | ||
payload := []byte(strings.Repeat("testString", 100)) | ||
|
||
encrypted, err := encrypt(secret, payload) | ||
assert.NoError(t, err) | ||
assert.NotNil(t, encrypted) | ||
|
||
decrypted, err := decrypt(secret, encrypted) | ||
assert.NoError(t, err) | ||
assert.Equal(t, decrypted, payload) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters