gitleaks / gitleaks-action

Protect your secrets using Gitleaks-Action
https://gitleaks.io
Other
319 stars 122 forks source link

incorrectly constructed download URL for some architectures #122

Open bwhitehead0 opened 1 year ago

bwhitehead0 commented 1 year ago

running the gitleaks action on my self-hosted ARM7 runner fails:

log snippet:

2023-07-19T04:36:09.9024034Z [bwhitehead0] is an individual user. No license key is required.
2023-07-19T04:36:09.9048238Z gitleaks version: 8.12.0
2023-07-19T04:36:09.9086434Z Version to install: 8.12.0 (target directory: /tmp/gitleaks-8.12.0)
2023-07-19T04:36:10.6016829Z Downloading gitleaks from https://github.com/zricethezav/gitleaks/releases/download/v8.12.0/gitleaks_8.12.0_linux_arm.tar.gz
2023-07-19T04:36:11.0949685Z ##[error]could not install gitleaks from https://github.com/zricethezav/gitleaks/releases/download/v8.12.0/gitleaks_8.12.0_linux_arm.tar.gz, error: Error: Unexpected HTTP response: 404
2023-07-19T04:36:11.1353564Z /home/github-runner/actions-runner/_work/_actions/gitleaks/gitleaks-action/v2.3.2/dist/index.js:8612

in this case, it appears that this code block might need to be modified to account for ARM variants:

    const gitleaksReleaseURL = downloadURL(
      process.platform,
      process.arch,
      version
    );

i'm not very familiar w/ node, but it appears we need to do something similar to this comment to properly construct the download URL for some ARM variants, or, find another way to determine architecture type is ARM, then poll the OS thru node to determine if it's arm64, arm6, or arm7.

os.cpus() (model) should report the ARM version:

node -p "os.cpus()"    
[ { model: 'ARMv7 Processor rev 5 (v7l)',
    speed: 900,
    times:
     { user: 28061900,
       nice: 1726100,
       sys: 41051200,
       idle: 3227428,
       irq: 0 } },
...

wish i could offer more but node isn't my thing.

OdedRub commented 8 months ago

Having the same issue as well, on a Windows X64 self-hosted runner. The action does work on GitHub's ubuntu-latest and on my Linux self-hosted runner.