fix(download): scope cookies to target domain#385
Merged
jackwener merged 3 commits intojackwener:mainfrom Mar 24, 2026
Merged
Conversation
b793d9d to
56f8ab7
Compare
jackwener
approved these changes
Mar 24, 2026
Owner
jackwener
left a comment
There was a problem hiding this comment.
结论:方向正确,我已经直接在当前分支补了一个关键 follow-up,可以合入。
Review 摘要:
- ✅ direct HTTP path 的 cookie scoping / cross-domain redirect stripping 是对的
- ✅ CDP cookie domain filtering 从 substring match 改成 actual domain match 也是必要修复
- P1(已修):
stepDownload()里yt-dlp仍然只拿第一条 URL 的 cookies 给整批任务复用,mixed-domain batch 还会遗漏或串用 cookies
我已补到当前分支:
stepDownload()现在会收集整批yt-dlp目标域名,按域名提取 cookies,再做 dedupe 后生成cookiesFile- 补了 regression test,覆盖 mixed-domain
yt-dlpbatch 场景
本地验证已过:
npx vitest run src/download/index.test.ts src/pipeline/steps/download.test.ts src/browser/cdp.test.tsnpm run typechecknpm testnpm run build
follow-up commit: 56f8ab7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Scope browser cookies used by
downloadto the target domain and prevent cookie leakage across cross-domain redirects.This PR fixes the direct HTTP download path so it no longer forwards unrelated browser cookies, and adds regression coverage for mixed-domain batches and CDP cookie filtering.
Related issue: #9
Type of Change
Checklist
Documentation (if adding/modifying an adapter)
docs/adapters/(if new adapter)docs/adapters/index.mdtable (if new adapter)docs/.vitepress/config.mts(if new adapter)README.md/README.zh-CN.mdwhen command discoverability changedCliErrorsubclasses instead of rawErrorScreenshots / Output
Verification:
npx vitest run src/download/index.test.ts src/pipeline/steps/download.test.ts src/browser/cdp.test.tsnpx tsc --noEmitSummary:
cookiesandheaders.Cookie/headers.cookieon cross-domain redirectsnotexample.commatchingexample.com