audit

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 4 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 audit records security-relevant events to the application log: rejected credentials and denied bucket access.

It sits in its own package because the events are emitted from two places that do not otherwise share code, the auth middlewares in cmd and the write handlers, and because it cannot live in pkg/observability: reaching the trusted client IP means importing pkg/middleware, and middleware imports service, which imports observability.

Two rules hold for everything here:

  • No credential material is ever logged, in any form, not truncated and not hashed. Only the reason a request was rejected and the identity it resolved to, which is a bucket name and never a secret.
  • Successful authentication is not logged. On a CDN that is the hot path, and the access log already covers it.

Index

Constants

View Source
const (
	EventAuthFailure        = "auth.failure"
	EventScopedTokenOnAdmin = "auth.scoped_token_on_operator_route"
	EventBucketAccessDenied = "auth.bucket_access_denied"
)

Event names are stable identifiers so log queries and alerts can key on them without matching free text.

Variables

This section is empty.

Functions

func AuthFailure

func AuthFailure(r *http.Request, reason string)

AuthFailure records a credential that was rejected on an authenticated route. reason comes from the auth sentinels (no token, malformed header, invalid token), which describe the failure without echoing what was sent.

func BucketAccessDenied

func BucketAccessDenied(r *http.Request, tokenBucket, requestedBucket string)

BucketAccessDenied records a bucket-scoped token reaching for a bucket it does not own. Both bucket names are logged: the pair is what makes the event actionable, since it separates a client pointed at the wrong bucket from someone probing for other tenants.

func ScopedTokenOnOperatorRoute

func ScopedTokenOnOperatorRoute(r *http.Request, tokenBucket string)

ScopedTokenOnOperatorRoute records a valid bucket-scoped token presented to a route that only accepts the general token. This is logged apart from a plain failure because it is almost always a misconfigured client rather than an attack, and the two need different responses from an operator.

Types

This section is empty.

Jump to

Keyboard shortcuts

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