Skip to content

Commit e9238b1

Browse files
Add credential inventory, rotation runbook, and CI secret scanning
1 parent 658aed0 commit e9238b1

5 files changed

Lines changed: 127 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Secret Scanning
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [ main, master ]
7+
8+
jobs:
9+
gitleaks:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Run Gitleaks against target files
18+
uses: gitleaks/gitleaks-action@v2
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
with:
22+
args: >-
23+
detect
24+
--config=.gitleaks.toml
25+
--source=.
26+
--redact
27+
--verbose
28+
--log-level=warn
29+
--report-format=sarif
30+
--report-path=gitleaks.sarif
31+
--max-target-megabytes=20
32+
--no-git
33+
--path='**/*.env'

.gitleaks.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
title = "generative-ai secret scanning policy"
2+
3+
[allowlist]
4+
description = "Allow placeholder values used in documentation and examples"
5+
paths = [
6+
'''(?i).*README\.md$''',
7+
'''(?i).*docs/.*\.md$''',
8+
'''(?i).*\.ipynb$'''
9+
]
10+
regexes = [
11+
'''(?i)your[_-]?(api|secret|token|key)''',
12+
'''(?i)example[_-]?(api|secret|token|key)''',
13+
'''(?i)changeme'''
14+
]
15+
16+
[[rules]]
17+
id = "provider-api-keys"
18+
description = "Potential provider API keys and secrets"
19+
regex = '''(?i)(openai|gemini|google|drive|elevenlabs|deepgram|assemblyai|voice|tts|stt)[a-z0-9_\-]{0,30}(api[_-]?key|secret|token)["'=: ]+[A-Za-z0-9_\-]{16,}'''
20+
keywords = ["api_key", "secret", "token", "openai", "gemini", "google", "drive", "elevenlabs", "deepgram", "assemblyai"]
21+
22+
[[rules]]
23+
id = "google-service-account-json"
24+
description = "Google service account key fields"
25+
regex = '''(?i)"private_key"\s*:\s*"-----BEGIN PRIVATE KEY-----'''
26+
keywords = ["private_key", "client_email", "service_account"]

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
repos:
2+
- repo: https://github.com/gitleaks/gitleaks
3+
rev: v8.24.2
4+
hooks:
5+
- id: gitleaks
6+
args:
7+
- --config=.gitleaks.toml
8+
- --verbose
9+
files: '(?i)(\.env($|\.)|\.json$|\.ipynb$|\.log$|\.out$)'
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Credential Inventory and Rotation Plan
2+
3+
Date: 2026-05-19 (UTC)
4+
5+
## 1) Inventory of credentials referenced by app modules
6+
7+
| Service | Credential/env var | Example modules |
8+
|---|---|---|
9+
| Gemini / Google GenAI | `GOOGLE_API_KEY` | `gemini/mcp/mcp_orchestration_app/src/gemini_client.py`, `gemini/multimodal-live-api/project-livewire/server/config/config.py`, `gemini/sample-apps/gemini-streamlit-cloudrun/app.py` |
10+
| Gemini (legacy naming) | `GEMINI_API_KEY` | `gemini/sample-apps/gemini-quart-cloudrun/app/app.py`, `gemini/sample-apps/gemini-live-telephony-app/main.py` |
11+
| Google Cloud auth | `GOOGLE_APPLICATION_CREDENTIALS` | `gemini/sample-apps/swot-agent/agent.py`, `gemini/mcp/mcp_orchestration_app/example.env` |
12+
| Vertex toggle | `GOOGLE_GENAI_USE_VERTEXAI` | `gemini/multimodal-live-api/project-livewire/server/config/config.py`, `gemini/mcp/adk_mcp_app/README.md` |
13+
| Voice provider options | model voice config values (`VOICE_*`) | `gemini/multimodal-live-api/project-livewire/server/config/config.py` |
14+
15+
No active OpenAI-specific, Google Drive-specific, or third-party voice API key variables (e.g., `OPENAI_API_KEY`, `DEEPGRAM_API_KEY`, `ELEVENLABS_API_KEY`, `ASSEMBLYAI_API_KEY`) were found in the scoped app modules during this pass.
16+
17+
## 2) Rotation + revocation runbook (mandatory)
18+
19+
Because this repository cannot revoke provider credentials directly, perform these steps immediately in provider consoles:
20+
21+
1. Create replacement keys/service-account credentials for each live secret above.
22+
2. Update secret manager entries / CI env vars / runtime env vars.
23+
3. Redeploy every affected service.
24+
4. Validate smoke tests and auth paths.
25+
5. Revoke or disable previous keys immediately.
26+
27+
## 3) Key restrictions and quota ceilings
28+
29+
Apply for each provider where supported:
30+
- Restrict by application origin/domain for browser-exposed keys.
31+
- Restrict by source IP/CIDR for server-side keys.
32+
- Restrict by API scope/service.
33+
- Configure per-key quota ceilings and alerting.
34+
35+
## 4) Validation checklist
36+
37+
- [ ] New keys deployed to all environments.
38+
- [ ] Old keys revoked.
39+
- [ ] API calls succeed with new keys.
40+
- [ ] 401/403 checks confirm old keys invalid.
41+
- [ ] Budget/quota alerts configured.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Security Incident Log: Credential Rotation
2+
3+
- Incident date: 2026-05-19 (UTC)
4+
- Trigger: Requested emergency credential hygiene hardening.
5+
6+
## Affected services
7+
- Gemini / Google GenAI API-key consumers
8+
- Vertex/ADC service-account consumers
9+
10+
## Rotation execution record
11+
- Rotation started: 2026-05-19T00:00:00Z (to be updated by operator)
12+
- Rotation completed: PENDING OPERATOR ACTION
13+
- Old key revocation completed: PENDING OPERATOR ACTION
14+
15+
## Post-rotation validation
16+
- Secret scanning controls added in repo CI + pre-commit.
17+
- Provider-side live key rotation/revocation still required and must be executed in cloud/provider consoles.
18+
- Validation status after operator action: PENDING

0 commit comments

Comments
 (0)