- Location
- scripts/providers/bilibili.py:72
- Finding
- Automatic fallback accesses local Chrome cookies without code-enforced consent<![CDATA[
## Vulnerability Details
**File Location**: `scripts/providers/bilibili.py:72-80`, `scripts/providers/bilibili.py:89-105`, `scripts/providers/douyin.py:255-286`, `scripts/providers/youtube.py:64-71`, `scripts/providers/youtube.py:84-90`, and `scripts/providers/xiaohongshu.py:191-211`, `scripts/providers/xiaohongshu.py:452-475`
**Vulnerability Type**: Automatic access to browser authentication material
**Risk Level**: High
### Complete Code Snippet
```python
# scripts/providers/bilibili.py:72-80
def _extract_metadata(url: str) -> dict:
yt_dlp = _require_ytdlp()
commands = [
[yt_dlp, "--no-playlist", "--dump-single-json", url],
[yt_dlp, "--cookies-from-browser", "chrome", "--no-playlist", "--dump-single-json", url],
]
return json.loads(_run_first_successful(commands))
```
```python
# scripts/providers/youtube.py:64-71
def _extract_metadata(url: str) -> dict:
commands = [
_base_ytdlp_command() + ["--dump-single-json", url],
_base_ytdlp_command() + ["--remote-components", "ejs:github", "--dump-single-json", url],
_base_ytdlp_command()
+ ["--cookies-from-browser", "chrome", "--dump-single-json", url],
]
return json.loads(_run_first_successful(commands))
```
```python
# scripts/providers/douyin.py:255-263
def _extract_metadata_with_ytdlp(url: str) -> dict:
yt_dlp = _require_ytdlp()
commands = [
[yt_dlp, "--no-playlist", "--dump-single-json", url],
[yt_dlp, "--cookies-from-browser", "chrome", "--no-playlist", "--dump-single-json", url],
]
return json.loads(_run_first_successful(commands))
```
```python
# scripts/providers/xiaohongshu.py:191-211
# ---- Route 3: Chrome cookies ----
if _IS_REMOTE_ASSISTANT:
# Don't block remote tasks — report immediately
raise RuntimeError(
"Anonymous yt-dlp and public direct URL both failed. "
"Chrome Cookie auth is required but unavailable in remote mode. "
"Please run this download f
...[truncated 3347 chars]
- Remediation
- <![CDATA[
## Remediation Suggestions
1. Remove all automatic `--cookies-from-browser` entries from default fallback lists.
2. Add an explicit option such as:
```bash
--allow-browser-cookies
```
Keep it disabled by default and pass it to providers through an explicit typed option.
3. Require separate authorization for metadata and media operations. In particular, do not access browser cookies during `--metadata-only` unless the user specifically requests authenticated metadata.
4. Apply the remote/unattended restriction consistently to Douyin, Bilibili, YouTube, and Xiaohongshu. Prefer an explicit execution-context parameter over a module-level environment variable evaluated at import time.
5. Return a structured failure explaining that authenticated access is available but requires consent. The user or controlling Agent can then retry with the authorization flag.
6. Where practical, use a dedicated browser profile with minimal platform-specific credentials instead of the user's primary Chrome profile.
7. Continue to prohibit cookie export files and ensure subprocess output is filtered if future `yt-dlp` versions include sensitive diagnostics.
]]>