Can a Browser or Link Scanner Trigger a GET Action Before Anyone Clicks?

Learn how browser prefetch and link scanners can request URLs before a click, and how to protect state-changing actions with safer HTTP patterns.

Published
Reading time
7 min read
Can a Browser or Link Scanner Trigger a GET Action Before Anyone Clicks?
On this page

A browser prefetch or an automated link scanner can request a URL before a person clicks it. If that URL performs an action on GET—such as deleting a record or changing an account setting—the request itself can trigger the action.

The solution is to make GET requests safe and put state-changing actions behind an explicitly authorized request. This article explains the distinction and provides a harmless local experiment.

Key Takeaways

  • A request for a link is not proof that a person clicked it. Browsers and automated clients can request URLs for other reasons.
  • GET is a safe HTTP method: the client does not request a state change by using it. Idempotent is a different property; an operation can be idempotent but unsafe.
  • Use a GET request to display an action or confirmation page, then a form submission or other authorized request to perform the change.
  • Do not depend on confirmation pages alone for security. Authentication, authorization, CSRF protection, and replay handling may also be necessary.

Why a request can arrive before a click

Navigation is a request made to load a destination, such as when a person follows a link. Prefetching is a request made in anticipation of a possible future need; it may happen even if the person never visits the destination. Automated link scanning is a separate activity: a client examines links, for example as part of a security or quality-checking workflow. A scanner might use HEAD, GET, or other behavior depending on its implementation.

These mechanisms have different purposes, but a server may see a request for the same URL in each case. Request headers and logs can provide clues, but they should not be treated as reliable proof of a human click or authorization.

For example, a link to /account/delete is dangerous if requesting it immediately deletes the account. A scanner does not need to understand the link's purpose for the server to execute that GET handler.

Current browser documentation and RFC 9110 were not available for review in this run. The HTTP explanations below are a general summary, not a claim that particular browser versions will prefetch a particular link. Check the documentation for your target browsers and test your own application before relying on any speculation feature.

Advertisement

Safe and idempotent HTTP methods

RFC 9110 distinguishes two useful properties:

  • Safe means the client does not request a change to the server's state. GET, HEAD, OPTIONS, and TRACE are defined as safe. A server can still produce incidental effects such as request logs; those are not the action the client requested.
  • Idempotent means that multiple identical requests have the same intended effect as one request. Safe methods are idempotent; PUT and DELETE are also defined as idempotent, although they are not safe.

These properties describe method semantics, not a guarantee that every application implements them correctly. A GET endpoint that deletes a record violates the expected safety of GET even if deleting the same record twice has the same final effect. Conversely, POST is not guaranteed to be idempotent: submitting the same payment request twice, for example, might create two operations unless the application has duplicate-request protection.

A useful design is:

  1. GET /account/delete displays information and a confirmation form; it does not delete the account.
  2. An authorized POST /account/delete performs the deletion after the required checks.
  3. A subsequent GET displays the result without repeating the deletion.

Changing a URL from GET to POST is not sufficient by itself. The server must also check whether the requester is allowed to perform the action and protect against unwanted cross-site submissions where applicable.

Reproduce the requests locally

This experiment uses only a local Python standard-library server. It logs requests to a harmless /probe endpoint and includes a separate form that increments an in-memory counter. The code has not been executed in this run; review and run it in your own environment. Use it only on your own machine or a system you are authorized to test.

Save this as request_lab.py:

from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import urlsplit


class Handler(BaseHTTPRequestHandler):
    counter = 0

    def log_message(self, format, *args):
        # reply() prints a compact request log instead.
        pass

    def reply(self, status, text):
        print(f"{self.command} {self.path} -> {status}", flush=True)
        body = text.encode("utf-8")
        self.send_response(status)
        self.send_header("Content-Type", "text/html; charset=utf-8")
        self.send_header("Content-Length", str(len(body)))
        self.end_headers()
        if self.command != "HEAD":
            self.wfile.write(body)

    def read_request(self):
        path = urlsplit(self.path).path
        if path == "/":
            self.reply(200, f"""<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Request lab</title>
  <link rel="prefetch" href="/probe?source=prefetch">
</head>
<body>
  <h1>Request lab</h1>
  <p>Counter: {type(self).counter}</p>
  <p><a href="/probe?source=link">Open the harmless probe</a></p>
  <form action="/action" method="post">
    <p>Confirm that you want to increment the local counter.</p>
    <button type="submit">Increment counter</button>
  </form>
</body>
</html>""")
        elif path == "/probe":
            self.reply(200, "Harmless probe; no application state changed.")
        else:
            self.reply(404, "Not found")

    def do_GET(self):
        self.read_request()

    def do_HEAD(self):
        self.read_request()

    def do_POST(self):
        length = int(self.headers.get("Content-Length", "0"))
        self.rfile.read(length)
        if urlsplit(self.path).path != "/action":
            self.reply(404, "Not found")
            return
        type(self).counter += 1
        self.reply(200, f"Counter is now {type(self).counter}. <a href='/'>Back</a>")


