Improve build_cts_json.yaml workflow security#105
Open
Marcono1234 wants to merge 1 commit intojsonpath-standard:mainfrom
Open
Improve build_cts_json.yaml workflow security#105Marcono1234 wants to merge 1 commit intojsonpath-standard:mainfrom
Marcono1234 wants to merge 1 commit intojsonpath-standard:mainfrom
Conversation
Limits the increased permissions to a dedicated job which runs only on push events. The previous implementation was already enough to protect against malicious PRs from forks. However, if Dependabot was used on the repository, it would have increased its default read-only permissions to write permissions, making it easier for compromised dependencies to directly affect the repository.
Contributor
Author
|
If you don't think this is worth it or needed, feel free to close this pull request. As mentioned above, the existing workflow should already be safe against malicious PRs from external forks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Limits the increased permissions to a dedicated job which runs only on push events to
main.The previous implementation was already enough to protect against malicious PRs from forks, see for example this run (not malicious), which only has
Contents: readas desired.However, if Dependabot was used on the repository (at some point in the future), it would have increased its default read-only permissions to write permissions, making it easier for compromised dependencies to directly affect the repository.
With the new changes an unprivileged job builds the
cts.jsonnow, and more privileged job pushes the changes, but only when running onmain. Thects.jsonfile is passed as artifact between the jobs (as described in the documentation).This should hopefully make it more secure.
Side note: These changes have the side effect that the modified
cts.jsonfile now also becomes available in the "Artifacts" section of runs (even for pull requests), see for example https://github.com/jsonpath-standard/jsonpath-compliance-test-suite/actions/runs/14638122807.