fill

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 37 Imported by: 0 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 fill is the native host. Product name nyc.veil.fill (plain JSON ping/match/fill/generate/save/enrollTotp). org.keepassxc.keepassxc_browser nacl remains in this binary and is not installed. We do not copy KeePassXC-Browser (GPL-3) and we do not use KeePassXC as the vault.

Wire: Chrome native messaging (uint32 LE + JSON). nyc.veil.fill does not box. Fill writes into the page. The password and passkey private key never return on an agent surface. save / enrollTotp are the same host: Accept required. The TOTP seed never sits in browser.storage.

Browser sign-in for the extension. need_login used to strand the human on login.veil.nyc with no way to hand the token back to the host. The host runs the same PKCE flow `veil human login` runs: authorize URL out to the extension, code caught on the localhost redirect, exchanged for an ID token, written to the token file the CLI's TokenFn already re-reads.

Index

Constants

View Source
const (
	Version        = "2.7.7"
	NativeHostName = "org.keepassxc.keepassxc_browser"
	JSONHostName   = "nyc.veil.fill"
	JSONVersion    = "1"
)
View Source
const (
	HostFile       = "native-host"
	HostConfigFile = "fill.json"
)
View Source
const AutoFillExtensionID = "nyc.veil.fill.AutoFill"

AutoFillExtensionID is the AutoFill credential-provider appex bundle id.

View Source
const BridgeLabel = "nyc.veil.fill.bridge"

BridgeLabel is the launchd job Safari's sandboxed appex reaches over <vault-home>/fill.sock. Appexes cannot spawn the host — the agent runs it.

View Source
const BridgeLockFile = "fill.lock"

BridgeLockFile names the advisory lock one fill bridge holds for its vault home. The socket path is not the lock — ServeBridge unlinks and rebinds it, so a second spawn steals it silently and the first idles forever. flock dies with the process: a crash frees the next spawn to win, no stale pidfile.

View Source
const HelperAppID = "nyc.veil.fill"

HelperAppID is the menu-bar app bundle id — the same sandbox rule applies, so the bridge places a socket in its container too.

View Source
const SafariExtensionID = "nyc.veil.fill.Extension"

SafariExtensionID is the appex bundle id. Its sandbox only reaches its own container, so the bridge places a second socket inside it — no entitlement exceptions needed, and the socket dies with the container.

View Source
const SocketFile = "fill.sock"

SocketFile is the unix socket a sandboxed client (the Safari web extension appex) uses to reach this host. The appex cannot spawn processes, so the browser-native exec model is replaced by a same-uid socket: file perms are the credential, frames are unchanged.

Variables

View Source
var TrustedPeer = &Peer{Attested: true}

TrustedPeer is the stdio/native-messaging context: the host process was spawned by the client itself, so the launch is the credential.

Functions

func ApplyHostConfig

func ApplyHostConfig(dir string) error

ApplyHostConfig sets blank env from fill.json. Existing env wins.

func AutoFillSocketPath

func AutoFillSocketPath(userHome string) string

AutoFillSocketPath is the socket inside the AutoFill appex's container.

func BootstrapBridgeAgent

func BootstrapBridgeAgent(userHome string) error

BootstrapBridgeAgent (re)starts the LaunchAgent written by InstallBridgeAgent. Lives at the CLI boundary so tests that exercise InstallOrigin never touch launchd.

func BridgeLock

func BridgeLock(vaultHome string) (io.Closer, error)

BridgeLock takes the exclusive bridge lock for vaultHome. A nil closer means another live bridge holds it — the caller must exit quietly. The returned closer must stay open for the process lifetime; closing it (or dying) releases the lock.

func BridgeSocketPaths

func BridgeSocketPaths(vaultHome, userHome string) []string

BridgeSocketPaths is every path the bridge listens on: the vault socket for CLI/debugging, and one container socket per sandboxed client.

func ChromeOrigin

func ChromeOrigin() string

func ConfigPath

func ConfigPath(vaultHome string) string

func DirBesideHost

func DirBesideHost() (string, error)

DirBesideHost is the vault dir when Chrome launched native-host.

func ExtensionManifestFirefox

func ExtensionManifestFirefox(chromeManifest []byte) ([]byte, error)

ExtensionManifestFirefox rewrites the Chrome MV3 manifest for Firefox: the pinned key is Chrome-only, the service worker becomes a scripts array (Firefox MV3 event pages — tab.js loads first, the importScripts call in background.js is guarded), and browser_specific_settings carries the id the native host manifest allowlists. strict_min_version 128 is the first Firefox with MAIN-world manifest content scripts (the passkeys bridge).

