You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f175afa
Browse filesBrowse the repository at this point in the historyBrowse files
The worker now carries the ATTACH options in the framework part of
attach_opaque_data (uuid || options section || catalog bytes) and hands them
to every function and catalog hook through one public accessor:
params.attach_options (BindParams, InitParams, ProcessParams, scalar
BindParameters) and vgi.catalog.attach_options(attach_opaque_data) for hooks
such as catalog_transaction_commit. Catalog code keeps seeing exactly its own
bytes.
Options declared secret=True are encrypted (SPEC-secret-options, sealing rule
5): XChaCha20-Poly1305 under K = HKDF-SHA256(root, info
"vgi.attach_secret_options.v1"), where root is an explicitly configured key
(set_attach_secret_options_key), else the signing key when the worker seals
(HTTP), else the host-local key file shared by all SDKs on the host
($VGI_ATTACH_SECRET_KEY_FILE, $XDG_RUNTIME_DIR/vgi/..., or
<tmp>/vgi-<user>/attach-secret-options.key; 32 random bytes, 0700/0600,
created atomically via hard link, read only when a secret has a value). AAD
binds the blob to the attach uuid; a moved or tampered blob fails with the
uniform "attach_opaque_data not recognized". The options never travel with
copies of the catalog bytes (the bytes object pickles as plain bytes).
pack_attach_options no longer keeps secrets in shared function storage: it
drops them (they arrive through attach_options); unpack_attach_options merges
the framework options. The txfix fixture reads token only via attach_options
and reports whoami().token_in_attach_data. Docs: sealing rule 5 and the
catalog guide now describe SDK-encrypted secret options as the standard way,
with re-derive / digest as alternatives.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the wire, `required` and `secret` are nullable boolean columns appended after the four shared spec columns (`name`, `description`, `type`, `default_value`), in that order. Readers look columns up by name, so a spec from a peer that predates either column reads it as `false`, and older peers ignore columns they don't know.
389
389
390
-
**Never put a secret option's value in `attach_opaque_data`.** On HTTP the worker seals the value, but over stdio and a unix socket it reaches the client, and the DuckDB extension, unsealed. Keep the credential server-side, re-derive it per call, or store a digest of it, as the `ticket_probe` fixture does (see [Opaque values: sealing](protocol/vgi-opaque-data-sealing.md), rule 5).
390
+
**Read options, secret ones included, with the framework accessor:**`params.attach_options` in any
391
+
function (bind, init and process, every function kind) or `vgi.catalog.attach_options(attach_opaque_data)`
392
+
in a catalog hook such as `catalog_transaction_commit`. The worker carries the ATTACH options inside
393
+
`attach_opaque_data` itself, so they reach every worker process on every transport, and encrypts the
394
+
`secret=True` ones with a key the client never has (an HKDF subkey of the signing key on HTTP, or of a
395
+
per-user host-local key file on stdio, unix sockets and launcher pools). **Never put a secret option's
396
+
value in your catalog's own attach bytes:** over stdio and unix sockets those reach the client, and the
397
+
DuckDB extension, unsealed. Catalogs that need only a fingerprint can still store a digest instead, as
398
+
the `ticket_probe` fixture does (see [Opaque values: sealing](protocol/vgi-opaque-data-sealing.md),
399
+
rule 5).
400
+
401
+
```python test="skip"
402
+
classLookup(TableFunctionGenerator[None, None]):
403
+
@classmethod
404
+
defprocess(cls, params, state, out):
405
+
api_key = params.attach_options.get("api_key") # decrypted by the framework
406
+
...
407
+
```
408
+
409
+
On a host whose temp directory is shared or unsuitable, point `VGI_ATTACH_SECRET_KEY_FILE` at a
410
+
private file (all worker processes of the deployment must use the same one), or call
411
+
`vgi.attach_secret_options.set_attach_secret_options_key(key)` at startup.
391
412
392
413
`secret` does not change what the worker itself logs: attach options are never logged unless the catalog opts in through `loggable_attach_options()` (below), which must never return a secret option.
393
414
@@ -445,30 +466,27 @@ class MyFunctionCatalog(ReadOnlyCatalogInterface):
445
466
|`attach_supports_transactions(name=, options=, attach_opaque_data=)`| the `supports_transactions` class attribute |`CatalogAttachResult.supports_transactions`, decided per attach. |
446
467
|`catalog_transaction_begin` / `_commit` / `_rollback`| raise `CatalogReadOnlyError`| Mint the transaction id; apply or discard the transaction's work. |
447
468
448
-
`pack_attach_options(options, specs)` turns the ATTACH options into attach bytes and
449
-
`unpack_attach_options(params.attach_opaque_data)` reads them back in any function or hook, in any
450
-
worker process. Options declared `secret=True` never enter the bytes: they are kept in the shared
451
-
function storage (`VGI_WORKER_SHARED_STORAGE`) under a random handle, so pass the specs.
469
+
Functions and hooks read the ATTACH options with `params.attach_options` /
470
+
`attach_options(attach_opaque_data)` (secret options included, see
471
+
[Declaring Attach Options](#declaring-attach-options)), so most catalogs need not override
472
+
`attach_opaque_data_for` at all. (`pack_attach_options(options, specs)` remains for a catalog whose
473
+
own bytes should depend on the non-secret options; it drops secret ones.)
0 commit comments