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
- Variables
- func ApplyHostConfig(dir string) error
- func AutoFillSocketPath(userHome string) string
- func BootstrapBridgeAgent(userHome string) error
- func BridgeLock(vaultHome string) (io.Closer, error)
- func BridgeSocketPaths(vaultHome, userHome string) []string
- func ChromeOrigin() string
- func ConfigPath(vaultHome string) string
- func DirBesideHost() (string, error)
- func ExtensionManifestFirefox(chromeManifest []byte) ([]byte, error)
- func ExtensionManifestSafari(chromeManifest []byte) ([]byte, error)
- func FirefoxID() string
- func HelperSocketPath(userHome string) string
- func HostPath(vaultHome string) string
- func Install(bin, vaultHome, userHome string) error
- func InstallBridgeAgent(env InstallEnv) error
- func InstallExtension(dist fs.FS, dir string) error
- func InstallExtensionFirefox(dist fs.FS, dir string) error
- func InstallExtensionSafari(dist fs.FS, dir string) error
- func InstallOrigin(env InstallEnv) error
- func JSONChromeOrigin() string
- func JSONFirefoxID() string
- func ManifestChrome(hostPath string) []byte
- func ManifestFirefox(hostPath string) []byte
- func ManifestJSONChrome(hostPath string) []byte
- func ManifestJSONFirefox(hostPath string) []byte
- func NativeHostArgs(args []string) []string
- func Read(r io.Reader) ([]byte, error)
- func SafariSocketPath(userHome string) string
- func ServeBridge(ctx context.Context, h *Host, sockPaths ...string) error
- func SocketPath(vaultHome string) string
- func Write(w io.Writer, raw []byte) error
- func WriteHostConfig(dir string, cfg HostConfig) error
- type Host
- func (h *Host) ApplyConfig(cfg HostConfig)
- func (h *Host) Handle(raw []byte) []byte
- func (h *Host) InvalidateConfirm()
- func (h *Host) PullReplica() error
- func (h *Host) ReloadConfig()
- func (h *Host) Serve(in io.Reader, out io.Writer) error
- func (h *Host) ServePeer(in io.Reader, out io.Writer, p *Peer) error
- type HostConfig
- type InstallEnv
- type Peer
Constants ¶
const ( Version = "2.7.7" NativeHostName = "org.keepassxc.keepassxc_browser" JSONHostName = "nyc.veil.fill" JSONVersion = "1" )
const ( HostFile = "native-host" HostConfigFile = "fill.json" )
const AutoFillExtensionID = "nyc.veil.fill.AutoFill"
AutoFillExtensionID is the AutoFill credential-provider appex bundle id.
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.
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.
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.
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.
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 ¶
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 ¶
ApplyHostConfig sets blank env from fill.json. Existing env wins.
func AutoFillSocketPath ¶
AutoFillSocketPath is the socket inside the AutoFill appex's container.
func BootstrapBridgeAgent ¶
BootstrapBridgeAgent (re)starts the LaunchAgent written by InstallBridgeAgent. Lives at the CLI boundary so tests that exercise InstallOrigin never touch launchd.
func BridgeLock ¶
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 ¶
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 DirBesideHost ¶
DirBesideHost is the vault dir when Chrome launched native-host.
func ExtensionManifestFirefox ¶
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 ¶
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 HelperSocketPath ¶
HelperSocketPath is the socket inside the menu-bar app's sandbox container.
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 ¶
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 ¶
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 ¶
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 ManifestFirefox ¶
func ManifestJSONChrome ¶
func ManifestJSONFirefox ¶
func NativeHostArgs ¶
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 SafariSocketPath ¶
SafariSocketPath is the socket inside the appex's sandbox container — the only filesystem location both the daemon and the appex can reach.
func ServeBridge ¶
ServeBridge listens on each sockPath and runs the normal Serve loop per connection. Same frames, same JSON — transport only.
func SocketPath ¶
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 (*Host) ApplyConfig ¶
func (h *Host) ApplyConfig(cfg HostConfig)
ApplyConfig updates the host's live confirmation/posture settings from cfg.
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 (*Host) ReloadConfig ¶
func (h *Host) ReloadConfig()
ReloadConfig re-reads fill.json from the host's vault home and applies it.
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)