Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/gosec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
FOUND=$(jq '.Stats.found // 0' results.json)
echo "Gosec found $FOUND issue(s)"
if [ "$FOUND" -gt 0 ]; then
jq -r '.Issues[] |
"\n[\(.rule_id)] \(.severity) severity / \(.confidence) confidence\n\(.file):\(.line):\(.column)\n\(.details)\n\(.code)"' results.json
echo "❌ Security issues detected! Please fix them before merging."
exit 1
else
Expand Down
8 changes: 4 additions & 4 deletions docs/guides/gitlab.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,14 @@ statuses), and `--pipeline-source schedule` to select pipelines by source
is unchanged. Job-status values are validated by GitLab.

```bash
$ pipeleek gl scan --token glpat-[redacted] --url https://gitlab.example.com -c [gitlab session cookie]] -v -a -j 5 --confidence high-verified,high
$ pipeleek gl scan --token glpat-[redacted] --url https://gitlab.example.com -c [gitlab session cookie]] -v -a -j 5 --confidence verified,high
2024-09-26T13:47:09+02:00 debug Verbose log output enabled
2024-09-26T13:47:10+02:00 info Gitlab Version Check revision=2e166256199 version=17.5.0-pre
2024-09-26T13:47:10+02:00 debug Setting up queue on disk
2024-09-26T13:47:10+02:00 debug Using DB file file=file:///tmp/pipeleek-queue-db-60689531:?_journal=WAL&_timeout=5000&_fk=true
2024-09-26T13:47:10+02:00 debug Loading rules.yml from filesystem
2024-09-26T13:47:10+02:00 debug Applying confidence filter filter=high-verified,high
Comment thread
frjcomp marked this conversation as resolved.
2024-09-26T13:47:10+02:00 debug Loaded filtered rules count=882
2024-09-26T13:47:10+02:00 debug Loaded embedded and local rules count=15
2024-09-26T13:47:10+02:00 debug Loaded TruffleHog rules count=858
2024-09-26T13:47:10+02:00 debug Applying confidence filter filter=["verified","high"]
2024-09-26T13:47:10+02:00 info Fetching projects
2024-09-26T13:47:10+02:00 info Provided GitLab session cookie is valid
2024-09-26T13:47:15+02:00 debug Fetch Project jobs for url=https://gitlab.example.com/legendaryleo/WebRTC_Source
Expand Down
6 changes: 4 additions & 2 deletions docs/guides/scanning.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ pipeleek gl scan -u https://gitlab.com -t glpat-[redacted] --cookie [redacted] -
2025-09-30T09:53:37Z hit SECRET confidence=high type=artifact file=an_artifact.txt jobName=artifact-job ruleName="Generic - 1719" url=gitlab.com/testgroup/project/-/jobs/11484162833 value="datadog_api_key=secret_artifact_value "
```

As shown, Pipeleek can detect secrets in job logs and build artifacts using its YAML patterns, Betterleaks rules, and TruffleHog detectors. Security findings are logged at the custom `hit` level to distinguish them from regular warnings. Manually review the hits to verify if they're valid credentials. If you see `confidence=high-verified`, TruffleHog or Betterleaks confirmed the credential with its provider; enabling `--secrets-verification` can make outbound validation requests.
Findings use the `hit` log level. The sample output above uses additional YAML rules; your findings depend on the rules and credentials present. Review non-verified hits manually, or use `--confidence=verified` to show only successfully verified credentials. See [detection, verification, and rules](../introduction/secrets_verification.md) for reporting behavior and optional rule downloads.

Job-log (`type=log`) and artifact (`type=archive`) findings link to the job.

### Live Findings Web UI

Expand All @@ -45,7 +47,7 @@ pipeleek gl scan -u https://gitlab.com -t glpat-[redacted] --cookie [redacted] -
2026-10-01T11:50:13Z debug Searching for config file in standard locations
2026-10-01T11:50:13Z info Loaded config file file=/home/user/.config/pipeleek/pipeleek.yaml
2026-10-01T11:50:13Z info Findings web UI started token=[redacted] url=http://127.0.0.1:42957/?token=[redacted]
2026-10-01T11:50:13Z debug Loading rules.yml from filesystem
2026-10-01T11:50:13Z debug Loaded embedded and local rules count=15
```

The `Findings web UI started` message appears near the start of the scan. Use the URL from your own run; its port and token are generated dynamically.
Expand Down
15 changes: 12 additions & 3 deletions docs/introduction/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,23 @@ common:
threads: 2
secrets_verification: true
max_artifact_size: 100Mb
confidence_filter: medium # low, medium, high, high-verified
confidence_filter: [verified, high] # [] includes all; also medium, low, trufflehog, custom labels
hit_timeout: 120 # Seconds
webui: false # Serve a local authenticated findings UI during scans
```

`secrets_verification` replaces the deprecated `trufflehog_verification` key. The old key (and `PIPELEEK_COMMON_TRUFFLEHOG_VERIFICATION`) is still read, with a warning, when the new key is not set.
### Optional Rules Download

