// minio's object-store seat (novox/hq ADR 0468 §3, §8): the holder of `object-store`, serving `link`. A party that // needs to put a document into a bucket, or get one out, asks for one short link and moves the bytes over HTTP // itself; no document ever travels on the bus. // // The link is signed with the bucket's link key (issue 1594), which only reads and writes that bucket's objects, // never with the root account. Who may have a link is judged here, at each call, from the grant file the mesh // delivered to minio: the bucket's consumer, and whoever its `shares` name for that method. // // stdout is the MCP channel; what this module says, it says on stderr. package main import ( "fmt" "os" stdio "git.novox.be/novox/mesh-sdk/go" ) // Words the manifest gives this bundle (modules/minio/module.json). const ( ConfigWord = "OBJECT_STORE_CONFIG" // the store as the machine reaches it: files/object-store.json, rendered LinksWord = "MESH_MINIO_LINKS" // the directory of the link keys' secrets (issue 1594) ReceivesWord = "MESH_RECEIVES" // the grant file ) func main() { s, err := newServer(os.Getenv(ConfigWord), os.Getenv(LinksWord), os.Getenv(ReceivesWord)) if err != nil { fmt.Fprintf(os.Stderr, "[object-store] %v\n", err) os.Exit(1) } if err := stdio.Serve("", tools(s)); err != nil { fmt.Fprintf(os.Stderr, "[object-store] %v\n", err) os.Exit(1) } } func tools(s *server) []stdio.Tool { return []stdio.Tool{{ Name: "object-store.link", Description: "A signed link to one object of a bucket, for one method, that lives at most ten minutes: the caller " + "moves the bytes over HTTP to it and never over the bus. Allowed to the bucket's own consumer and to whoever the " + "consumer's shares name for the method; the link is signed with a key that reaches that bucket's objects only.", Input: map[string]any{ "bucket": map[string]any{"type": "string", "description": "the bucket"}, "key": map[string]any{"type": "string", "description": "the object's key"}, "method": map[string]any{"type": "string", "description": "get to read the object, put to write it"}, "seconds": map[string]any{"type": "integer", "description": "how long the link lives, 1 to 600 (default 300)"}, }, Run: func(args map[string]any) (any, error) { return s.link(stdio.CallerOf(args), args) }, }} }