SAST Spotbugs ASDF_ASDF:_VERSION: invalid variable name
Summary
The GitLab Find Security Bugs analyzer v2.28.5 is producing an error (seen below) with the included SAST.gitlab-ci.yml
include:
-
template: SAST.gitlab-ci.yml
sast:
stage: sast
variables:
SAST_DEFAULT_ANALYZERS: "secrets,bandit"
SAST_DISABLE_DIND: "true"
SECURE_LOG_LEVEL: "debug"
SAST_JAVA_VERSION: 8
$ /analyzer run
[INFO] [Find Security Bugs] [2021-09-15T17:47:19Z] ▶ GitLab Find Security Bugs analyzer v2.28.5
[INFO] [Find Security Bugs] [2021-09-15T17:47:19Z] ▶ Detecting project
[INFO] [Find Security Bugs] [2021-09-15T17:47:19Z] ▶ Found project in /builds/path/to/project
[INFO] [Find Security Bugs] [2021-09-15T17:47:19Z] ▶ Running analyzer
[DEBU] [Find Security Bugs] [2021-09-15T17:47:19Z] ▶ /bin/bash -c source /root/.bashrc && switch_to java 8
/opt/asdf/lib/utils.bash: line 234: ASDF_ASDF: UNKNOWN SHIM JAVA_VERSION: invalid variable name
/opt/asdf/lib/utils.bash: line 234: ASDF_ASDF:_VERSION: invalid variable name
/opt/asdf/lib/utils.bash: line 234: ASDF_ASDF: UNKNOWN SHIM JAVA_VERSION: invalid variable name
No version set for command java
Consider adding one of the following versions in your config file at
asdf: unknown shim java
- The project does not have a custom .tool-versions file
- The
asdf listand.tools-versionsin the example case is the same as the default image - JAVA_VERSION is not manually set anywhere as a project or group level variable
- There seems to be a recent and relevant issue pertaining to ASDF here
- Relevant lines in the utils.bash: https://github.com/asdf-vm/asdf/blob/master/lib/utils.bash#L229-L236
Steps to reproduce
Not able to clearly reproduce.
Example Project
Example project in ZD Ticket https://gitlab.zendesk.com/agent/tickets/236548
What is the current bug behavior?
Running the Find Security Bugs analyzer results in a ASDF_ASDF:_VERSION: invalid variable name error and the job does not run.
What is the expected correct behavior?
The analyzer should run and the job should be successful.
Relevant logs and/or screenshots
Output of checks
This happens on GitLab.com 14.3.0-pre 9433aa72
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)(we will only investigate if the tests are passing)
Possible fixes
We are currently waiting on upstream updates from asdf on the overall fix, but pinning seems to work in the meantime:
Workaround: #341057 (comment 684521001)