Skip to content

fix(security): Secure ALLOWED_HOSTS configuration. Closes #925#950

Merged
regulartim merged 3 commits intointelowlproject:developfrom
chauhan-varun:fix/925-secure-allowed-hosts
Mar 5, 2026
Merged

fix(security): Secure ALLOWED_HOSTS configuration. Closes #925#950
regulartim merged 3 commits intointelowlproject:developfrom
chauhan-varun:fix/925-secure-allowed-hosts

Conversation

@chauhan-varun
Copy link
Copy Markdown
Contributor

@chauhan-varun chauhan-varun commented Mar 4, 2026

Description

Make ALLOWED_HOSTS configurable via the DJANGO_ALLOWED_HOSTS environment variable (comma-separated) instead of hardcoding ["*"]. Falls back to ["*"] for backward compatibility so no existing instance breaks, but logs a WARNING in production (DEBUG=False) when the variable is not set. Also registers a Django System Check (greedybear.W001) that flags the wildcard when running manage.py check --deploy.

Related issues

Closes #925

Type of change

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).
  • Chore (refactoring, dependency updates, CI/CD changes, code cleanup, docs-only changes).

Screenshots

1. Warning log when DJANGO_ALLOWED_HOSTS is not set (production mode)

image

2. Django deploy check (greedybear.W001)

image

3. With DJANGO_ALLOWED_HOSTS set (no warning)

image

Checklist

Formalities

  • I have read and understood the rules about how to Contribute to this project.
  • I chose an appropriate title for the pull request in the form: <feature name>. Closes #999
  • My branch is based on develop.
  • The pull request is for the branch develop.
  • I have reviewed and verified any LLM-generated code included in this PR.

Docs and tests

  • I documented my code changes with docstrings and/or comments.
  • I have checked if my changes affect user-facing behavior that is described in the docs. If so, I also created a pull request in the docs repository.
  • Linter (Ruff) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.
  • I have added tests for the feature/bug I solved.
  • All the tests gave 0 errors.

GUI changes

No GUI changes.

@chauhan-varun
Copy link
Copy Markdown
Contributor Author

@regulartim please review the PR

Copy link
Copy Markdown
Collaborator

@regulartim regulartim left a comment

Choose a reason for hiding this comment

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

Looks good, all in all! 👍

…nvironment variable and introduce a system check for wildcard usage.
Copy link
Copy Markdown
Collaborator

@regulartim regulartim left a comment

Choose a reason for hiding this comment

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

Hey @chauhan-varun ! Looks good, thanks! :)

@regulartim regulartim merged commit bfc69a3 into intelowlproject:develop Mar 5, 2026
4 checks passed
@chauhan-varun chauhan-varun deleted the fix/925-secure-allowed-hosts branch March 6, 2026 04:22
cclts pushed a commit to cclts/GreedyBear that referenced this pull request Mar 11, 2026
…ject#925 (intelowlproject#950)

* feat: Add security check for wildcard ALLOWED_HOSTS and enable configuration via DJANGO_ALLOWED_HOSTS environment variable.

* style: reformat hint string for ALLOWED_HOSTS wildcard warning.

* fix: Allow `ALLOWED_HOSTS` configuration via `DJANGO_ALLOWED_HOSTS` environment variable and introduce a system check for wildcard usage.
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.

2 participants