codesign

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Rendered for darwin/amd64

Overview

Package codesign inspects the code signature and embedded entitlements of on-disk Mach-O binaries and app bundles via the Security framework's SecStaticCode APIs, including verification of embedded sandboxed helper tools.

Index

Constants

This section is empty.

Variables

View Source
var IncompatibleWithInheritEntitlements = []string{
	entitlements.GetTaskAllow,
}

IncompatibleWithInheritEntitlements lists entitlements that must not appear on helper tools signed with com.apple.security.inherit.

View Source
var RequiredHelperToolEntitlements = []string{
	entitlements.AppSandbox,
	entitlements.Inherit,
}

RequiredHelperToolEntitlements are the only entitlements Apple recommends for embedded sandbox helper tools.

Functions

func EmbeddedHelperToolPath

func EmbeddedHelperToolPath(appBundlePath, toolName string) string

EmbeddedHelperToolPath returns the recommended helper tool location inside an app bundle: Contents/MacOS/<toolName>.

func EntitlementValueAtPath

func EntitlementValueAtPath(path, key string) (any, error)

EntitlementValueAtPath returns one embedded entitlement value from path.

func EntitlementsFromPath

func EntitlementsFromPath(path string) (map[string]any, error)

EntitlementsFromPath reads the embedded entitlements dictionary from a signed binary.

func ExpectedHelperToolIdentifier

func ExpectedHelperToolIdentifier(appBundleIdentifier, toolName string) string

ExpectedHelperToolIdentifier returns the conventional code-signing identifier for a helper tool embedded in appBundleIdentifier.

func HasEntitlementAtPath

func HasEntitlementAtPath(path, key string) (bool, error)

HasEntitlementAtPath reports whether path's code signature includes a Boolean entitlement. A missing entitlement returns (false, nil).

func IsHelperToolAtPath

func IsHelperToolAtPath(path string) (bool, error)

IsHelperToolAtPath reports whether path is signed as a sandbox-inheriting helper.

func IsSandboxedAtPath

func IsSandboxedAtPath(path string) (bool, error)

IsSandboxedAtPath reports whether path's code signature includes App Sandbox. A missing entitlement returns (false, nil).

func SigningIdentifierAtPath

func SigningIdentifierAtPath(path string) (string, error)

SigningIdentifierAtPath returns the code signing identifier for path.

func VerifySandboxedAppWithHelper

func VerifySandboxedAppWithHelper(appBundlePath, toolName string) (app Verification, helper HelperToolVerification, err error)

VerifySandboxedAppWithHelper validates a sandboxed app bundle and one embedded helper.

Types

type HelperToolVerification

type HelperToolVerification struct {
	Path                string
	SigningIdentifier   string
	Sandboxed           bool
	InheritsSandbox     bool
	Entitlements        map[string]any
	ExtraEntitlements   []string
	IncompatiblePresent []string
	Issues              []string
}

HelperToolVerification reports whether an embedded helper tool meets Apple's sandbox inheritance signing requirements.

func ValidateHelperToolEntitlements

func ValidateHelperToolEntitlements(ents map[string]any) HelperToolVerification

ValidateHelperToolEntitlements evaluates entitlements against Apple's embedded helper tool guidance without reading code signatures from disk.

func VerifyEmbeddedHelperTool

func VerifyEmbeddedHelperTool(appBundlePath, toolName string) (HelperToolVerification, error)

VerifyEmbeddedHelperTool validates a helper tool embedded in appBundlePath.

func VerifyHelperToolAtPath

func VerifyHelperToolAtPath(path string) (HelperToolVerification, error)

VerifyHelperToolAtPath validates helper tool entitlements at path.

func (HelperToolVerification) Valid

func (verification HelperToolVerification) Valid() bool

Valid reports whether the helper tool satisfies Apple's minimum requirements.

type Verification

type Verification struct {
	Sandboxed    bool
	Entitlements map[string]any
}

Verification summarizes App Sandbox state read from a signed binary.

func VerifyAtPath

func VerifyAtPath(path string) (Verification, error)

VerifyAtPath reads signing entitlements and derives sandbox status from path.

Jump to

Keyboard shortcuts

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