Evidence

Event handler forwards input to save lines 15–29
15:50… jpg,.png,.webp',
16 max_entries=1, max_file_size=5_000_000)
17
18 def handle_event(self, event, params):
19 if event == 'save':
20 for entry in self.consume_uploaded_entries('avatar'):
21 # Use safe_client_name for the storage key (basename-only,
22 # path-traversal-neutralised). entry.client_name is the RAW
23 # attacker-controlled filename — never put it in a path.
⋯6 lines
Text references a numbered CWE weakness lines 31–34
31:30… ct-store key) — that is a path/object-key
32 injection sink (CWE-22 / CWE-73). Use ``entry.safe_client_name`` for
33 paths. For *display*, ``client_name`` is fine through HTML auto-escaping
34 …
imports os lines 34–53
34:11… escape()``) — never render it with ``|safe`` (see system check S007).
35"""
36
37import io
38import logging
39import os
40import struct
41import tempfile
42import time
43import unicodedata
44import uuid
45from dataclasses import dataclass, field
46from pathlib import Path
47from typing import Any, Dict, Generator, List, Optional, Set, Tuple, Type
48
49try:
50 from .._exposure_providers import UPLOADS_PROVIDER
51except ImportError: # pragma: no cover - loaded standalone, outside the djust package
52 # python/tests/test_uploads.py loads this module without djust/__init__.py
53 # (no Django/channels). Pr …
References the PNG file signature bytes lines 63–73
63:37… tes, int]]] = {
64 # (magic_bytes, offset)
65 "image/jpeg": [(b"\xff\xd8\xff", 0)],
66 "image/png": [(b"\x89PNG\r\n\x1a\n", 0)],
67 "image/gif": [(b"GIF87a", 0), (b"GIF89a", 0)],
68 "image/webp": [(b"RIFF", 0), (b"WEBP", 8)], # Must match both
69 "image/svg+xml": [(b"<svg", 0), (b"<?xml", 0)],
70 "application/pdf": [(b"%PDF", 0)],
71 "application/zip": [(b"PK\x03\x04", 0)],
72 "video/mp4": [(b"ftyp", 4)],
73 "audio/mpeg": [(b"\xff\xfb" …
Blocklist or denylist identifier lines 97–101
97:54… =========================
98# Active-content (browser-executable) denylist — Finding #20
99# ============================================================================
100#
101# Formats a browser will *exec …

Showing the top 5 files — 6 more files (173 regions) not shown.

No evidence locations were recorded for this file. Raw result

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.