Repository navigation
Conversation
Keep a per-request redirect count across target loader restarts. Reject redirects beyond Chromium's limit with ERR_TOO_MANY_REDIRECTS. Co-authored-by: yangzuohui <65477566+zuohuiyang@users.noreply.github.com>
There was a problem hiding this comment.
LGTM. This is a small backport that adds a per-request redirect cap and a matching test. I reviewed it from a standalone clone, so I couldn't see the upstream code, and I found nothing to flag.
What was reviewed:
ContinueToBeforeRedirectinshell/browser/net/proxying_url_loader_factory.ccis reached by all three redirect paths: a network redirect, a redirect from the header client's override headers, and aredirectURLfromonBeforeRequest. So the new counter, which lives onInProgressRequest, keeps counting when the target loader restarts.- On the 21st redirect,
OnRequestErrorhandles the failure cleanly. It reports to the target client, firesonErrorOccurredand removes the request. The earlyreturnstops anything from touching the deleted object. - The new spec puts no
expect()calls inside listeners, which followsspec/CLAUDE.md. TheonBeforeRequesthandler is cleared by the existingafterEachin that describe block, and the 21 calls / 20 redirects it expects match the off-by-one in the check.
Extended reasoning...
The change adds a 7-line redirect counter in Electron's webRequest proxying URL loader, a header field and one new spec. No CODEOWNERS entry covers these files. It narrows the network-interception path instead of widening it, and touches no auth, IPC or renderer-input handling. I approved because the fix is small and self-contained and is a bot backport with a deterministic regression test. The timeline shows no open reviewer objections. The value of net::URLRequest::kMaxRedirects comes from upstream Chromium code that this checkout doesn't include, but the test's expected counts pin it to 20.
|
Release Notes Persisted
|
Backport of #55623
See that PR for details.
Notes: Fixed renderer crashes caused by unbounded
webRequestredirect loops.