Skip to content

Conversation

pre-commit-ci[bot]
Copy link
Contributor

@pre-commit-ci pre-commit-ci bot commented Jul 7, 2025

@weiji14 weiji14 added the run/test-gmt-dev Trigger the GMT Dev Tests workflow in PR label Jul 7, 2025
Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Involves security hardening related changes, so will merge on second approval.

-DCMAKE_INSTALL_PREFIX=%GMT_INSTALL_DIR% ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_PREFIX_PATH=${{ env.MAMBA_ROOT_PREFIX }}\envs\pygmt\Library ^
-DCMAKE_PREFIX_PATH=%MAMBA_ROOT_PREFIX%\envs\pygmt\Library ^
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zizmor was complaining that this line was vulnerable to code template injection:

help[template-injection]: code injection via template expansion
   --> .github/workflows/ci_tests_dev.yaml:134:37
    |
126 |         run: |
    |         --- help: this run block
127 |           cd gmt/
...
133 |             -DCMAKE_BUILD_TYPE=Release ^
134 |             -DCMAKE_PREFIX_PATH=${{ env.MAMBA_ROOT_PREFIX }}\envs\pygmt\Library ^
    |                                     --------------------- help: may expand into attacker-controllable code
    |
    = note: audit confidence → High
    = note: this finding has an auto-fix

The env.MAMBA_ROOT_PREFIX variable set in #2773 could simply be set as %MAMBA_ROOT_PREFIX% if I'm not mistaken, since we're not passing this variable via the env context, though it is set as MAMBA_ROOT_PREFIX: C:\Users\runneradmin\micromamba in https://github.com/GenericMappingTools/pygmt/actions/runs/16129619616/job/45514313791?pr=3991#step:8:18, probably from the setup-micromamba step?

Can you verify that this makes sense @seisman, given your comment on -DCMAKE_PREFIX_PATH at #2773 (comment)?

# Install Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v2.0.5
uses: mamba-org/setup-micromamba@b09ef9b599704322748535812ca03efb2625677b # v2.0.5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've used pinact to convert the tags to hash values, only for non-official GitHub Actions (i.e. actions/checkout still uses the tags). Let me know if you prefer to pin the hashes for the official GitHub Actions workflows too.

Copy link
Member

@seisman seisman Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you make the changes manually and do we have to update the hashes manually next time?

Copy link
Member

@weiji14 weiji14 Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I just ran pinact run, and it retrieved the hashes automatically.

Edit: There is also a verify option using pinact run --verify if you want to check that the hashes are ok.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant do we need to run pinact run manually next time?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no, we don't need to because dependabot can update the SHA hash, as well as the # vX.Y.Z version tag comment at the end, see dependabot/dependabot-core#4691

@seisman seisman merged commit c34259e into main Jul 8, 2025
27 of 29 checks passed
@seisman seisman deleted the pre-commit-ci-update-config branch July 8, 2025 16:25
@seisman seisman added this to the 0.17.0 milestone Jul 8, 2025
@seisman seisman added maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog and removed run/test-gmt-dev Trigger the GMT Dev Tests workflow in PR labels Jul 8, 2025
seisman pushed a commit that referenced this pull request Jul 16, 2025
* [pre-commit.ci] pre-commit autoupdate
* Pin GitHub Actions to full length commit SHA
* Set MAMBA_ROOT_PREFIX env var properly on Windows GMT build

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants