Skip to content

Insecure production defaults in Django settings#367

Open
Mayur-Shashidhar wants to merge 2 commits into
kaifansariw:mainfrom
Mayur-Shashidhar:Secure/Production
Open

Insecure production defaults in Django settings#367
Mayur-Shashidhar wants to merge 2 commits into
kaifansariw:mainfrom
Mayur-Shashidhar:Secure/Production

Conversation

@Mayur-Shashidhar
Copy link
Copy Markdown

📄 Description

This PR hardens the Django backend configuration by removing insecure production defaults and moving security-sensitive settings to environment-driven values.

It updates settings.py so that:

  • SECRET_KEY is loaded from environment variables
  • DEBUG defaults to False
  • ALLOWED_HOSTS is no longer hardcoded to *
  • production startup now fails fast when required environment values are missing

It also updates the documentation and environment templates so local development remains simple while production stays safe by default.


🔗 Related Issues

Fixes #362


🖼️ Screenshots (if applicable)

Screenshot 2026-05-15 at 12 37 06 AM Screenshot 2026-05-15 at 12 37 21 AM

🧩 Type of Change

Select the type of change your PR introduces (check all that apply):

  • 🐛 Bug Fix
  • ✨ New Feature
  • ⚡ Enhancement / Optimization
  • 🧰 Refactoring
  • 🧾 Documentation Update
  • 🔧 Other (please specify): ____________

✅ Checklist

Before submitting your PR, please confirm the following:

  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added or updated relevant documentation.
  • My changes do not break any existing functionality.
  • I have tested my changes locally and they work as expected.
  • I have linked all relevant issues (if any).

💬 Additional Notes (Optional)

Validation completed locally:

  • python manage.py check passes in development mode
  • production-mode guard correctly blocks startup when SECRET_KEY or ALLOWED_HOSTS are missing
  • README and .env.example were updated to reflect the new setup requirements

@vercel
Copy link
Copy Markdown

vercel Bot commented May 14, 2026

@Mayur-Shashidhar is attempting to deploy a commit to the kaif ansari 's projects Team on Vercel.

A member of the Team first needs to authorize it.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 14, 2026

Deploy Preview for gamehub-99999 failed.

Name Link
🔨 Latest commit 456c49f
🔍 Latest deploy log https://app.netlify.com/projects/gamehub-99999/deploys/6a06a5162268030008e5f148

@Mayur-Shashidhar
Copy link
Copy Markdown
Author

@kaifansariw Please review the pr and assign the labels so that i can gain the neccessary points
Thank you

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses issue #362 by moving Django security-sensitive settings toward environment-driven configuration and safer production defaults.

Changes:

  • Loads SECRET_KEY, DEBUG, and ALLOWED_HOSTS from environment variables.
  • Adds production fail-fast checks for missing required settings.
  • Updates README and backend environment template for the new configuration flow.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
README.md Documents backend environment variables and production requirements.
backend/gamehub_project/settings.py Adds environment parsing and production guards for Django settings.
backend/.env.example Updates the backend environment template with ALLOWED_HOSTS.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment thread backend/gamehub_project/settings.py Outdated
@Mayur-Shashidhar Mayur-Shashidhar marked this pull request as draft May 15, 2026 04:36
@Mayur-Shashidhar Mayur-Shashidhar marked this pull request as ready for review May 15, 2026 04:45
@Mayur-Shashidhar Mayur-Shashidhar requested a review from Copilot May 15, 2026 05:48
@Mayur-Shashidhar
Copy link
Copy Markdown
Author

@kaifansariw Please give some updates on this PR

@Mayur-Shashidhar
Copy link
Copy Markdown
Author

@kaifansariw Are u gonna merge PR or shall i close it and move on

@Mayur-Shashidhar
Copy link
Copy Markdown
Author

@kaifansariw Your repo was the first one i picked and i dint know i wud have to wait soo much for a reply also

@kaifansariw
Copy link
Copy Markdown
Owner

@Mayur-Shashidhar don't worry I will do that , I was currently solving the backend error specially the Google oauth which is not currently solved. But i will accept the frontend related issue.

@Mayur-Shashidhar
Copy link
Copy Markdown
Author

@kaifansariw I get it u guys are also busy but give us an update na

@Mayur-Shashidhar
Copy link
Copy Markdown
Author

@kaifansariw Please also assign labels like gssoc:approved and stuff before merging and then merge pls
Lost alot of points cause admins are not following this

@kaifansariw
Copy link
Copy Markdown
Owner

@kaifansariw I get it u guys are also busy but give us an update na

There are basically two issue I am facing right now

  1. i have raised the issue regarding the project setup and the label to assign but didn't receive the reply cause the Gssoc team is currently very busy taking the application

  2. I didn't receive any mentor which can talk and solve your issue on behalf of me .

So I will request you to wait just one day I will talk to GSSoC and do this to things.

@kaifansariw
Copy link
Copy Markdown
Owner

@Mayur-Shashidhar .

@Mayur-Shashidhar
Copy link
Copy Markdown
Author

I do have the labels list if u want i can send it
@kaifansariw

@kaifansariw
Copy link
Copy Markdown
Owner

I do have the labels list if u want i can send it
@kaifansariw

Yeah sure if you have the label list and like a template how to setup project please send me it will be helpful for you and me as well

@Mayur-Shashidhar
Copy link
Copy Markdown
Author

I do have the labels list if u want i can send it
@kaifansariw

Yeah sure if you have the label list and like a template how to setup project please send me it will be helpful for you and me as well

IMG_6570

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.

[BUG] Insecure production defaults in Django settings

3 participants