-
Notifications
You must be signed in to change notification settings - Fork 51
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
Add private key validation check for multiline string content #482
base: main
Are you sure you want to change the base?
Add private key validation check for multiline string content #482
Conversation
There is already a test for this case: https://github.com/reza-ebrahimi/auth-app.js/blob/pk_check_multiline_string/test/index.test.ts#L105 test("throws if incomplete Private Key is provided", async () => {
const auth = createAppAuth({
appId: APP_ID,
privateKey: "-----BEGIN RSA PRIVATE KEY-----",
});
await expect(auth({ type: "app" })).rejects.toEqual(
new Error(
"The 'privateKey` option contains only the first line '-----BEGIN RSA PRIVATE KEY-----'. If you are setting it using a `.env` file, make sure it is set on a single line with newlines replaced by '\n'"
)
);
}); |
Change the check logic from regex to a multi-step check function since the regex doesn't support some edge cases like |
Ha, what do you know 🤣 I think we should
Do you see any reason not to do it this way? |
@reza-ebrahimi I'd like to bring this up again. Do you have the inclination to make the fix in gr2m/universal-github-app-jwt? |
@kfcampbell I'm not working on this for a long time, feel free to push this code in gr2m/universal-github-app-jwt or close it. |
Add private key validation check for multi-line string content specifically when set using environment variables as multi-line string.
Discussion (Thanks to @gr2m ): gr2m/universal-github-app-jwt#71
Resolves #465 #71
Behavior
Before the change?
Failing due to passing multiline string to environment variables, See #465 (comment)
Pull request checklist
Does this introduce a breaking change?
Please see our docs on breaking changes to help!
Type: Breaking change
label)If
Yes
, what's the impact:Pull request type
Please add the corresponding label for change this PR introduces:
Type: Bug
Type: Feature
Type: Documentation
Type: Maintenance