func ExtensionManifestSafari

func ExtensionManifestSafari(chromeManifest []byte) ([]byte, error)

ExtensionManifestSafari rewrites the Chrome MV3 manifest for Safari web extensions: the pinned key is Chrome-only, and the service worker becomes an event-page scripts array (tab.js first — same as Firefox). The id comes from the containing app's bundle, so there is no browser_specific_settings here; native messaging reaches the app handler, which forwards frames to the same Go host.

func FirefoxID

func FirefoxID() string

func HelperSocketPath

func HelperSocketPath(userHome string) string

HelperSocketPath is the socket inside the menu-bar app's sandbox container.

func HostPath

func HostPath(vaultHome string) string

func Install

func Install(bin, vaultHome, userHome string) error

func InstallBridgeAgent

func InstallBridgeAgent(env InstallEnv) error

InstallBridgeAgent registers the fill socket bridge as a per-user LaunchAgent and (re)starts it. macOS-only — a no-op elsewhere.

func InstallExtension

func InstallExtension(dist fs.FS, dir string) error

InstallExtension writes the embedded MV3 payload to dir — the stable path a human "load unpacked"s in chrome://extensions. The manifest key pins the extension id the native host manifest allowlists; flat files only.

func InstallExtensionFirefox

func InstallExtensionFirefox(dist fs.FS, dir string) error

InstallExtensionFirefox lays down the same payload with the transformed Firefox manifest (background scripts array, gecko id) — load it as a temporary add-on via about:debugging or package with `web-ext build`.

func InstallExtensionSafari

func InstallExtensionSafari(dist fs.FS, dir string) error

InstallExtensionSafari lays down the payload the Safari web-extension converter consumes — the same files with the Safari manifest. The containing .app is apps/fill-safari; this directory is its Resources input.

func InstallOrigin

func InstallOrigin(env InstallEnv) error

func JSONChromeOrigin

func JSONChromeOrigin() string

JSONChromeOrigin is apps/fill's unpacked ID (manifest key). [a-p]{32}.

func JSONFirefoxID

func JSONFirefoxID() string

func ManifestChrome

func ManifestChrome(hostPath string) []byte

func ManifestFirefox

func ManifestFirefox(hostPath string) []byte

func ManifestJSONChrome

func ManifestJSONChrome(hostPath string) []byte

func ManifestJSONFirefox

func ManifestJSONFirefox(hostPath string) []byte

func NativeHostArgs

func NativeHostArgs(args []string) []string

NativeHostArgs rewrites Chrome/Firefox's launch of the host binary into `fill`. The browser passes the extension origin as argv[1]. VEIL_HOME is forced to the binary's directory so a login-shell VEIL_HOME/VEIL_ORIGIN cannot point the host at a different vault.

func Read

func Read(r io.Reader) ([]byte, error)

func SafariSocketPath

func SafariSocketPath(userHome string) string

SafariSocketPath is the socket inside the appex's sandbox container — the only filesystem location both the daemon and the appex can reach.

func ServeBridge

func ServeBridge(ctx context.Context, h *Host, sockPaths ...string) error

ServeBridge listens on each sockPath and runs the normal Serve loop per connection. Same frames, same JSON — transport only.

func SocketPath

func SocketPath(vaultHome string) string

func Write

func Write(w io.Writer, raw []byte) error

func WriteHostConfig

func WriteHostConfig(dir string, cfg HostConfig) error

Types

type Host

type Host struct {
	App    *app.App
	Dir    string
	Origin string
	Token  string
	// TokenFn is called on every origin POST. CLI sets it to remint a
	// stale human JWT. Token is the test stand-in.
	TokenFn func() (string, error)
	// Refresh is a forced remint after origin 401.
	Refresh func() (string, error)
	// Confirm is Touch ID (or a test fake) before a secret leaves the host.
	Confirm func(reason string) error
	// ConfirmMode tunes how much one Touch ID covers:
	// "" or "origin" (default) reuses within the same site for ConfirmTTL,
	// "strict" prompts on every release, "session" reuses across sites.
	// Callsites with reuse=false (CVV) prompt regardless of mode.
	ConfirmMode string
	// ConfirmTTL overrides the 30s reuse window when positive.
	ConfirmTTL time.Duration
	// IconsOff disables favicon fetching — the strict posture keeps the
	// host from touching the network for site art.
	IconsOff bool
	// RemoteApproveMode gates fills behind another device's approval:
	// "all" every release, "tagged" only `veil:remote-approve` items.
	RemoteApproveMode string
	// Device is this host's name in the approval ask — the approver sees
	// "MacBook wants to fill X", not a bare uuid.
	Device string
	// Replica is the sealed local cache. Key is Keychain, not a file.
	Replica *replica.Vault
	// Issuer, ClientID, Redirect configure the extension browser sign-in
	// (action "login"). TokenPath is where the minted ID token is written —
	// the same file TokenFn re-reads.
	Issuer, ClientID, Redirect, TokenPath string
	// contains filtered or unexported fields
}

