httpsecurity

package
v0.1.0-c02.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 9 Imported by: ? 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 httpsecurity provides a provider-neutral, read-only audit of the public HTTP transport and response-header boundary for CloudRING surfaces.

Index

Constants

View Source
const (
	// CanaryMaxAgeSeconds is the exact HSTS lifetime installed while a hostname
	// is still in its reversible canary phase.
	CanaryMaxAgeSeconds uint64 = 300
	// SteadyMinAgeSeconds is the minimum HSTS lifetime after steady promotion.
	SteadyMinAgeSeconds uint64 = 31_536_000
)

Variables

View Source
var ErrInvalidConfiguration = errors.New("invalid HTTP security audit configuration")

ErrInvalidConfiguration is intentionally opaque so an invalid URL or target identifier cannot be reflected into logs.

Functions

This section is empty.

Types

type Mode

type Mode string

Mode selects the redirect and HSTS promotion policy.

const (
	ModeCanary Mode = "canary"
	ModeSteady Mode = "steady"
)

type Report

type Report struct {
	SchemaVersion string       `json:"schema_version"`
	TargetID      string       `json:"target_id"`
	Mode          Mode         `json:"mode"`
	Surface       Surface      `json:"surface"`
	Passed        bool         `json:"passed"`
	Rules         []RuleResult `json:"rules"`
}

Report is safe to persist or print. TargetID is restricted to a small safe identifier alphabet before any network request is made.

func Audit

func Audit(ctx context.Context, client *http.Client, target Target, mode Mode) (Report, error)

Audit performs two read-only GET requests: one over HTTP to inspect the redirect response without following it, then one directly over HTTPS to inspect TLS and response headers. The returned report is sanitized by construction.

type RuleResult

type RuleResult struct {
	ID     string `json:"id"`
	Passed bool   `json:"passed"`
}

RuleResult exposes only a stable rule identifier and its result. It never contains a URL, response value, body, or transport error.

type Surface

type Surface string

Surface selects the response-header policy for an interactive browser or an API response.

const (
	SurfaceBrowser Surface = "browser"
	SurfaceAPI     Surface = "api"
)

type Target

type Target struct {
	ID      string
	URL     string
	Surface Surface
}

Target identifies one HTTPS surface. URL is input only and is deliberately absent from Report.

Jump to

Keyboard shortcuts

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