Remediate findings
A machine scan surfaces findings of different kinds, and each kind calls for a different action:
- Overprivileged secrets: such as secrets with admin permissions. Remove them from the machine and store them in a vault or password manager.
- Leaked secrets: secrets that ended up in shell history or log files. Redact them and prevent future leaks.
- Secrets you actively use: secrets your daily work relies on, typically stored in env files. Move them to a vault to keep using them safely.
Remove overprivileged secrets
Admin-level secrets shouldn't sit on a workstation, but not every finding deserves an incident. Review the findings in the GitGuardian dashboard and create incidents for the ones that call for action:
-
In the GitGuardian dashboard, go to the Endpoint protection > Secrets page.
-
Optionally, select the Highly privileged & Valid filter to narrow the list down to the secrets with admin permissions.
-
Review the findings. A finding warrants an incident when the secret is valid and carries more permissions than work on the endpoint requires: admin scopes, organization-wide access, or write access to production systems.
-
For each finding that needs action, click Create incident and assign the incident to the relevant member. Bulk actions let you create several incidents at once.
-
Follow the incident remediation workflow to revoke the secret and remove it from the machine.
Create incidents automatically
To skip the manual review for the riskiest findings, turn on Endpoint leaks in Settings > Secrets > Policies and pick a Minimum risk level. Every secret shown at or above that level opens an incident, the ones already found included, and gets the notifications and tickets you configured for any new incident. Start at Critical and lower the level once the volume is under control. See Turn policy breaches into incidents.
Resolve incidents automatically
GitGuardian closes an incident on its own after its secret is removed from the machine. This is the Auto-resolve endpoint incidents when the secret is removed playbook, on by default. Deactivate it to keep such incidents open until someone resolves them.
GitGuardian resolves an incident once scans have not found its secret on any endpoint of your workspace for 30 hours. An active machine scans at least once in that time, so one failed or partial scan closes nothing. A few cases keep the incident open:
- The secret is still on an endpoint, even in another file or on another machine.
- The secret is also in a repository or another source outside your endpoints.
- The machine stopped scanning. Only a scan can confirm that the secret is gone.
- You ignored the incident, or reopened it yourself after GitGuardian resolved it.
If a later scan finds the secret again, GitGuardian reopens the incident. It never reopens an incident you resolved yourself, or one whose secret was checked as invalid.
Removed does not mean revoked. The secret can still work at its provider, or sit on a machine that no agent scans. Revoke every secret that was exposed, whether or not its incident is resolved.
Prevent overprivileged secrets
- Use fine-grained or lower-permission tokens. Most services offer permission granularity: create tokens with only the permissions you need.
- Keep admin tokens in a vault. Most daily tasks don't require admin permissions. Store admin tokens in a vault and use them only when really needed.
Redact secrets in shell history and log files
Secrets that leaked into shell history or log files serve no purpose there. The redact action rewrites the file in place: only the secret itself is replaced with [REDACTED], the rest of the line and the file stay untouched. Your history and logs remain readable, minus the credentials.
To use a different placeholder, set the remediation.scrub_redact_string option in the Configuration page of the local dashboard.
Redaction cannot be undone.
-
Open the local dashboard:
ggshield machine dashboard -
Go to the Findings page.
-
Select the Auto-fixable filter to show findings where at least one occurrence can be scrubbed automatically.
-
Select all results with the main checkbox. Use Select all x matching if the results span multiple pages.
-
Click Redact selected.
Redact from the command line
ggshield machine redact applies the same selection as the Auto-fixable filter, without opening the dashboard. Preview the plan first, then confirm:
ggshield machine redact --dry-run
ggshield machine redact
Narrow the selection with --path, --exclude-path, --detector, or --finding, and pass --yes to skip the confirmation in scripts. See Redact options.
Prevent future leaks
Block AI agents from reading secrets. AI coding agents can read secrets from any file they have access to, and anything they read ends up in plain text in their logs, session transcripts, and shell history. Install the ggshield AI hooks to stop them from accessing files that contain secrets.
Keep secrets out of shell history. Use a variable instead of a plaintext secret in your commands:
psql "postgresql://admin:${DB_PASSWORD}@db.example.com:5432/mydb"
Move the secrets you use to a vault
Some secrets are needed for daily work. They usually live in .env, .bashrc, and similar files. Using them is legitimate, but they belong in a vault or secrets manager.
GitGuardian doesn't offer an official solution to relocate them yet. In the meantime, move them to your vault manually.