1. Add XEIZE_TOKEN
In Settings > CI/CD, add XEIZE_TOKEN as a CI/CD variable. This example posts merge request comments, so also add a GitLab personal access token with the api scope as XEIZE_GITLAB_API_TOKEN.
To share a token across projects, add it as a group variable.
.png)
.png)
2. Add the GitLab workflow
At the repository root, choose New file from the + menu and name the file .gitlab-ci.yml. If the file already exists, open it.
.png)
Paste the SAST configuration example into the new file, or incorporate it into your existing pipeline.
- To change the language of SAST, Secret, and IaC results, add
LANG: "EN"(English) orLANG: "JP"(Japanese) tovariables. An unset or unsupported value defaults to Korean. - For a Secret scan job, set
MODE: secretinvariables. - For a self-hosted runner, match the job’s
tagsto the runner’s tags.
Select Commit changes to save the pipeline configuration.
.png)
3. Verify with an MR
Clone the repository
Clone the repository containing the GitLab pipeline, using its actual URL in place of the example git clone https://gitlab.com/....
Create a branch
- Run
cd repositoryto enter the cloned directory, replacingrepositorywith its actual name. - Run
git checkout -b pr-testto create thepr-testbranch. - Create the following intentionally vulnerable files.
vuln_crypto.py
# Unsafe Crypto Algorithm + Hardcoded key
from Crypto.Cipher import DES
ENCRYPTION_KEY = b"weak_key"
cipher = DES.new(ENCRYPTION_KEY, DES.MODE_ECB)
vuln_exec.py
# Unsafe Flask RCE
from flask import Flask, request
app = Flask(__name__)
@app.route('/exec')
def unsafe_exec():
code = request.args.get('code')
eval(code)
return "Dangerous Code executed"
- Commit the changes and push the
pr-testbranch.
git add .
git commit -m "add tests"
git push origin pr-test
- Return to the project containing the GitLab workflow and select
New merge request.
.png)
Choose pr-test as the source branch and select the target branch. Select Compare branches and continue, complete the form, then select Create merge request.
.png)
- Once the pipeline finishes, look for the XEIZE findings in the merge request comments.
.png)
.png)