Skip to content

Commit 12f4442

Browse files
docs: Add comprehensive sensitive file management and Git history cleanup guide
- Add emergency procedures for removing sensitive files from Git history - Document BFG Repo-Cleaner usage for complete history cleanup - Include step-by-step guide for credential compromise response - Add configuration template system documentation - Provide post-cleanup security measures and team coordination steps
1 parent a612ee1 commit 12f4442

File tree

2 files changed

+113
-0
lines changed

2 files changed

+113
-0
lines changed

config/server.json.template

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"projectId": "YOUR_PROJECT_ID",
3+
"region": "YOUR_REGION",
4+
"authentication": {
5+
"type": "service_account",
6+
"serviceAccountKeyPath": "path/to/your/service-account-key.json",
7+
"impersonateServiceAccount": "your-service-account@your-project.iam.gserviceaccount.com"
8+
},
9+
"defaultParameters": {
10+
"clusterConfig": {
11+
"masterConfig": {
12+
"numInstances": 1,
13+
"machineTypeUri": "n1-standard-2"
14+
},
15+
"workerConfig": {
16+
"numInstances": 2,
17+
"machineTypeUri": "n1-standard-2"
18+
}
19+
}
20+
},
21+
"qdrant": {
22+
"url": "YOUR_QDRANT_URL",
23+
"apiKey": "YOUR_QDRANT_API_KEY",
24+
"collectionName": "dataproc_knowledge"
25+
}
26+
}

docs/security/index.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,93 @@ Built-in rate limiting prevents abuse and ensures fair resource usage:
6666

6767
Comprehensive credential validation and protection:
6868

69+
#### Sensitive File Protection
70+
71+
**⚠️ CRITICAL**: Configuration files containing sensitive information must never be committed to version control.
72+
73+
**Protected Files:**
74+
- `config/server.json` - Contains authentication credentials, API keys, and project details
75+
- Service account key files (`.json` files with private keys)
76+
- Any files containing passwords, tokens, or API keys
77+
78+
**Security Measures:**
79+
1. **Git Ignore Protection**: Sensitive files are listed in `.gitignore`
80+
2. **Template System**: Use `config/server.json.template` as a reference
81+
3. **History Cleanup**: If accidentally committed, use BFG Repo-Cleaner to remove from history
82+
83+
#### Emergency: Removing Sensitive Files from Git History
84+
85+
If sensitive files were accidentally committed and pushed to a repository:
86+
87+
1. **Install BFG Repo-Cleaner**:
88+
```bash
89+
# macOS
90+
brew install bfg
91+
92+
# Or download from: https://rtyley.github.io/bfg-repo-cleaner/
93+
```
94+
95+
2. **Remove file from current commit**:
96+
```bash
97+
git rm -f config/server.json
98+
git commit -m "Remove sensitive configuration file"
99+
```
100+
101+
3. **Clean entire Git history**:
102+
```bash
103+
# Remove all instances of the file from history
104+
bfg --delete-files server.json
105+
106+
# Clean up the repository
107+
git reflog expire --expire=now --all && git gc --prune=now --aggressive
108+
```
109+
110+
4. **Force push to remote** (⚠️ **DESTRUCTIVE OPERATION**):
111+
```bash
112+
# Push cleaned main branch
113+
git push --force origin main
114+
115+
# Push all cleaned branches
116+
git push --force origin --all
117+
```
118+
119+
5. **Post-cleanup actions**:
120+
- Rotate all compromised credentials immediately
121+
- Update API keys and service account keys
122+
- Notify team members to re-clone the repository
123+
- Monitor for any unauthorized access
124+
125+
**⚠️ Important Notes:**
126+
- Force pushing rewrites Git history and affects all collaborators
127+
- All team members must re-clone the repository after cleanup
128+
- This operation cannot be undone - ensure you have backups
129+
- Consider contacting GitHub support for additional cache clearing
130+
131+
#### Configuration File Setup
132+
133+
1. **Copy the template**:
134+
```bash
135+
cp config/server.json.template config/server.json
136+
```
137+
138+
2. **Edit with your credentials**:
139+
```json
140+
{
141+
"projectId": "your-actual-project-id",
142+
"region": "us-central1",
143+
"authentication": {
144+
"serviceAccountKeyPath": "/secure/path/to/your-key.json",
145+
"impersonateServiceAccount": "your-sa@project.iam.gserviceaccount.com"
146+
}
147+
}
148+
```
149+
150+
3. **Verify protection**:
151+
```bash
152+
# Ensure file is ignored
153+
git status # Should not show config/server.json as modified
154+
```
155+
69156
#### Service Account Key Validation
70157

71158
- **Format Validation**: Ensures proper JSON structure and required fields

0 commit comments

Comments
 (0)