if __name__ == "__main__":
    with HTTPServer(("127.0.0.1", 8000), Handler) as server:
        print("Listening on 127.0.0.1:8000; press Ctrl+C to stop", flush=True)
        try:
            server.serve_forever()
        except KeyboardInterrupt:
            pass

Start it with python3 request_lab.py, then open http://127.0.0.1:8000/ in a browser and watch the terminal. The page contains a prefetch hint for /probe. A browser may request it without a click, but the hint does not guarantee a request: behavior depends on the browser and its conditions. If no request appears, that does not prove prefetching is impossible in another environment.

Click the probe link and compare the logged path and query with any earlier request. Caching or other browser behavior can affect what appears in the server log. The query labels help distinguish the two URLs in this lab; they are not a reliable way to identify request intent in a real application.

You can also simulate two simple forms of automated checking from another terminal:

curl -I 'http://127.0.0.1:8000/probe?source=scanner-head'
curl 'http://127.0.0.1:8000/probe?source=scanner-get'

The first command sends HEAD and the second sends GET. Both should reach the local server without a browser click. This is a simulation, not a test of any particular scanner. Submit the form separately to see the POST request increment the counter. Stop the server with Ctrl+C; the counter is lost when it stops.

The server is a teaching aid, not production code. In particular, it has no authentication, CSRF protection, request-size limits, or durable storage, and it binds only to the local loopback address.

Advertisement

Make confirmation and authorization explicit

For an action a person must approve, use a normal link to a GET confirmation page and a clearly labelled submit button on that page. A native HTML form can send the state-changing POST without requiring JavaScript. Explain the consequence before the button, especially for destructive or irreversible actions.

On the server:

  • Authenticate the requester and authorize the specific action and target record on the state-changing request.
  • Apply appropriate CSRF defenses for browser requests authenticated with cookies. A confirmation page alone is not a CSRF defense.
  • Validate submitted data and require reauthentication or another appropriate confirmation for sensitive actions.
  • Plan for retries and duplicate submissions. Where an action must happen at most once, use application-level deduplication or an idempotency mechanism appropriate to that action.
  • Avoid changing application state in GET or HEAD handlers, including handlers reached through redirects. Audit legacy action links and email links as well as visible navigation.

For accessibility, use a link for navigation and a button for the action. Give the button a specific accessible name, make the confirmation text available to assistive technology, and ensure the flow works with a keyboard. If using a custom dialog, manage focus and provide an accessible way to cancel; a separate confirmation page can avoid some of that complexity. Do not make the action depend only on hover or a pointer gesture.

A form makes the intended interaction clear, but it does not prove that a human submitted it. Automated clients can submit forms too, so the server-side checks remain essential.

Common Mistakes

  • Putting the action in a GET handler: A link preview, automated check, or speculative request can then perform the action.
  • Assuming idempotent means harmless: Repeated deletion may be idempotent, but the first deletion still changes state.
  • Treating a prefetch hint as a command: Whether a browser makes the request is environment-dependent; verify it rather than assuming it will or will not happen.
  • Relying on client-side confirmation alone: Requests can be sent without using your page's JavaScript.
  • Using a non-GET method as the only defense: POST does not automatically provide authorization, CSRF protection, or duplicate-request handling.

Best Practices

Audit links that contain verbs such as delete, approve, unsubscribe, or reset, and inspect the server handlers behind them. Make their GET and HEAD paths safe, then move requested changes to appropriately protected action endpoints. Add tests that issue GET and HEAD without user interaction and verify that protected application state remains unchanged.

Conclusion

A GET request can arrive without a click, and its arrival is not evidence of consent. Design links to retrieve or display information; require a separately authorized state-changing request for actions.

What would your domain sell for?

A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.