@@ -66,6 +66,93 @@ Built-in rate limiting prevents abuse and ensures fair resource usage:
6666
6767Comprehensive 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