func New

func New(a *app.App) *Host

func NewOrigin

func NewOrigin(dir, origin, token string) *Host

func (*Host) ApplyConfig

func (h *Host) ApplyConfig(cfg HostConfig)

ApplyConfig updates the host's live confirmation/posture settings from cfg.

func (*Host) Handle

func (h *Host) Handle(raw []byte) []byte

func (*Host) InvalidateConfirm

func (h *Host) InvalidateConfirm()

InvalidateConfirm drops the reuse window — the bridge `relock` action calls it when the OS reports screen lock so a session-mode grant cannot outlive the lock.

func (*Host) PullReplica

func (h *Host) PullReplica() error

func (*Host) ReloadConfig

func (h *Host) ReloadConfig()

ReloadConfig re-reads fill.json from the host's vault home and applies it.

func (*Host) Serve

func (h *Host) Serve(in io.Reader, out io.Writer) error

func (*Host) ServePeer

func (h *Host) ServePeer(in io.Reader, out io.Writer, p *Peer) error

ServePeer is Serve with the connected client's identity attached — the bridge socket authenticates callers by peer, so a local agent cannot ride the human's Touch ID window or enumerate the vault.

type HostConfig

type HostConfig struct {
	Origin       string `json:"origin,omitempty"`
	Home         string `json:"home,omitempty"`
	TokenFile    string `json:"human_token_file,omitempty"`
	LoginEmail   string `json:"login_email,omitempty"`
	PasswordFile string `json:"kratos_password_file,omitempty"`
	TOTPFile     string `json:"kratos_totp_file,omitempty"`
	Debug        bool   `json:"debug,omitempty"`
	// TouchID is Mac confirm. Chrome launches the host with no env we control.
	// nil = default on. false leaves Confirm unattached; confirm() fails closed.
	TouchID *bool `json:"touch_id,omitempty"`
	// Confirm is the confirmation policy: ""|"origin" (default) reuses one
	// Touch ID within a site for ConfirmTTL, "strict" prompts every release,
	// "session" reuses across sites. CVV prompts regardless.
	Confirm string `json:"confirm,omitempty"`
	// ConfirmTTL is the reuse window in seconds (default 30).
	ConfirmTTL int `json:"confirm_ttl_seconds,omitempty"`
	// Policy is the posture preset: "strict" (prompt every release, no
	// network egress for icons), "relaxed" (session reuse, 5-minute
	// window), "standard"/"" for the defaults. Individual keys override.
	Policy string `json:"policy,omitempty"`
	// Icons toggles favicon fetching — "false" keeps the host from ever
	// touching the network for site art.
	Icons *bool `json:"icons,omitempty"`
	// RemoteApprove gates fills behind another device's approval:
	// "all" (every release), "tagged" (veil:remote-approve items), ""|"off".
	RemoteApprove string `json:"remote_approve,omitempty"`
	// Device is the name other devices see in the approval ask.
	Device string `json:"device,omitempty"`
}

HostConfig is how Chrome launches fill. Native messaging has no argv for our flags and no env we control. A shell wrapper is not a primitive.

func ReadHostConfig

func ReadHostConfig(dir string) (HostConfig, error)

type InstallEnv

type InstallEnv struct {
	Bin, VaultHome, UserHome, Origin, TokenFile string
	LoginEmail, PasswordFile, TOTPFile          string
}

type Peer

type Peer struct {
	PID      int32
	Path     string
	Attested bool
}

Peer is the process on the other end of a bridge socket connection. The socket is a Use surface — a local agent can connect to it like any other client, so reuse of a Touch ID evaluation is bound to the peer that prompted for it, and metadata actions only serve attested peers.

Jump to

Keyboard shortcuts

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