Repository navigation
GitHubSecrets AgentFlow
AnythingLLM AgentFlow for discovering accidentally exposed credentials, API keys, and sensitive information in public GitHub repositories related to a target domain or company.
Orchestrates GitHub search queries via AnythingLLM agent to find: hardcoded API keys, secrets, passwords, tokens, and private keys committed to public repos - using dork-style search patterns targeting the specified organization or domain.
Rapidly identify credential exposure in public code during authorized OSINT and attack surface assessment phases - a common high-value finding that bypasses traditional network defenses.
- OSINT phase of an authorized engagement: checking target's GitHub for exposed secrets
- Threat intelligence: monitoring for your own organization's accidental credential exposure
- Red team pre-engagement reconnaissance to find valid credentials before active testing
Name: GitHubSecrets
Description:
Searches GitHub for accidentally exposed credentials, API keys, and sensitive
information related to target domain or company.
Purpose: Discover exposed secrets in public code repositories
Define these variables in the "Flow Variables" section:
| Variable Name | Initial Value | Description |
|---|---|---|
target_domain |
(empty) | Target domain or company name |
github_search_results |
(empty) | GitHub code search results |
commit_data |
(empty) | Commit history search results |
secret_findings |
(empty) | Identified secrets and credentials |
risk_assessment |
(empty) | Risk analysis and recommendations |
Block Type: Web Scraping
Configuration:
-
URL:
https://github.com/search?q=${target_domain}+password+OR+api_key+OR+secret&type=code - Capture Page Content As: Text content only
- Content Summarization: Enabled (recommended)
-
Result Variable:
github_search_results
Purpose: Search public code for exposed credentials
Search Pattern Explanation:
-
${target_domain}- Target organization -
password OR api_key OR secret- Common credential keywords -
type=code- Search in code files
Block Type: Web Scraping
Configuration:
-
URL:
https://github.com/search?q=${target_domain}+remove+password+OR+remove+key&type=commits - Capture Page Content As: Text content only
- Content Summarization: Enabled
-
Result Variable:
commit_data
Purpose: Find credentials in deleted/removed commits
Note: Developers often commit secrets then try to remove them - but they remain in git history
Block Type: LLM Instruction
Instruction:
Analyze GitHub search results for ${target_domain}:
Code Search Results: ${github_search_results}
Commit History: ${commit_data}
Identify and categorize exposed secrets:
## Credentials Found
### 1. Passwords and Authentication
- Plain text passwords
- Hashed passwords (note algorithm)
- Default/hardcoded credentials
- SSH private keys
- PGP private keys
### 2. API Keys and Tokens
- AWS Access Keys (AKIA...)
- Google API keys
- GitHub Personal Access Tokens
- Slack tokens
- Stripe API keys
- OAuth tokens
- JWT secrets
### 3. Database Credentials
- Database connection strings
- MySQL/PostgreSQL credentials
- MongoDB URIs
- Redis passwords
- Database hostnames and ports
### 4. Cloud Provider Credentials
- AWS credentials (access key + secret)
- Azure connection strings
- Google Cloud service account keys
- DigitalOcean tokens
- Heroku API keys
### 5. Third-Party Service Keys
- SendGrid API keys
- Twilio credentials
- PayPal API credentials
- Mailgun keys
- Analytics tracking IDs
### 6. Internal Information
- Internal IP addresses
- Internal hostnames/URLs
- VPN configurations
- Network diagrams
- Architecture details
### 7. Configuration Files
- .env files with secrets
- config.json with credentials
- docker-compose with passwords
- Kubernetes secrets
- Ansible vault passwords
## Risk Classification
For each finding, assign:
- **CRITICAL:** Active production credentials with high privilege
- **HIGH:** Valid credentials with significant access
- **MEDIUM:** Expired/limited credentials or internal info
- **LOW:** Test/development credentials or public info
## Evidence
For each high-risk finding:
- Repository name and URL
- File path
- Line number
- Commit hash
- Date committed
- Committer username
Flag CRITICAL and HIGH findings immediately for urgent action.
Result Variable: secret_findings
Purpose: Extract and classify exposed secrets
Block Type: LLM Instruction
Instruction:
Assess security risk of exposed secrets for ${target_domain}:
Findings: ${secret_findings}
Provide comprehensive risk assessment:
## Executive Summary
- Total secrets found: [number]
- Critical findings: [number]
- High-risk findings: [number]
- Overall risk level: [CRITICAL/HIGH/MEDIUM/LOW]
## Critical Findings Requiring Immediate Action
For each CRITICAL finding:
1. **Type of secret** (AWS key, database password, etc.)
2. **Location** (repository, file, line)
3. **Exposure duration** (date first committed)
4. **Potential impact** (what attacker could access)
5. **Immediate remediation** (rotate key, revoke token, etc.)
## Impact Analysis
Describe potential consequences:
- Unauthorized system access
- Data breach possibilities
- Financial impact
- Compliance violations
- Reputational damage
## Remediation Priority
### Priority 1 (Immediate - Within 1 hour)
[CRITICAL items requiring immediate action]
### Priority 2 (Urgent - Within 24 hours)
[HIGH risk items]
### Priority 3 (Important - Within 1 week)
[MEDIUM risk items]
## Remediation Steps
For exposed credentials:
1. **Immediately rotate/revoke** all exposed credentials
2. **Audit access logs** for unauthorized use
3. **Remove secrets** from repository history using git-filter-branch or BFG
4. **Scan for compromise** - check if credentials were used
5. **Implement secrets management** (AWS Secrets Manager, HashiCorp Vault)
For exposed internal information:
1. **Assess sensitivity** of exposed information
2. **Review network segmentation** if internal IPs exposed
3. **Update security policies** to prevent future exposure
## Prevention Recommendations
1. **Pre-commit hooks** - Install git-secrets or similar tools
2. **Secrets scanning** - Use GitHub Advanced Security or third-party tools
3. **Developer training** - Educate on secure coding practices
4. **Code review process** - Review all commits for secrets
5. **Environment variables** - Use env vars, never hardcode secrets
6. **Secret management** - Implement enterprise secrets management
## Evidence for Client Notification
Provide details to share with client:
- List of exposed repositories
- Types of data compromised
- Recommended urgent actions
- Timeline for remediation
Format as professional security incident report.
Result Variable: risk_assessment
Purpose: Provide actionable remediation guidance
Block Type: Flow Complete
Configuration:
- Flow will end here and return results
@agent use GitHubSecrets flow
target_domain: acme.com
@agent use GitHubSecrets flow
target_domain: Acme Corporation
The flow will return risk_assessment containing:
- Complete list of exposed secrets
- Risk classification for each finding
- Impact analysis
- Prioritized remediation steps
- Prevention recommendations
- Evidence for client notification
Typical Workflow:
- CompanyOSINT - Identify company domains and repositories
- GitHubSecrets (this flow) - Scan for exposed secrets
- EmailOSINT - Investigate developer accounts
- ThreatIntelCheck - Check if exposed IPs are malicious
- VulnReportGenerator - Document findings for client
Incident Response:
- Discover potential breach
- Run GitHubSecrets to check for credential exposure
- Cross-reference with access logs
- Determine scope of compromise
AWS Credentials:
https://github.com/search?q=${target_domain}+AKIA&type=code
Private Keys:
https://github.com/search?q=${target_domain}+BEGIN+RSA+PRIVATE+KEY&type=code
Database Passwords:
https://github.com/search?q=${target_domain}+filename:.env+password&type=code
API Keys:
https://github.com/search?q=${target_domain}+api_key+OR+apikey+OR+api-key&type=code
Configuration Files:
https://github.com/search?q=${target_domain}+filename:config.json+OR+filename:.env&type=code
โ ๏ธ Public Data Only - GitHub public repositories are fair game- Responsible Disclosure - Report findings to target organization
- No Exploitation - Do not use discovered credentials without authorization
- Document Everything - Keep evidence of findings
- Client Notification - Inform client immediately of critical findings
- Rate Limiting - GitHub limits search queries
- Authentication - GitHub API provides better results (requires token)
- False Positives - Test/demo credentials may appear
- Repository Forks - Same secrets may appear in multiple forks
- Content Size - Search results can be extensive
- Example/demo code with fake credentials
- Test repositories with dummy data
- Documentation showing credential formats
- Third-party code repositories
- Archived/unmaintained projects
-
Use GitHub API (Advanced):
Block Type: API Call Method: GET URL: https://api.github.com/search/code?q=${target_domain}+password Headers: {"Authorization": "token YOUR_GITHUB_TOKEN"} -
Search Multiple Patterns:
- Run flow multiple times with different keywords
- password, secret, api_key, token, credentials
-
Check Organization Repositories:
https://github.com/orgs/${target_domain}/repositories- Focus on organization's official repos
-
Review Recent Commits:
- Prioritize recent commits (more likely to be active)
- Check commit dates in findings
-
Validate Findings:
- Check if credentials are still active
- Test database connections (with authorization)
- Verify API keys work
-
Check Git History:
- Secrets may be removed from HEAD but remain in history
- Use
git logto find when secret was added
-
Automated Tools:
- TruffleHog - Deep git history scanning
- GitLeaks - Pattern-based secret detection
- git-secrets - Pre-commit hook
| Issue | Solution |
|---|---|
| No results found | Domain may not have public repos; try company name |
| Too many results | Narrow search with specific keywords |
| Rate limit exceeded | Wait or use GitHub API with authentication |
| False positives | Filter test repos in LLM analysis |
| Can't access repos | Repo may be private; only public repos searchable |
| Generic findings | Add more specific domain terms to search |
After discovering secrets:
-
Immediate Actions:
- Document all findings with screenshots
- Notify client immediately of critical findings
- Recommend emergency credential rotation
-
Verification:
- Test if credentials are still active (with authorization)
- Check access logs for unauthorized use
- Determine blast radius
-
Remediation:
- Help client rotate exposed credentials
- Remove secrets from git history
- Implement secrets management solution
-
Prevention:
- Recommend pre-commit hooks
- Implement automated secret scanning
- Provide developer training
-
.envfiles config.jsonsettings.pyapplication.properties.npmrc.pypircdocker-compose.ymlkubernetes/*.yaml
- password, passwd, pwd
- api_key, apikey, api-key, key
- secret, token, auth
- username, user, login
- database, db, connection
- aws_access_key, aws_secret
- private_key, ssh_key
Finding: AWS Access Key in .env file
Location: github.com/company/webapp/blob/main/.env
Impact: Full AWS account access, potential data breach
Action: Immediate key rotation, audit CloudTrail logs
Finding: Production database password in config.json
Location: github.com/company/api/blob/main/config/production.json
Impact: Direct database access with customer PII
Action: Change password, review database access logs
Finding: Stripe API key in payment processor code
Location: github.com/company/payments/blob/main/stripe.js
Impact: Unauthorized payment processing, financial loss
Action: Revoke key, audit transactions, implement secrets vault
- v1.0 - Initial flow with code and commit search
- Purpose: Discover exposed credentials for security assessment
- Last Updated: November 2025
- CompanyOSINT - Identify target repositories
- EmailOSINT - Investigate developer accounts
- DomainRecon - Discover additional domains to search
- VulnReportGenerator - Document exposed secrets
- BreachChecker - Check if credentials were breached
- README.md - AnythingLLM section index
- anything_llm_agentflows.md - Parent AgentFlows index
- ../../OSINT/scripts/Domain_IP_Recon.md - Domain recon to generate targets for this flow
๐ Source: AI/AnythingLLM/flow-github_secrets.md | โ๏ธ Suggest an edit | โฌ
๏ธ Back to Artificial Intelligence
- ๐บ๏ธ Browse by Topic
- ๐ All Repository Files
- ๐งญ Learning Paths
- ๐ Master Guide
- ๐ค Glossary
- โ๏ธ Legal & Disclaimer
๐ Foundations & Learning
๐ก๏ธ Defense & Investigations
- Incident Response
- Open Source Intelligence (OSINT)
- Reverse Engineering
- Operations Security (OPSEC)
- Compliance
โ๏ธ Platforms & Infrastructure
๐ก Hardware, Wireless & Field Projects
- PNWC Cyberdeck
- Hardware Testing
- Hardware Hacking
- Software-Defined Radio
- Wardriving
- uConsole
- Space Security
๐งฐ Assessment & Field Reference
๐ฆ Downloads & Project Resources
๐๏ธ Additional Topics