-
Notifications
You must be signed in to change notification settings - Fork 60k
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
Update generating-a-json-web-token-jwt-for-a-github-app.md #34134
Conversation
Updated formatting for payload JSON to return top-level JSON when decoded, as this was throwing an error for some users. Also removed "JWT: " from print line to avoid scripting conflicts.
Automatically generated comment ℹ️This comment is automatically generated and will be overwritten every time changes are committed to this branch. The table contains an overview of files in the Content directory changesYou may find it useful to copy this table into the pull request summary. There you can edit it to share links to important articles or changes and to give a high-level overview of how the changes in your pull request support the overall goals of the pull request.
fpt: Free, Pro, Team |
Thanks for fixing this! Great job! There seem to be some shellcheck warnings left: $ shellcheck bash.sh
In bash.sh line 5:
pem=$( cat $2 ) # file path of the private key as second argument
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
pem=$( cat "$2" ) # file path of the private key as second argument
In bash.sh line 8:
iat=$((${now} - 60)) # Issues 60 seconds in the past
^----^ SC2004 (style): $/${} is unnecessary on arithmetic variables.
In bash.sh line 9:
exp=$((${now} + 600)) # Expires 10 minutes in the future
^----^ SC2004 (style): $/${} is unnecessary on arithmetic variables.
In bash.sh line 30:
printf '%s\n' $JWT
^--^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
printf '%s\n' "$JWT"
For more information:
https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...
https://www.shellcheck.net/wiki/SC2004 -- $/${} is unnecessary on arithmeti... Maybe let's fix them also. |
@mark-mxwl Thanks so much for opening a PR! I'll get this triaged for review ✨ |
Thx for the ShellCheck output @lindhe! While those are all valid warnings, we don't really have to worry about globbing (wildcards)/splitting (tab, space, newline) on our positional parameters, due to the type of data we're passing through. The curly braces on the expressions are optional--I kept them there for the sake of consistency and readability. |
Hi, thanks for the update. I ran the updated script, removing the templating, and there still seems to be an issue with the
Removing the quotes in the script solves the issue for me. Interestingly, the same validation is not applied to the |
Converted `iat` and `exp` values from strings to integers.
Thanks for catching that @brakel. Interesting re: the behavior with |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
Thanks for opening a pull request! We've triaged this issue for technical review by a subject matter expert 👀 |
This comment was marked as spam.
This comment was marked as spam.
@mark-mxwl Apologies for the delay! We recently merged a PR that I believe resolves the issue this PR is attempting to fix. Many apologies for not being able to get to this sooner 💛 I'll go ahead and close out this PR, but please feel free to reopen / ping if needed! |
Np @nguyenalex836! Glad it got sorted. Appreciate the heads-up! 🙏 |
Why:
Closes: #33324
Closes: #33989
What's being changed (if available, include any code snippets, screenshots, or gifs):
Updated formatting for payload JSON to return top-level JSON when decoded, as the previous version was throwing an error for some users. Header JSON moved to single line to match payload. Also removed "JWT: " from print line to avoid scripting conflicts.
Check off the following:
I have reviewed my changes in staging, available via the View deployment link in this PR's timeline (this link will be available after opening the PR).
data
directory.For content changes, I have completed the self-review checklist.