The access-token endpoint accepted unlimited password attempts; the
only existing rate limiters are single-instance helpers for outbound
site requests. Add app/application/security/throttle.py, an in-memory
LoginThrottle keyed by (client address, normalized username) that locks
for 30s after five consecutive failures and doubles the lockout up to
15 minutes. The endpoint answers 429 with Retry-After while locked,
counts only real credential failures (an MFA challenge after a correct
password does not count), and clears the record on success.
X-Forwarded-For is deliberately not trusted because there is no
trusted-proxy setting; behind the bundled nginx all requests share one
address, so the key degrades to per-username throttling, which is the
dimension brute-force protection needs. Sync the dependency snapshot
and architecture metrics for the new module.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
test_chain_rate_limit.py and test_system_notification_dispatch.py
installed a bare qbittorrentapi/transmission_rpc/psutil ModuleType into
sys.modules at import time with sys.modules.setdefault. When either file
is collected before a test that imports the real package in the same
shard (for example tests/test_downloader_add_failure_message.py and its
TorrentDictionary import), the placeholder wins and collection fails
with "cannot import name ... (unknown location)". Any change to the test
file set reshuffles the six CI shards and can surface this.
Use app.testing.bootstrap.ensure_optional_stub, which keeps the real
module when it is installed, and convert both unittest.TestCase files to
pytest-native functions as the testing guide requires when touching a
TestCase file. Record the resulting lower Ruff watermark.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ALLOWED_HOSTS defaults to ["*"] and the CORS middleware always set
allow_credentials=True. Starlette echoes any request Origin with
Access-Control-Allow-Credentials in that combination, which lets every
site make credentialed cross-origin calls. resolve_cors_policy now
returns credentials=False for wildcard origins and keeps credentials
only when explicit origins are configured.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The POST helper docstring embedded a sample request that repeated the
_api_key2 constant as a hard-coded literal. Keep the key in one place
and describe the request shape instead.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The direct Adapter imports in application/rss.py were cleared when the
S2-L6 roadmap item was delivered (dependency-policy records zero
direct_adapter_imports). AGENTS.md still described them as an open
temporary debt; state the delivered target instead.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Pass the session owner's data context and memory to Web and compatible protocol agent factories. Cover task creation, listing, session reuse and subagent tool injection across the shared entrypoints.
Refs #6910
Keep strict binding lookup as the default and explicitly match alternative channel identifiers for the Agent API gateway. Reject ambiguous active-user matches and cover single-field bindings with database-backed tests.
Refs #6905
validate_download_save_path keeps path-first semantics and falls back to an
exact match on the configured download directory name, returning that
directory's root URI so every download entry point can save by alias.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Adopt a CUE only when at least one FILE reference resolves to a real
file in the audio directory. Legacy WAV-era cue sheets shipped inside
FLAC split-track releases previously blocked every track transfer with
"CUE 引用的文件名与当前音频不一致" (and broken-index cues did the same);
they are now ignored with an info log and organization falls back to
the files' own tags. Cross-directory references and cues that still
point at existing files keep the current strict behavior.
Refs: https://github.com/jxxghp/MoviePilot/issues/6888