forked from forgejo/forgejo
Backport #24745 by @wolfogre Fix #24721. Follow what GitHub does: - Don't trim spaces for secrets. - Newline should be `\n` instead of `\r\n`. Did some tests with: ```yaml name: secrets on: push jobs: show_secrets: runs-on: ubuntu-latest steps: - name: Dump secrets context run: echo '${{ toJSON(secrets) }}' | base64 ``` `AAAAAA`: ```text AAAAAA AAAAAA ``` `BBBBBB`: ```text BBBBBB BBBBBB ``` On GitHub: <img width="675" alt="image" src="0ec60652
-c2a3-47bb-9f9d-7e81665355a8"> On Gitea (before): <img width="673" alt="image" src="cce818bf
-5edc-4656-86e1-2c81c304cdb2"> On Gitea (after): <img width="673" alt="image" src="0b3b15af
-4d48-4bab-a334-4738a1b0eb4a"> Co-authored-by: Jason Song <i@wolfogre.com> (cherry picked from commite4f200e616
)
This commit is contained in:
parent
f37fba567a
commit
f6919e3e53
2 changed files with 11 additions and 2 deletions
|
@ -59,7 +59,7 @@ func newSecret(ownerID, repoID int64, name, data string) *Secret {
|
|||
|
||||
// InsertEncryptedSecret Creates, encrypts, and validates a new secret with yet unencrypted data and insert into database
|
||||
func InsertEncryptedSecret(ctx context.Context, ownerID, repoID int64, name, data string) (*Secret, error) {
|
||||
encrypted, err := secret_module.EncryptSecret(setting.SecretKey, strings.TrimSpace(data))
|
||||
encrypted, err := secret_module.EncryptSecret(setting.SecretKey, data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue