Is Django safe?
What Django does
Django is a high-level Python web framework for building websites and web applications. In its own words, it encourages rapid development and clean, pragmatic design. The PyPI metadata lists the Django Software Foundation as author, and the code lives in django/django under BSD-3-Clause. A Django project serves HTTP, and its settings hold sensitive values such as the secret key. Its deployment checklist says never to enable debug in production, because debug pages leak information such as excerpts of your source code. Before installing, plan to run manage.py check --deploy against your production settings and to serve the app with a production WSGI or ASGI server instead of runserver.
- Unsafe deserialization
- Python dynamic code execution
- Python shell/command execution
What to do: Nothing here argues against installing it. Grant the capabilities it lists only if you expect the tool to need them.
Django is a PyPI package analyzed by SkillTotal's deterministic static scanner. The scan found no malicious indicators, though 1 risky construct is reported for review. It can: dynamic code execution, filesystem read, filesystem write, network egress, scoped identity and shell execution — capabilities are what the code can do, not a verdict on intent. Risk score 20/100 (low).
Django 6.1.3
Get notified when this component changes
Change alerts aren't live yet. Leave your email and we'll let you know when they launch. We use it only for this and delete it on request.
Automated static-analysis result. It can contain false positives and false negatives, and is not a claim about the intent of Django's authors. Report a false positive.
Behavioral traits
How this component maps to the CSA agentic threat model. Descriptive — it never affects the risk score.
Findings (7)
It loads data with a format that can rebuild arbitrary objects (e.g. pickle, or unsafe YAML).
value = pickle.loads(base64.b64decode(value.encode(), validate=True))
return pickle.loads(zlib.decompress(f.read()))
previous_value = pickle.loads(zlib.decompress(f.read()))
exp = pickle.load(f)
return pickle.loads(pickled)
value = pickle.loads(pickled)
return pickle.loads(data)
Why it matters: Feeding such a loader untrusted data can execute code hidden inside that data.
Fix: Deserialize untrusted data with a safe format/loader: JSON, or yaml.safe_load / Loader=SafeLoader. Reserve pickle/marshal for data you fully control.
The code turns strings into live code at runtime (eval / new Function / exec).
exec(compile(pythonrc_code, pythonrc, "exec"), imported_objects)
exec(options["command"], {**globals(), **self.get_namespace(**options)})exec(sys.stdin.read(), {**globals(), **self.get_namespace(**options)})return eval(code, {}, {"datetime": datetime, "timezone": timezone})Why it matters: If those strings aren't fixed and trusted, they become a way to run arbitrary code.
Fix: Avoid evaluating dynamically constructed code; if unavoidable, ensure the input is a trusted constant and never derived from external data.
The component can run operating-system commands or spawn processes.
p = run(args, capture_output=True, close_fds=os.name != "nt")
subprocess.run(
[black_path, "--fast", "--", *written_files],
capture_output=True,
)subprocess.run(args, env=env, check=True)
subprocess.Popen(
dump_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=dump_env
) as dump_proc,subprocess.Popen(
load_cmd,
stdin=dump_proc.stdout,
stdout=subprocess.DEVNULL,
stderr=subprocess.PIPE,
env=load_env,
) as load_proc,p = subprocess.run(args, env=new_environ, close_fds=False)
git_log = subprocess.run(
"git log --pretty=format:%ct --quiet -1 HEAD",
capture_output=True,
shell=True,
cwd=repo_dir,
text=True,
)Why it matters: Powerful and often legitimate — confirm the commands aren't built from untrusted input.
Fix: Confirm the command and its arguments are fully controlled and not derived from untrusted input; avoid shell=True.
The component reads files from disk.
template_contents = template_file.read_text()
with open(password_list_path) as f:
with open(file_h, "rb") as file_h:
with open(self._key_to_file(), encoding="ascii") as session_file:
with open(fname, "rb") as f:
with open(fname, "rb") as f:
self.file = open(self.name, mode or self.mode, *args, **kwargs)
file = open(file_or_path, "rb")
with open(old_file_name, "rb") as old_file:
return File(open(self.path(name), mode))
return super().open(mode)
with open(self.path, encoding="utf-8") as fp:
msgs = Path(pofile).read_text(encoding="utf-8")
with open(potfile, encoding="utf-8") as fp:
with open(django_po, encoding="utf-8") as fp:
with open(pythonrc) as handle:
with open(old_path, encoding="utf-8") as template_file:
with open(template_file, encoding="utf-8") as fp:
source = exception_file.read_text()
with open(origin.name, encoding=self.engine.file_charset) as fp:
with builtin_template_path("csrf_403.html").open(encoding="utf-8") as fh:with open(filename, "rb") as fp:
with builtin_template_path("technical_404.html").open(encoding="utf-8") as fh:with builtin_template_path("default_urlconf.html").open(encoding="utf-8") as fh:with builtin_template_path("i18n_catalog.js").open(encoding="utf-8") as fh:Why it matters: Usually legitimate, but worth confirming it can't be steered into reading sensitive files.
Fix: Confirm which files are read and that paths cannot be influenced by untrusted input to reach sensitive locations.
The component writes or deletes files on disk.
shutil.move(output_file_name, session_file_name)
os.unlink(output_file_name)
os.unlink(self._key_to_file(session_key))
os.unlink(full_path)
os.unlink(full_path)
with open(fd, "wb") as f:
os.remove(tmp_path)
with open(self._key_to_file(key, version), "r+b") as f:
os.remove(fname)
copystat(old_file_name, new_file_name)
copymode(old_file_name, new_file_name)
os.remove(old_file_name)
os.remove(name)
os.remove(content.temporary_file_path())
os.remove(temp_location)
self.stream = open(self._get_filename(), "ab")
with open(self.work_path, "w", encoding="utf-8") as fp:
os.unlink(self.work_path)
with open(potfile, "a", encoding="utf-8", newline="\n") as fp:
with open(potfile, "w", encoding="utf-8") as fp:
os.unlink(pot_path)
with open(pofile, "w", encoding="utf-8") as fp:
open(init_path, "w").close()
with open(writer.path, "w", encoding="utf-8") as fh:
os.remove(prev_path)
Why it matters: Usually legitimate, but worth confirming the paths can't be controlled by untrusted input.
Fix: Confirm which files are written/deleted and that paths cannot be influenced by untrusted input.
The component makes outbound network requests.
from urllib.request import url2pathname
return url2pathname(relative_url)
import smtplib
from urllib.request import build_opener
opener = build_opener()
return responses.get(self.status_code, "Unknown Status Code")
Why it matters: Usually legitimate, but confirm the destinations are expected and no sensitive data leaves.
Fix: Confirm the destination hosts are expected and that no sensitive data is sent off-host.
A short-lived, scoped, assumed identity was detected - an STS AssumeRole / session token, a cloud managed or workload identity, an impersonated service account, a projected Kubernetes service-account token, or a dynamic-secret broker. Tools authenticate with a narrowly-scoped credential that expires, rather than a long-lived embedded service credential. (2 occurrence(s) shown as evidence).
conn_params.pop("assume_role", None)if new_role := self.settings_dict["OPTIONS"].get("assume_role"):Fix: A scoped, short-lived identity is the smallest-blast-radius execution context. Confirm the assumed role / requested scope grants only the permissions the tool needs, and that the token lifetime is minimal.
How attackers abuse these capabilities
Interactive labs on the attack class behind the rules above. They show the technique, not anything found in Django.
Maintain Django?
The free Claude Code plugin scans each npm, PyPI or MCP package with this report's open-source engine before the install command runs. It runs on your machine and needs no account.
Check your own component
Run the same evidence-backed scan on any MCP server, agent skill, or package.
Scan your own componentHow we determine this: deterministic static analysis (regex + AST), evidence-anchored, no code execution. Methodology →