security

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package security implements security checks. It runs in two passes.

The default pass is per-page and passive: the three baseline response headers (HSTS, CSP, X-Content-Type-Options) and forms whose action downgrades to http://.

The opt-in pass is the security audit — transport-layer and cookie hygiene: the TLS protocol version and cipher suite, the certificate chain the server presented (expiry, signature and key strength, completeness), Set-Cookie attributes, and the deeper response-header policy checks (HSTS quality, framing protection, referrer policy, software version disclosure). It is enabled with WithAudit, wired to the `security_audit` config flag, so the default analyzer stays minimal.

Everything the audit inspects is server configuration, identical across every page a host serves, so audit findings are aggregated and emitted once per host — reported against the first page crawled on that host — rather than repeating on all of them. The baseline per-page checks keep their existing per-page behaviour.

The audit reads only what the crawl already fetched: it opens no extra connections and sends no probes. That bounds what it can see — a certificate so broken that Go's TLS stack refuses the handshake produces a fetch error, not an audit finding.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

type Analyzer struct {
	// contains filtered or unexported fields
}

Analyzer performs security header and insecure-form checks, plus the opt-in TLS, certificate, and cookie audit.

func New

func New(opts ...Option) *Analyzer

New returns a new security analyzer.

func (Analyzer) Analyze

func (a Analyzer) Analyze(_ context.Context, result *crawler.Result) []analyze.Issue

func (Analyzer) Description

func (Analyzer) Description() string

func (Analyzer) Name

func (Analyzer) Name() string

type Option added in v0.5.0

type Option func(*Analyzer)

Option configures the analyzer.

func WithAudit added in v0.5.0

func WithAudit(on bool) Option

WithAudit enables the opt-in security audit: TLS/certificate inspection, Set-Cookie attribute checks, and deeper response-header hygiene. Off by default, since these findings speak to server and platform configuration rather than to the on-page SEO work that drives a default crawl.

Jump to

Keyboard shortcuts

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