-
Notifications
You must be signed in to change notification settings - Fork 6
Test pr patch fix comments #36
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: master
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 |
|---|---|---|
| @@ -1,31 +1,17 @@ | ||
| <p align="center"> | ||
| <img src="https://deepsource.io/images/logo-wordmark-dark.svg" /> | ||
| </p> | ||
| MyApp | ||
| ===== | ||
|
|
||
| <p align="center"> | ||
| <a href="https://deepsource.io/docs/">Documentation</a> | | ||
| <a href="https://deepsource.io/signup/">Get Started</a> | | ||
| <a href="https://discuss.deepsource.io/">Discuss</a> | ||
| </p> | ||
|
|
||
| <p align="center"> | ||
| DeepSource helps you ship good quality code. | ||
| </p> | ||
|
|
||
| </p> | ||
|
|
||
| --- | ||
|
|
||
| # Demo repository - Python | ||
|
|
||
| This repository demonstrates sample issues in Python code raised by DeepSource. | ||
| A lightweight Python service example. The source lives under `src/app` and includes a small CLI. | ||
|
|
||
| [](https://deepsource.io/gh/deepsourcelabs/demo-python/?ref=repository-badge) | ||
| This repository is intended to be a simple starting point for contributors. | ||
|
|
||
| ### Report | ||
| Run the CLI: | ||
|
|
||
| [https://deepsource.io/gh/deepsourcelabs/demo-python/issues/](https://deepsource.io/gh/deepsourcelabs/demo-python/issues/) | ||
| ```bash | ||
| python -m src.app.main | ||
| ``` | ||
|
|
||
| ### Documentation | ||
|
|
||
| [https://deepsource.io/docs/analyzer/python.html](https://deepsource.io/docs/analyzer/python.html) | ||
| License: MIT | ||
| --- |
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,20 @@ | ||
| import os | ||
|
|
||
| x = list(range(10)) | ||
| import time | ||
|
|
||
| # Introduce issues: busy wait, unused imports, and insecure temp file usage | ||
|
|
||
| def busy_wait(seconds): | ||
| start = time.time() | ||
| while time.time() - start < seconds: | ||
| pass # busy wait | ||
|
|
||
| def create_temp_file(): | ||
| fname = '/tmp/poc_temp.txt' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Variable
|
||
| f = open(fname, 'w') | ||
| f.write('temp') | ||
| return fname # file not closed properly | ||
|
|
||
| def insecure_op(): | ||
| os.system('echo vulnerable') # command injection risk if extended | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use of partial executable path in
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Minimal requirements | ||
| # pinned to an old known-vulnerable version for testing | ||
| requests==2.18.4 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # src/app package | ||
| __version__ = "0.1.0" |
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.
Variable
fnamewith hardcoded path used for temp file increate_temp_file()The variable
fnameis assigned a hardcoded path '/tmp/poc_temp.txt' on line 14 withincreate_temp_file(). This insecure practice risks file hijacking by attackers who can predict and create malicious files at that path. Usetempfile.TemporaryFile()to generate secure, unpredictable temporary files and ensure proper cleanup.