-
Notifications
You must be signed in to change notification settings - Fork 1
π‘οΈ Sentinel: [HIGH] Fix path traversal and username leak in default db paths #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ | |
|
|
||
| DEFAULT_DB_PATH = os.path.expanduser("~/.promptc_history.db") | ||
| if os.name == "nt": | ||
| DEFAULT_DB_PATH = r"C:\Users\User\.promptc_history.db" | ||
| DEFAULT_DB_PATH = os.path.join(os.environ.get("USERPROFILE", "C:\\"), ".promptc_history.db") | ||
|
Comment on lines
9
to
+11
|
||
|
|
||
|
|
||
| class HistoryManager: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,7 +38,7 @@ | |
| DEFAULT_DB_PATH = os.path.expanduser("~/.promptc_index_v3.db") | ||
| # Force absolute path for debugging Windows environment | ||
| if os.name == "nt": | ||
| DEFAULT_DB_PATH = r"C:\Users\User\.promptc_index_v3.db" | ||
| DEFAULT_DB_PATH = os.path.join(os.environ.get("USERPROFILE", "C:\\"), ".promptc_index_v3.db") | ||
|
Comment on lines
38
to
+41
|
||
|
|
||
| CHUNK_SIZE = 1000 | ||
| CHUNK_OVERLAP = 200 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue here: if
USERPROFILEis missing, the code falls back toC:\\and will attempt to create/useC:\\.promptc_history.db, which may require elevated permissions and is not user-specific. Consider falling back toos.path.expanduser("~")/Path.home()(or leave the originalexpanduser("~/.promptc_history.db")in place) instead of defaulting to the drive root.