main
md 45 lines 2.05 KB
Rendered Raw
1 # security.py DOX
2
3 ## Purpose
4
5 - Own the `security.py` helper module.
6 - This module contains small security helpers such as filename sanitization.
7 - Keep this file-level DOX profile synchronized with `security.py` because this directory is intentionally flat.
8
9 ## Ownership
10
11 - `security.py` owns the runtime implementation.
12 - `security.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation.
13 - Top-level functions:
14 - `safe_filename(filename: str) -> Optional[str]`
15 - Notable constants/configuration names: `FORBIDDEN_CHARS_RE`, `WINDOWS_RESERVED`, `FILENAME_MAX_LENGTH`.
16
17 ## Runtime Contracts
18
19 - Helper modules own reusable framework APIs and must preserve public callers unless all callers, tests, and docs are updated together.
20 - Update this file whenever public functions, classes, persistence behavior, path/security assumptions, side effects, or cross-module contracts change.
21 - Observed side-effect areas: filesystem reads, filesystem deletion.
22 - Imported dependency areas include: `pathlib`, `re`, `typing`, `unicodedata`.
23
24 ## Key Concepts
25
26 - Important called helpers/classes observed in the source: `re.compile`, `frozenset`, `unicodedata.normalize`, `FORBIDDEN_CHARS_RE.sub`, `filename.lstrip.rstrip`, `Path`, `join`, `stem.upper`, `filename.lstrip`.
27 - Keep request/response, tool, or helper semantics documented here at the same time as source changes.
28
29 ## Work Guidance
30
31 - Preserve public helper APIs used by core code and plugins unless every caller is updated.
32 - Keep path, auth, secret, persistence, network, and subprocess behavior explicit and bounded.
33 - Prefer adding cohesive helper functions here only when behavior is reused across modules.
34
35 ## Verification
36
37 - Run targeted tests for changed helper behavior; run security regressions for auth, filesystem, WebSocket, tunnel, upload, or secret-handling helpers.
38 - Related tests observed by source search:
39 - `tests/test_fastmcp_openapi_security.py`
40 - `tests/test_image_get_security.py`
41 - `tests/test_ws_security.py`
42
43 ## Child DOX Index
44
45 No child DOX files.