sameorigin

package
v0.16.397 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sameorigin tells a request of a page of another origin from one of the machine's own pages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CrossSite

func CrossSite(r *http.Request) bool

CrossSite says whether a request comes from a page of another origin. It guards what a person's session must not do for any page that asks: the sockets, which open a terminal on the machine, and the writes beside them. A browser sends the session cookie to a request of any site, so the cookie alone proves nothing about who asks.

Sec-Fetch-Site is the browser's own word and decides alone when it is there: same-origin (or none: the person typed the address) passes, same-site (a sibling subdomain, a preview stand) and cross-site do not. Without it, an Origin header must name the host asked (or the host a proxy in front was asked as). A request with neither is not a browser's, and it has its own credentials to show.

func Refuse

func Refuse(w http.ResponseWriter, r *http.Request) bool

Refuse answers a request CrossSite names with 403 and says it did; the sockets call it before they upgrade.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL