policy

package
v1.234.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package policy applies policy admission to the functions a Go template can call: every function and namespace is wrapped so a call is admitted against the template file it came from, and functions that read files, URLs or other sources confine those reads to what the policy allows.

Index

Constants

View Source
const Engine = "go-template"

Engine is the template engine name reported to policy admission.

Variables

This section is empty.

Functions

func Datasource

func Datasource(d *render.Data, file, alias string, raw bool, args ...string) (any, error)

func FuncsWrapper

func FuncsWrapper(file string) render.FuncsWrapper

FuncsWrapper returns the template engine hook that applies policy admission to every function a template rendered from file can call, reading datasources through the render's own definitions.

func TemplateFuncs

func TemplateFuncs(original template.FuncMap, file string, d *render.Data) (template.FuncMap, error)

TemplateFuncs wraps a private map, never the cached Sprig map. Namespace constructors are admission points too, including namespace values saved in template variables.

Types

type SourceFileBinder

type SourceFileBinder interface {
	BindSourceFile(file string) any
}

SourceFileBinder is implemented by a template namespace (Atmos's `atmos` namespace) that performs its own admission checks: it returns a copy bound to the template file the calls come from, so those checks attribute each call to the right file.

Jump to

Keyboard shortcuts

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