Skip to content

feat: add request.post_json command for same-origin JSON fetch via browser - #1745

Open
baotran152 wants to merge 1 commit into
FlareSolverr:masterfrom
baotran152:feat/request-post-json
Open

feat: add request.post_json command for same-origin JSON fetch via browser#1745
baotran152 wants to merge 1 commit into
FlareSolverr:masterfrom
baotran152:feat/request-post-json

Conversation

@baotran152

Copy link
Copy Markdown

What

Adds a new cmd value request.post_json that sends a JSON POST request
from within the browser's page context using fetch(), after Cloudflare
challenge resolution.

Why

Some endpoints (e.g. sploitus.com/search) require an interactive Cloudflare
Turnstile token and session cookies that are only present in a live, solved
browser session. A plain HTTP POST from the host cannot carry those credentials.
By running fetch() from inside Chrome after the challenge is solved, the
request is same-origin and all cookies and tokens are included automatically.

Key changes

  • dtos.py: added jsonBody: str = None field to V1RequestBase
  • flaresolverr_service.py: added request.post_json dispatcher branch
  • new _cmd_request_post_json handler:
    1. Navigates Chrome to the target origin via _resolve_challenge (solves CF)
    2. Retrieves the live driver from the session store
    3. Executes an async fetch() POST with Content-Type: application/json via execute_async_script
    4. Returns the raw {s: <status>, b: <body>} envelope as solution.response

The session parameter is mandatory - the caller must create a session first
and pass its ID, so the driver is preserved between the navigation and the fetch.

Testing

Tested against https://sploitus.com/search (Cloudflare Bot Management +
interactive Turnstile). The command navigated to the origin, solved the
challenge, and returned HTTP 200 with valid JSON exploit results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant