preview

package
v0.1.0-beta Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: MIT Imports: 8 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 preview looks for credentials on a project's preview deployments.

Requirement five of this project's brief names "historical key exposure (Wayback, preview deployments)". The archive half has been implemented since early on. This is the other half, and it is a genuinely different channel: a preview build is a separate origin, usually with its own environment configuration, frequently pointing at the PRODUCTION database, and almost never watched. A key rotated in production can keep being served by a branch deployment nobody remembers.

WHAT IS AND IS NOT DISCOVERABLE, because the difference decides what this package can honestly claim.

Certificate Transparency does not help. Vercel, Netlify and Cloudflare Pages all serve preview hosts under their own wildcard certificates, so no per-host certificate is ever issued and crt.sh returns nothing. Measured against a real target: two names, both wildcards.

Netlify and Cloudflare Pages hostnames ARE derivable, because they embed the branch:

<branch>--<site>.netlify.app
deploy-preview-<n>--<site>.netlify.app
<branch>.<project>.pages.dev

A pinned branch list and a small range of preview numbers cover the common cases deterministically.

Vercel is NOT derivable. Its preview hosts are <project>-git-<branch>-<team>.vercel.app, and the team slug cannot be guessed from outside. Those have to be supplied by whoever knows them, which is why Options takes an explicit host list as well.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Candidates

func Candidates(site string, extra []string) []string

Candidates derives preview hostnames from a site plus any supplied explicitly. Sorted and deduplicated, so two runs probe the same names.

Types

type Options

type Options struct {
	// Site is the production site, used to derive candidate hostnames.
	Site string
	// Hosts are additional preview hostnames supplied by the operator. The
	// only way to reach a Vercel preview, whose team slug is not guessable.
	Hosts []string
	// CurrentKey is production's anon key, so a preview serving a DIFFERENT
	// key can be distinguished from one serving the same one.
	CurrentKey string
	Limiter    *client.Limiter
	// Timeout bounds each host fetch. Zero means discover's own default.
	//
	// It was declared and never used: never passed to discover.Run, never set
	// by the caller, so -timeout did not bind this stage at all and every host
	// got a 20-second default. With up to 23 derived hostnames that is seven
	// minutes an operator asked to be shorter. Every other stage was fixed for
	// this when the flag was introduced; this one arrived later and missed it.
	Timeout time.Duration
}

Options configures the sweep.

type Result

type Result struct {
	// Probed is every hostname tried, so a reader can see the search rather
	// than only its hits.
	Probed []string
	// Reachable are the hosts that answered at all.
	Reachable []string
	Findings  []finding.Finding
	Requests  int
}

Result is the outcome of the sweep.

func Run

func Run(ctx context.Context, o Options) Result

Run fetches each candidate and reports credentials found.

Jump to

Keyboard shortcuts

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