Skip to content

Commit 1e75cbb

Browse files
0xVijayclaude
andcommitted
fix: Redact exposed MongoDB credentials in example files
Replace hardcoded MongoDB Atlas credentials and Flask secret key with environment variable lookups in 2 example files collected from external sources. While the cluster is no longer active, removing plaintext credentials prevents training code generation models on insecure patterns. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 737027b commit 1e75cbb

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

  • examples/eg-2-rendertemplate
    • targets-orig/keyurkhant--OCR-Auto-Form/VisionAPI
    • targets-tags/keyurkhant--OCR-Auto-Form/VisionAPI

examples/eg-2-rendertemplate/targets-orig/keyurkhant--OCR-Auto-Form/VisionAPI/final.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424

2525
# Define MongodB URI for CRUD application
2626
# This should be secure, and you can see whole database using MongoDB Compass or MongoDB Atlas.
27-
app.config["MONGO_URI"] = "mongodb+srv://kpkhant:keyurkhant123@ocrhack-j1wkq.mongodb.net/OCRHack?retryWrites=true&w=majority"
27+
app.config["MONGO_URI"] = os.environ.get("MONGO_URI", "mongodb+srv://user:password@cluster.mongodb.net/dbname?retryWrites=true&w=majority")
2828
mongo = PyMongo(app) # Initialize MongoDB object
29-
app.secret_key = 'kpkhant007' # Define Secret Key(Random)
29+
app.secret_key = os.environ.get("SECRET_KEY", "change-me") # Define Secret Key
3030

3131
# GLOBAL VARIABLE
3232
form1_dict = {}

examples/eg-2-rendertemplate/targets-tags/keyurkhant--OCR-Auto-Form/VisionAPI/final.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424

2525
# Define MongodB URI for CRUD application
2626
# This should be secure, and you can see whole database using MongoDB Compass or MongoDB Atlas.
27-
app.config["MONGO_URI"] = "mongodb+srv://kpkhant:keyurkhant123@ocrhack-j1wkq.mongodb.net/OCRHack?retryWrites=true&w=majority"
27+
app.config["MONGO_URI"] = os.environ.get("MONGO_URI", "mongodb+srv://user:password@cluster.mongodb.net/dbname?retryWrites=true&w=majority")
2828
mongo = PyMongo(app) # Initialize MongoDB object
29-
app.secret_key = 'kpkhant007' # Define Secret Key(Random)
29+
app.secret_key = os.environ.get("SECRET_KEY", "change-me") # Define Secret Key
3030

3131
# GLOBAL VARIABLE
3232
form1_dict = {}

0 commit comments

Comments
 (0)