Override per-command:
Settings for [`pipeleek rules download`](secrets_verification.md#optional-external-rules-download):

```yaml
rules:
download:
output: rules.yml # --output; PIPELEEK_RULES_DOWNLOAD_OUTPUT
force: false # --force; PIPELEEK_RULES_DOWNLOAD_FORCE
```

### Per-command Overrides

```yaml
gitlab:
Expand Down
121 changes: 68 additions & 53 deletions docs/introduction/secrets_verification.md
Original file line number Diff line number Diff line change
@@ -1,98 +1,113 @@
---
title: Secret Verification with TruffleHog
description: Learn how Pipeleek uses TruffleHog to automatically verify detected secrets, understand confidence levels, and how to disable verification for operational security.
title: Secret Detection, Verification, and Rules
description: Understand Pipeleek's detection engines, confidence levels, custom rules, and optional rule downloads.
keywords:
- secret verification
- TruffleHog
- credential validation
- confidence levels
- high-verified
- verified
- secret detection
- credential testing
- opsec
---

Pipeleek uses [TruffleHog](https://github.com/trufflesecurity/trufflehog) and [Betterleaks](https://github.com/betterleaks/betterleaks) to detect secrets in CI/CD logs and artifacts. When verification is enabled, both engines can check supported credentials against their providers.
# Secret Detection, Verification, and Rules

### How It Works
Pipeleek scans CI/CD logs and artifacts using:

When Pipeleek scans logs or artifacts, it uses three detection sources:
- **YAML rules:** 15 embedded Pipeleek rules plus optional working-directory `rules.yml`.
- **[Betterleaks](https://github.com/betterleaks/betterleaks):** embedded rules with false-positive filtering.
- **[TruffleHog](https://github.com/trufflesecurity/trufflehog):** specialized credential detectors.

1. **Pattern-based detection**: Custom YAML rules from `rules.yml` collected by [Secrets Patterns Database](https://github.com/mazen160/secrets-patterns-db)
2. **Betterleaks rules**: Embedded default rules with keyword, path, capture, and false-positive filtering
3. **TruffleHog detectors**: Specialized detectors with active verification
## Verification

The `--secrets-verification` option controls provider verification for both TruffleHog and Betterleaks. With verification enabled, either engine may make outbound requests to credential providers for supported credentials. Disable verification to scan without those provider checks; findings are still reported, but their confidence depends on the detection source:
Verification is enabled by default. `--secrets-verification` controls provider checks for TruffleHog, Betterleaks, and the GitLab detector. These checks can send detected credentials to provider APIs.

- TruffleHog reports verified hits as `high-verified`. With verification disabled, supported detections are reported as `trufflehog-unverified`.
- Betterleaks reports a validation result of `valid` as `high-verified`. Without verification, all Betterleaks detections are reported at their rule confidence (`high`, `medium`, or `low`); Betterleaks has no separate unverified confidence level.
| Source | Verification enabled | Verification disabled |
| ------ | -------------------- | --------------------- |
| TruffleHog | Only successfully verified findings (`verified`) | Returned candidates (`trufflehog`) |
| Betterleaks | Valid credentials use `verified`; invalid/revoked results are suppressed; other retained findings use rule confidence | Rule confidence (`high`, `medium`, or `low`) |
| YAML rules | Rule confidence; no provider checks | Unchanged |

### Confidence Levels
A verification error does not prove a credential is invalid. TruffleHog findings with verification errors are suppressed when verification is enabled. Disabling verification can expose more false positives.

Pipeleek assigns confidence levels to all detected secrets:
Unverified TruffleHog results never receive `high`. The separate Pipeleek GitLab detector and YAML rules can report the same token at `high` based on its pattern.

| Level | Source | Description | Verified |
| ------------------------- | ----------------------- | ------------------------------------------------- | -------- |
| **high-verified** | TruffleHog, Betterleaks | Actively verified and confirmed working | ✅ Yes |
| **trufflehog-unverified** | TruffleHog | Detected but not verified (verification disabled) | ❌ No |
| **high** | rules.yml, Betterleaks | High confidence pattern match | ❌ No |
| **medium** | rules.yml, Betterleaks | Medium confidence pattern match | ❌ No |
| **low** | rules.yml, Betterleaks | Low confidence pattern match | ❌ No |
| **custom** | rules.yml | User-defined confidence level | ❌ No |
To skip provider checks:

### Disabling Verification
```bash
pipeleek gl scan -u https://gitlab.com -t glpat-[redacted] --secrets-verification=false
```

> **Important:** Use `--secrets-verification=false` with `=`. Writing `--secrets-verification false` enables verification: the flag is interpreted as `true`, and the separate `false` is treated as a positional argument.

For operational security (OpSec) or privacy, disable verification to prevent TruffleHog and Betterleaks from sending credential checks to provider APIs.
## Confidence and Filtering

Use the `--secrets-verification=false` flag:
| Level | Meaning |
| ----- | ------- |
| `verified` | Successfully verified credential |
| `trufflehog` | Non-verified TruffleHog candidate; not a confidence ranking |
| `high`, `medium`, `low` | Pattern confidence, not proof that a credential works |
| User-defined label | Confidence assigned by a custom YAML rule |

`--confidence` filters results from every engine. An empty filter includes all levels reported under the verification policy above. Filtering does not disable provider checks.

```bash
pipeleek gl scan -u https://gitlab.com -t glpat-xxxxx --secrets-verification=false
# Higher-confidence findings, including verified credentials
pipeleek gl scan -u https://gitlab.com -t glpat-[redacted] --confidence=verified,high

# Only successfully verified credentials
pipeleek gl scan -u https://gitlab.com -t glpat-[redacted] --confidence=verified

# Only non-verified TruffleHog candidates
pipeleek gl scan -u https://gitlab.com -t glpat-[redacted] --secrets-verification=false --confidence=trufflehog
```

### Confidence Filtering
## Custom Rules

### Optional external rules download

Results can be filtered by confidence, using the `--confidence` flag.
To install the [Secrets Patterns Database](https://github.com/mazen160/secrets-patterns-db) stable ruleset:

```bash
pipeleek gl scan -u https://gitlab.com -t glpat-xxxxx --confidence=high-verified,high
pipeleek rules download
```

## Custom Rules

To scan for a specific pattern, edit the `rules.yml` file Pipeleek creates on the first run. You can remove/add/alter rules as you like.
This writes `rules.yml` in the current directory, which subsequent scans load alongside
the embedded rules. External regex rules can substantially increase false positives
and do not verify credentials. Scans never download or update rules automatically.
The download uses Pipeleek's HTTP client and its global proxy, TLS, and timeout settings.

By default the rules look something like this:
Existing files are protected unless you explicitly replace them:

```yaml
patterns:
- pattern:
name: AWS API Gateway
regex: "[0-9a-z]+.execute-api.[0-9a-z._-]+.amazonaws.com"
confidence: low
- pattern:
name: AWS API Key
regex: AKIA[0-9A-Z]{16}
confidence: high
```bash
pipeleek rules download --force
pipeleek rules download --output additional-rules.yml
```

You can create additional custom rules.
`--output` only changes where the download is saved; scans still load working-directory
`rules.yml`. Downloads are validated for nonempty rule sets, required fields, duplicate
names, and valid Go regexes before saving. Failed downloads or validation leave existing
files unchanged.
Validated rules are written directly to the destination; a filesystem write failure
can leave a partial file, including when replacing a file with `--force`.

> **💡Tip:** Test your regexes at [regex101.com](https://regex101.com/) (select Golang flavor).
### Local customization

A simple example that detects strings that follow the Regex pattern `PIPELEEK_.*` and that are logged with a custom confidence:
Built-in rules include GitLab token patterns and predefined variables such as `GITLAB_USER_ID` and `KUBECONFIG`. Identifier/path matches are indicators to review, not proof of a leaked credential.

Create `rules.yml` in your working directory to add rules. An exact-name match overrides a built-in in the YAML engine; other names add rules. Overrides do not affect the separate GitLab detector or other engines. Without this file, scans use the embedded defaults.

For example, to report `PIPELEEK_` markers with a custom confidence:

```yaml
patterns:
- pattern:
name: Pipeleek Custom Rule
regex: PIPELEEK_.*
regex: PIPELEEK_[A-Z0-9_]+
confidence: custom-confidence
```

When you run Pipeleek, you'll see results for your custom rule and any built-in rules:

```bash
pipeleek gl scan -u https://gitlab.com -t glpat-[redacted] --secrets-verification=false --verbose
2025-09-30T11:39:08Z hit SECRET confidence=custom-confidence type=log jobName=build-job-hidden ruleName="Pipeleek Custom Rule" url=gitlab.com/testgroup/project/-/jobs/11547853360 value="PIPELEEK_HIT=secret"
```
Each rule needs a nonempty name, valid Go regex, and nonempty confidence label. Duplicate names, invalid YAML/regexes, and unreadable files fail initialization.
Set `token: true` for token patterns to reject matches embedded inside larger tokens.
2 changes: 1 addition & 1 deletion examples/compose-elk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Once you've run `bash start-elk.sh`, the Kibana data view is automatically confi
3. You will see:

- `Pipeleek - High Hits` (count of `scan.confidence: high` hits)
- `Pipeleek - High-Verified Hits` (count of `scan.confidence: high-verified` hits)
- `Pipeleek - Verified Hits` (count of `scan.confidence: verified` hits)
- `Pipeleek - Log Intake Over Time` (bar chart over the last 4 hours with fixed 10-minute buckets)
- `Pipeleek - Hits by Asset Type` (pie chart, for example hit logs vs hit artifacts)
- `Pipeleek - Hits by Confidence` (pie chart of confidence ratings)
Expand Down
Loading
Loading