Guide
Scan your code in CI
Your own CI (the system that builds your code) runs open-source scanners, then uploads the results to Logthread. This page walks through the guided setup in the app: Code security → Code scans in CI. It takes about ten minutes.
For the technical reference (formats, parameters, limits), see Send scan results to Logthread. Overview: Code and app security.
Choose your CI#
Pick the system that builds your code. The app writes a ready pipeline file for each:
| CI | File it writes |
|---|---|
| GitHub Actions | .github/workflows/logthread-security.yml |
| GitLab CI | A job to add to .gitlab-ci.yml |
| Azure DevOps | azure-pipelines.yml |
| Jenkins | Jenkinsfile |
If your CI is not listed, use the Jenkins or GitHub file as a model. The upload is one curl command.
Choose your languages and scanners#
Pick what your repository contains. The app pre-selects the recommended scanners. You can change them.
| What you have | Recommended scanners | What they find |
|---|---|---|
| Any repository | Gitleaks | Leaked secrets: passwords, keys and tokens in the code |
| Any repository with lock files | OSV-Scanner, Trivy (dependencies) | Libraries with known vulnerabilities |
| Docker, Terraform, Kubernetes, CloudFormation | Trivy (config), Checkov | Unsafe cloud and container configuration (IaC) |
| Python | Bandit | Unsafe code patterns in Python |
| Go | gosec | Unsafe code patterns in Go |
| .NET | Security Code Scan (needs a solution file) | Unsafe code patterns in .NET |
| A list of everything you ship | Syft (SBOM) | A software bill of materials that Logthread matches against known advisories |
| A test or staging website | ZAP baseline | A passive scan of the running site (for the full managed option, see Scan your website and API (DAST)) |
| Android or iOS | mobsfscan (source) or MobSF (APK, AAB, IPA) | See Scan your mobile apps |
Choose also the service (the name your logs use for this application), and the build gate: the lowest severity of a NEW finding that fails the build. Critical is the default. See Gate builds on new findings.
Create the key#
The pipeline needs a key to upload results.
- In the guided setup, choose Create the key. It makes an API key with only the Upload scan results (
scans) scope. Like every API key, it also has the read scope, so it can read the workspace's data (findings, logs, remediation), but it cannot change anything other than uploading reports. Keep it in your CI system's secret store. - Copy the key now. It is shown once.
- Store it as a secret in your CI, never in the pipeline file:
- GitHub Actions: repository secret
LOGTHREAD_API_KEY - GitLab CI: masked CI/CD variable
LOGTHREAD_API_KEY - Azure DevOps: secret pipeline variable
LOGTHREAD_API_KEY - Jenkins: secret text credential
logthread-api-key
Only admins can create API keys. See Ingest keys and API keys.
Add the pipeline file#
- Copy the file the app shows.
- Add it to your repository, at the path shown, and commit it.
- Run the pipeline on your default branch (usually
main) first. That first run becomes the baseline. Pull requests are compared with it.
The pipeline runs each scanner from its pinned container image, uploads every report, and only at the end fails the build if any upload reports new findings at your chosen severity. The uploads need curl 7.87 or later, which the hosted runners of all four systems have.
Wait for the first results#
The last step of the guided setup shows Waiting for the first upload…. When your pipeline runs and the upload arrives, the page shows the result: how many findings, by severity, and a link to Findings. Nothing arrives until the pipeline has run once. Start it by hand if you do not want to wait for a commit.
Troubleshooting#
No upload arrives.
- Check the pipeline ran, and open its log. Look for the line
no <file>: the scanner wrote nothing. - Check
LOGTHREAD_API_KEYis set as a secret under exactly that name. A secret that is not set sends an empty key. - Pipelines for pull requests from forks usually cannot read secrets. Run them on branches of the same repository.
401 or 403 from the upload.
- 401 means the key is wrong, revoked or empty. Create a new key and replace the secret.
- 403
forbidden("This API key needs the scans scope") means the key does not have the Upload scan results (scans) scope. Create a new key with that scope. - 403
workspace_not_readymeans the workspace is still being set up: the owner has not verified their email yet. Verify it, then run the pipeline again.
413 too large (too_large). A report is at most 20 MB as sent. Exclude build folders, vendored code and test data from the scan, or scan with fewer scanners per report.
409, gate failed (gate_failed). This is not an error in the setup. The build failed on purpose, because the branch added new findings at or above your gate severity. The scan was still stored. Open Findings → Only new, fix them or set a status with a reason, or lower the gate. See Gate builds on new findings.
"The scanner wrote nothing". The scanner could not run or found nothing to read. Check that its image pulled, that the repository has files for that scanner (for example Security Code Scan needs a .sln file, OSV-Scanner needs lock files) and that Docker works on your runner.
Other errors. invalid_report means the file is not a format Logthread reads. kind_required means the tool covers several kinds, so add kind=. scan_quota (429) means the uploads per 24 hours for your plan are used.