Skip to content
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

Fix code scanning alert no. 1: Flask app is run in debug mode #19

Merged
merged 1 commit into from
Dec 23, 2024

Conversation

rfc391
Copy link
Owner

@rfc391 rfc391 commented Dec 23, 2024

Fixes https://github.com/rfc391/HyCAN/security/code-scanning/1

To fix the problem, we need to ensure that the Flask application does not run in debug mode in a production environment. The best way to achieve this is by using an environment variable to control the debug mode. This way, the application can run in debug mode during development but will have debugging disabled in production.

  1. Modify the app.run(debug=True) line to check an environment variable to determine whether to enable debug mode.
  2. Import the os module to access environment variables.
  3. Set a default value for the environment variable to ensure the application does not run in debug mode by default.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Robert Shubert <robs@apexsecurityint.com>
Copy link

cloudflare-workers-and-pages bot commented Dec 23, 2024

Deploying hycan with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7d10bfc
Status: ✅  Deploy successful!
Preview URL: https://1671b7b6.hycan-aeq.pages.dev
Branch Preview URL: https://alert-autofix-1.hycan-aeq.pages.dev

View logs

@rfc391 rfc391 marked this pull request as ready for review December 23, 2024 11:51
@rfc391 rfc391 merged commit 7b9f5a6 into main Dec 23, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant