generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 2
Security fixes #15
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
Open
bhavishadawada
wants to merge
5
commits into
main
Choose a base branch
from
security-fixes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Security fixes #15
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9d65707
Fix information exposure through exception
bhavishadawada d450881
Too few arguments to formatting function
bhavishadawada d24238e
Fix path injection vulnerability in snapshot file download
bhavishadawada b39778b
security: fix path injection vulnerability in captureIdPath parameter
bhavishadawada 1378432
security: fix path injection vulnerability in jsonl file path constru…
bhavishadawada File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,8 +73,8 @@ async def unhandled_exception_handler(request: Request, exc: Exception) -> JSONR | |
| exception_name = getattr(exception_type, "__name__", None) | ||
|
|
||
| logger.error("Uncaught Exception", exc_info=(exception_type, exception_value, exception_traceback)) | ||
|
|
||
| return JSONResponse({'message': f"Internal Server Error. Error: '{exception_name}: {exception_value}.'", 'request_id': get_request_id()}, status_code=500) | ||
| return JSONResponse({'message': "Internal Server Error. Please contact admin.", 'request_id': get_request_id()}, status_code=500) | ||
| #return JSONResponse({'message': f"Internal Server Error. Error: '{exception_name}: {exception_value}.'", 'request_id': get_request_id()}, status_code=500) | ||
|
|
||
| def api_exception_logger(request: Request, exc): | ||
| url = f"{request.url.path}?{request.query_params}" if request.query_params else request.url.path | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,7 +91,7 @@ int main() | |
| // Will be invoked when mqtt topic 'broker-test-subscription' is published too | ||
| CHECKHR(broker->Subscribe("test-subscription", [&](IPayload* payload) | ||
| { | ||
| TraceInfo("Received message: %s", payload->SerializeAsString()); | ||
| TraceInfo("Received message: %s", payload->SerializeAsString()..c_str()); | ||
| })); | ||
| int32_t test_subscription_cancellation_token = hr; | ||
|
|
||
|
|
@@ -100,7 +100,7 @@ int main() | |
| // when a publish happens with message_id = `test_message` | ||
| CHECKHR(broker->Subscribe("test_message", [&](IPayload* payload) | ||
| { | ||
| TraceInfo("Received locally: %s", payload->SerializeAsString()); | ||
| TraceInfo("Received locally: %s", payload->SerializeAsString().c_str()); | ||
| })); | ||
| int32_t test_message_cancellation_token = hr; | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
Copilot Autofix
AI 4 months ago
The best practice for managing potentially user-controlled file paths is:
...startswith, which is error-prone for directories like/tmp/fooand/tmp/foobar).Edits required:
src/backend/endpoints/download_file.py, lines 216-228:os.path.basenameand associated manual checks.os.path.normpath(and preferablyos.path.abspath) after joining the user-supplied path to the base directory.os.path.commonpath.osis already imported).