`secretOrPrivateKey must be an asymmetric key when using RS256` error on Ubuntu 22.04
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 1.4k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 24
Description
Describe the bug
We have a GHA workflow that runs within an ubuntu:jammy-20230308 container. As part of its workflow it runs the tibdex/github-app-token Action from within the container.
When we upgraded the base docker image from ubuntu:focal-20220302 to ubuntu:jammy-20230308 the workflow immediately began failing with Error: secretOrPrivateKey must be an asymmetric key when using RS256 and no other output.
Reports on the internet seem to imply this issue is related to Ubuntu and is resolved by updating NodeJS.
To Reproduce
Minimal example workflow:
on:
push:
jobs:
example-issue:
runs-on: [self-hosted, generic-linux]
container:
image: ubuntu:jammy-20230308
steps:
# Set up a GitHub App with access to the same repo, copying and pasting the private key into a repo secret.
- name: Generate PAT using GHApp
uses: tibdex/github-app-token@v1
id: generate_token
with:
app_id: 123456
private_key: ${{ secrets.TOKENS_APP_KEY }}
Expected behavior
The action does not throw an error about being unable to parse the key secret.
Runner Version and Platform
- Runner version:
2.296.2(Corresponds to GHES 3.7.4) - Platform: Amazon Linux 2 (x64)
What's not working?
Reports imply that NodeJS 16:15.0 and lower cause this error. Reports imply at least 16.19.0 fixes this issue. It's unclear if the latest runner, using version 16.16.0, has this issue. We are working on getting a test runner set up to try it.
Job Log Output
When we enable debug logging we see:
##[debug]ID=ubuntu
##[debug]ID_LIKE=debian
##[debug]Running JavaScript Action with default external tool: node16
Error: Error: secretOrPrivateKey must be an asymmetric key when using RS256
##[debug]Node Action run completed with exit code 1
Suggested solution
Update NodeJS 16.X minor version to at least 16.19.0.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the minimal workflow in the ubuntu:jammy-20230308 container and inspect the runner's JavaScript Action path using the node16 external tool. Compare the bundled Node.js version with the reported 16.19.0 fix. Done means the action can parse the private key and the runner has regression coverage for this environment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, github-actions, node.js, ubuntu
- Domain
- ci-cd, devops, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100