Fix token permissions and pin dependencies #72
Merged
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.
Relevant issue: #65
Background info:
# any relevant background info for additional context, references to documentations etc.scorecardaction has flagged some unpinned dependencies and unset token permissions.codeql-actioninside thescorecard.ymlfile. We should add the commit hash with the action.zizmordocs here: https://docs.zizmor.sh/audits/#excessive-permissions, we have disabled all permissions at the workflow level. Permissions are defined at the individual job level. This helps in preserving the principle of least privilege.checkoutaction can be further hardened by settingpersist-credentialstofalse. Please refer to thezizmordocs here: https://docs.zizmor.sh/integrations/#via-zizmorcorezizmor-action.Dockerfilewhich were not pinned with a hash. One of them was the basepythonimage being used. We should add the hash digest along with the image.qualleimage that is generated after running theDockerfile. One approach would be to separate them out in arequirements.txtfile and add the hash provided byPyPIinside therequirements.txtfile. Unfortunately, this approach failed for a few reasons. Not all of the sub-dependencies of the required packages provide a pinned version. This is a strict requirement frompipif we are to run its hash checking mode. This could be resolved if add the flag--no-depswhen usingpipbut then we lose packages needed bypoetry. As a result the subsequentRUN poetry runcommands in theDockerfilefail. Trying to build the image locally failed continuously for all of the aforementioned options. Its best not to touch theDockerfileany further as there doesn't seem to be any straightforward way to install the packages with a pinned hash.Changes introduced:
# list changes to the code repo made in this pull requestcodeql-actionhas been pinned with its commit hash now.checkoutaction havepersist-credentialsset to false.pythonimage inside theDockerfilehas been updated totrixiefrombullseye. It is more recent and has fewer vulnerabilities. The hash digest is included as well. Thequalleimage was built locally and tested. It is working fine with the newtrixiebase image.