tlamatini-allowed-hosts-tighten

Replace wildcard ALLOWED_HOSTS in Django settings.py with a user-specified whitelist.

14|1|Updated Mar 6, 2026
One-click install
npx skills add https://github.com/XAIHT/Tlamatini --skill tlamatini-allowed-hosts-tighten
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tlamatini-allowed-hosts-tighten
Source: https://github.com/XAIHT/Tlamatini/tree/main/Tlamatini/agent/skills_pkg/tlamatini_allowed_hosts_tighten
Command: npx skills add https://github.com/XAIHT/Tlamatini --skill tlamatini-allowed-hosts-tighten

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The skill addresses the insecure default in Django projects by replacing the permissive ALLOWED_HOSTS = ['*'] with a custom, user-supplied whitelist, reducing exposure to host header attacks.

Core Features & Use Cases

  • Read and locate the ALLOWED_HOSTS setting in Tlamatini/tlamatini/settings.py.
  • Back up the current settings file as settings.py.bak before applying changes.
  • Rewrite ALLOWED_HOSTS to the provided list and return the paths along with a change status.
  • Rollback by restoring the backup if the provided hosts are invalid.

Quick Start

Provide a hosts list to replace ALLOWED_HOSTS and create a backup of settings.py.

Frequently Asked Questions about tlamatini-allowed-hosts-tighten

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why should I remove the wildcard from Django ALLOWED_HOSTS in settings.py?

Removing the wildcard from Django ALLOWED_HOSTS prevents host header attacks by ensuring the web app only accepts requests for explicitly trusted domains. Replacing the permissive ['*'] default with a custom whitelist reduces exposure to malicious HTTP requests.

How do I safely replace ALLOWED_HOSTS in Django without losing my settings?

To safely replace ALLOWED_HOSTS, back up settings.py as settings.py.bak before modifying. The skill rewrites ALLOWED_HOSTS to your provided whitelist and returns the file paths and changed status, ensuring a rollback path if the provided hosts are invalid.

Can I restore my original Django settings.py if the new ALLOWED_HOSTS whitelist breaks my web app?

Yes, you can restore your original Django settings.py from the backup file. The skill automatically creates settings.py.bak before applying changes, allowing rollback by restoring the backup if the provided hosts are invalid.

Does tightening ALLOWED_HOSTS require any external dependencies for my Django project?

Tightening ALLOWED_HOSTS requires no external dependencies. The skill operates directly on the filesystem to locate, back up, and rewrite Django's settings.py, enforcing read/write permissions to safely apply the security whitelist.

What is the best way to secure Django ALLOWED_HOSTS for production?

The best way to secure Django ALLOWED_HOSTS for production is replacing the wildcard entry with a specific domain whitelist. This enforces strict host validation, backs up the original configuration, and mitigates host header attack vectors.

What happens to the file paths when ALLOWED_HOSTS is rewritten?

When ALLOWED_HOSTS is rewritten, the skill reports the outputs settings_path, backup_path, and changed. It locates the setting in settings.py, creates a backup, and returns these paths along with the change status for verification.