WAF Bypass && getUser max redirect#310
Merged
clins1994 merged 11 commits intoMathieu2301:mainfrom Apr 11, 2026
Merged
Conversation
Contributor
Author
|
where are you @Mathieu2301 |
Collaborator
|
@OguzBey Hey! I went ahead and added a description and test plan to this PR since it was missing one. Let me know if anything needs adjusting. Generated automatically by Claude. |
- Change error message to "possible WAF or geo-restriction" since redirect loops are caused by WAF/geo-blocking, not invalid credentials - Add unit test verifying redirect loop is capped at ≤10 calls Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace ++ with += 1 (no-plusplus) - Add eslint-disable for global-require (needed for cache patching) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
clins1994
approved these changes
Apr 11, 2026
- Provide default browser-like headers (required by TradingView WAF) - Allow users to override via clientOptions.headers - Update User-Agent to Windows/Chrome 131 (more common, more recent) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator
|
@OguzBey this should do it. tested it with my TradingView account and added unit tests |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Thanks |
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.
Summary
clientOptions.headers— user values override defaultsfrom=chartquery param to WebSocket URLgetUser()to prevent infinite redirect loops caused by WAF or geo-restrictionsUsage
Before (infinite redirect loop in
getUser)sequenceDiagram participant Client participant TradingView Client->>TradingView: getUser(session) → GET / TradingView-->>Client: 302 → /accounts/signin/ Client->>TradingView: getUser(session) → GET /accounts/signin/ TradingView-->>Client: 302 → / Client->>TradingView: getUser(session) → GET / TradingView-->>Client: 302 → /accounts/signin/ Note over Client,TradingView: ♻️ Infinite loop → OOM crashAfter (redirect protection)
sequenceDiagram participant Client participant TradingView Client->>TradingView: getUser(session, redirectCount=0) → GET / TradingView-->>Client: 302 → /accounts/signin/ Client->>TradingView: getUser(session, redirectCount=1) → GET /accounts/signin/ TradingView-->>Client: 302 → / Note over Client,TradingView: ...redirectCount increments each hop... Client->>TradingView: getUser(session, redirectCount=5) → GET / TradingView-->>Client: 302 → /accounts/signin/ Client->>Client: redirectCount > 5 → throw Error Note over Client: "Too many redirects - possible WAF or geo-restriction"Test plan
clientOptions.headersoverrides defaultsgetUser()works with valid session/signature credentialsgetUser()throws after 5 redirects instead of looping foreverfrom=chartquery param addition does not break existing chart sessionsTest notes
Key finding: TradingView now requires browser-like headers for WebSocket connections. Without them, connections hang even from non-restricted regions. Default headers are necessary, not optional.
Redirect protection (TDD verified):
main(before)pr-310(after)"Too many redirects"after 6 calls, 2msCI failures (
builtInIndicator > gets volume profile) are pre-existing and unrelated to this PR.This description was automatically generated by Claude.