fabpot / local-php-security-checker

PHP security vulnerabilities checker

Home Page:https://github.com/FriendsOfPHP/security-advisories

Repository from Github https://github.comfabpot/local-php-security-checkerRepository from Github https://github.comfabpot/local-php-security-checker

/usr/local/bin/local-php-security-checker: cannot execute binary file: Exec format error

Garrcomm opened this issue · comments

Hi,

I used to use the composer package sensiolabs/security-checker but going to migrate to this version instead.
For my projects, I use Bitbucket Pipelines as CI, and a custom Docker container.

In my Docker file, I added:

RUN curl -L https://github.com/fabpot/local-php-security-checker/releases/download/v1.0.0/local-php-security-checker_1.0.0_linux_386 --output local-php-security-checker
RUN mv local-php-security-checker /usr/local/bin/local-php-security-checker && chmod 755 /usr/local/bin/local-php-security-checker

On my local machine (in the same Docker container), this works perfectly:

$ uname -a
Linux b0222c2ba17a 4.19.121-linuxkit #1 SMP Tue Dec 1 17:50:32 UTC 2020 x86_64 GNU/Linux
$ local-php-security-checker --help
Local PHP Security Checker 1.0.0, built at 2021-01-15T07:03:28Z

but in the CI, I get the following error:

$ uname -a
Linux cfa5b71e-b3aa-4362-a8b4-c83549ef393a-7xrjl 5.6.0 #1 SMP Thu Nov 12 07:09:22 UTC 2020 x86_64 GNU/Linux
$ local-php-security-checker
bash: /usr/local/bin/local-php-security-checker: cannot execute binary file: Exec format error

I checked and the conainer is still x86_64 so I think I should use the linux_386 build.

Any suggestion what's going wrong?

Could you try the linux_amd64 version instead?

Hmm, I'm having the same issue with linux_amd64 version in my docker environment.

Here is the part of this on my Dockerfile (and yes it's not so clean);

RUN curl -s https://api.github.com/repos/fabpot/local-php-security-checker/releases/latest | \
    grep -E "browser_download_url(.+)darwin_amd64" | \
    cut -d : -f 2,3 \
    | tr -d \" \
    | xargs -I{} wget -O local-php-security-checker {} \
    && mv local-php-security-checker /usr/bin/local-php-security-checker \
    && chmod +x /usr/bin/local-php-security-checker

And it seems that I need to use linux_386 with docker and not that linux_amd64 - I hope this will help someone.

@tarlepp If you replace the darwin_amd64 bit in the instruction with linux_amd64 or linux_386 you should be good to go.

Closing as this does not seem to be an issue in the code.