Skip to content

[Schema Inaccuracy] Github Actions Creating or Updating repository secrets Rest API Issue | encrypted_value is not allowing all value #1688

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

Open
nrv-96 opened this issue Oct 17, 2022 · 4 comments

Comments

@nrv-96
Copy link

nrv-96 commented Oct 17, 2022

Powershell Code Which converted from Postman:

`$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Basic ")
$headers.Add("Content-Type", "application/json")

$body = "{
n "encrypted_value": "c2VjcmV50", n "key_id": ""
`n}"

$response = Invoke-RestMethod 'https://api.github.com/repos/owner/repo/actions/secrets/yfsf' -Method 'PUT' -Headers $headers -Body $body
$response | ConvertTo-Json`

Issue:

encrypted_value is allowing specific types of values : c2VjcmV0 , If I need to add value ( "encrypted_value": "ainsdr-34234vsdf-dfdf") which is getting error message for regex error { "message": "Invalid request.\n\nainsdr-34234vsdf-dfdf does not match /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{4})$/.", "documentation_url": "https://docs.github.com/rest/reference/actions#create-or-update-a-repository-secret" } instead of store my value.

Expectation :

encrypted_value should be allow any value, This is should be dynamic. I can add any value inside the block of encrypted_value .Also I can provide any value from UI which will be accepted but in rest API it's gives regex error. Please fix the issue.

Github Documents Link

https://docs.github.com/en/rest/actions/secrets#create-or-update-a-repository-secret

#1688 (comment)

@nrv-96 nrv-96 changed the title [Schema Inaccuracy] Creating or Updating repo secrets Rest API Issue | encrypted_value is not allowing all value [Schema Inaccuracy] Creating or Updating repository secrets Rest API Issue | encrypted_value is not allowing all value Oct 17, 2022
@nrv-96 nrv-96 changed the title [Schema Inaccuracy] Creating or Updating repository secrets Rest API Issue | encrypted_value is not allowing all value [Schema Inaccuracy] Github Actions Creating or Updating repository secrets Rest API Issue | encrypted_value is not allowing all value Oct 17, 2022
@nrv-96
Copy link
Author

nrv-96 commented Oct 17, 2022

@timrogers , Can you please help me to report this issue to Github team? , It would be greatly appreciate if do this.

@timrogers
Copy link
Contributor

@NIRAVJ96 Thanks for reaching out! Just to confirm, are you encrypting the value using the instructions at https://docs.github.com/en/rest/actions/secrets#create-or-update-a-repository-secret? We apply a regular expression in the API because a correct encrypted value must match this format.

@nrv-96
Copy link
Author

nrv-96 commented Oct 17, 2022

@timrogers , thanks for your response, I have seen the details. but can you please help me out for how to apply in Postman? , As I'm newbie here.

@timrogers
Copy link
Contributor

I'm not sure that it will be possible to encrypt the value from inside Postman. I think you will need to do the encryption outside (e.g. with the Node.js sample provided) and then copy the output into Postman.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants