Defense Strategies
Defending against info stealers requires layering multiple security measures. This guide covers practical defenses.
The most important defense is reducing what can be stolen.
Limit time window for the ability to use stolen credentials by setting shoter session lengths for credentials when possible. Ideally usage of a second factor to refresh a credential should be required for increased security.
Request only what you need:
# BAD: All permissions
gh auth login --scopes "repo,admin:org,gist,user,delete_repo,write:packages"
# GOOD: Minimum needed
gh auth login --scopes "repo"
Never store credentials in plaintext on your machine. Leverage OS keyrings or secret management tools to protect your credentials from theft and only retrieve them when needed. For maximum security, use hardware-backed storage where available(MacOS secure enclave, TPM, hardware security keys). Examples include:
- macOS Keychain (https://secretive.dev/)
- Linux/Windows TPM (Windows Hello)
- Password managers (1Password, Bitwarden, etc.)
Use different credentials for:
- Personal projects vs. work
- Production vs. development
- High-security vs. general access
- Only install extensions from verified publishers
- Review extension permissions
- Keep extensions updated
- Remove unused extensions
Bagel fits into your defense strategy by providing visibility:
Run Bagel regularly to find:
- Unencrypted SSH keys
- Hardcoded credentials in configs
- Insecure tool configurations
- Exposed secrets in shell history