Skip to content
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

workflows/ci: fix template-injection zizmor findings #195318

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
id: generate-matrix
env:
INPUT_CASKS: ${{ github.event.inputs.casks }}
PULL_REQUEST_URL: ${{ github.event.pull_request.url }}
run: |
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]
then
Expand All @@ -68,7 +69,7 @@ jobs:
then
brew generate-cask-ci-matrix --syntax-only
else
brew generate-cask-ci-matrix --url "${{ github.event.pull_request.url }}"
brew generate-cask-ci-matrix --url "$PULL_REQUEST_URL"
fi

test:
Expand Down Expand Up @@ -179,24 +180,29 @@ jobs:
File.open(ENV.fetch("GITHUB_OUTPUT"), "a") do |f|
f.puts "manual_installer=#{JSON.generate(manual_installer)}"
f.puts "macos_requirement_satisfied=#{JSON.generate(macos_requirement_satisfied)}"
f.puts "cask_conflicts=#{JSON.generate(cask_conflicts)}"
f.puts "cask_dependencies=#{JSON.generate(cask_dependencies)}"
f.puts "formula_conflicts=#{JSON.generate(formula_conflicts)}"
f.puts "formula_dependencies=#{JSON.generate(formula_dependencies)}"
end

File.open(ENV.fetch("GITHUB_ENV"), "a") do |f|
f.puts "CASK_CONFLICTS=\"#{cask_conflicts&.join(" ")}\"" if cask_conflicts.present?
f.puts "CASK_DEPENDENCIES=\"#{cask_dependencies&.join(" ")}\"" if cask_dependencies.present?
f.puts "FORMULA_CONFLICTS=\"#{formula_conflicts&.join(" ")}\"" if formula_conflicts.present?
end
EOF
if: always() && steps.fetch.outcome == 'success' && matrix.cask

- name: Uninstall conflicting formulae
run: |
brew uninstall --formula ${{ join(fromJSON(steps.info.outputs.formula_conflicts), ' ') }}
if: always() && steps.info.outcome == 'success' && join(fromJSON(steps.info.outputs.formula_conflicts)) != ''
# shellcheck disable=SC2086
brew uninstall --formula $FORMULA_CONFLICTS
if: ${{ always() && steps.info.outcome == 'success' && env.FORMULA_CONFLICTS != '' }}
timeout-minutes: 30

- name: Uninstall conflicting casks
run: |
brew uninstall --cask ${{ join(fromJSON(steps.info.outputs.cask_conflicts), ' ') }}
if: always() && steps.info.outcome == 'success' && join(fromJSON(steps.info.outputs.cask_conflicts)) != ''
# shellcheck disable=SC2086
brew uninstall --cask $CASK_CONFLICTS
if: ${{ always() && steps.info.outcome == 'success' && env.CASK_CONFLICTS != '' }}
timeout-minutes: 30

- name: Run brew uninstall --cask --force --zap ${{ matrix.cask.token }}
Expand All @@ -209,8 +215,10 @@ jobs:
id: snapshot
run: |
brew ruby -r "$(brew --repository homebrew/cask)/cmd/lib/check.rb" <<'EOF'
File.open(ENV.fetch("GITHUB_OUTPUT"), "a") do |f|
f.puts "before=#{JSON.generate(Check.all)}"
File.open(ENV.fetch("GITHUB_ENV"), "a") do |f|
# We have to use a `HOMEBREW_` prefix so it will survive the
# environment variable filtering in `brew`.
f.puts "HOMEBREW_SNAPSHOT_BEFORE=#{JSON.generate(Check.all)}"
end
EOF
if: always() && steps.info.outcome == 'success'
Expand All @@ -231,8 +239,9 @@ jobs:

- name: Uninstall cask dependencies
run: |
brew uninstall --cask ${{ join(fromJSON(steps.info.outputs.cask_dependencies), ' ') }}
if: always() && steps.install.outcome == 'success' && join(fromJSON(steps.info.outputs.cask_dependencies)) != ''
# shellcheck disable=SC2086
brew uninstall --cask $CASK_DEPENDENCIES
if: ${{ always() && steps.install.outcome == 'success' && env.CASK_DEPENDENCIES != '' }}
timeout-minutes: 30

- name: Compare installed and running apps and services with snapshot
Expand All @@ -241,9 +250,8 @@ jobs:
require "cask/cask_loader"
require "utils/github/actions"

before = JSON.parse(<<~'EOS').transform_keys(&:to_sym)
${{ steps.snapshot.outputs.before }}
EOS
before = JSON.parse(ENV.fetch("HOMEBREW_SNAPSHOT_BEFORE", "{}"))
.transform_keys(&:to_sym)
after = Check.all

cask = Cask::CaskLoader.load('${{ matrix.cask.path }}')
Expand Down
4 changes: 2 additions & 2 deletions Casks/f/foxit-pdf-editor.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cask "foxit-pdf-editor" do
version "13.1.4"
sha256 "8e8224eb384776f8032925de4bfec8094d80cbceddde3e24042e3d4c07862cf1"
version "13.1.5"
sha256 "238af81982bfd2284f2db93378822a25a588e7cb6fb3642d777c980dfc2df66c"

url "https://cdn01.foxitsoftware.com/pub/foxit/phantomPDF/desktop/mac/#{version.major}.x/#{version}/FoxitPDFEditor#{version.no_dots}.L10N.Setup.pkg",
verified: "cdn01.foxitsoftware.com/pub/foxit/phantomPDF/desktop/mac/"
Expand Down
Loading