diff --git a/README.md b/README.md index 18409ea..0a1a286 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,27 @@ Regenerate `sdk/` from it with `buf generate ../archie-core/proto --path ../archie-core/proto/`. An extension can be written in any language; the Go SDK is a convenience. +## Safety + +An extension runs with the operator's accounts and talks to the outside world, +so every one of them holds to these before it ships: + +- **Inbound is authenticated before it is acted on.** Identity comes only from + something the extension or a trusted upstream verified (a provider's + DMARC/DKIM result, a host-verified webhook signature), never from a field the + sender writes. Unauthenticated input is dropped. +- **Protocols come from maintained libraries** (go-imap, go-smtp, go-github, + the Gitea SDK). No hand-written protocol code. +- **No listening ports.** An extension dials out; inbound reaches it through + the host. +- **Operator data outside the extension's job is left untouched.** It changes + only what it acted on (the email channel marks only routed mail read). +- **Authority is declared in package.yaml** (env, egress hosts), and nothing + else is assumed. Input that reaches a CLI is validated so it cannot become a + flag. +- **The security check has a table test** covering forged and wrong-party + input. + ## Publish and install ``` diff --git a/channels/email/package.yaml b/channels/email/package.yaml index 008036d..6efab42 100644 --- a/channels/email/package.yaml +++ b/channels/email/package.yaml @@ -1,6 +1,6 @@ apiVersion: dev.archie.package.v1 displayName: Email channel -description: "Email chat channel: polls a mailbox over IMAP, routes mail from allowed, DMARC/DKIM-authenticated senders, replies over SMTP." +description: "Email chat channel: polls a mailbox over IMAP, routes mail from allowed, DMARC/DKIM-authenticated senders, replies over SMTP. The mail hosts are named by the operator's egress acceptance." version: 1.0.0 contributes: extensions: diff --git a/secret-engines/vault/main.go b/secret-engines/vault/main.go index ae3534d..48e8350 100644 --- a/secret-engines/vault/main.go +++ b/secret-engines/vault/main.go @@ -21,6 +21,11 @@ func resolve(ctx context.Context, key string) (string, error) { if err != nil { return "", err } + // The key reaches the vault CLI as arguments; a leading "-" would be read + // as a flag such as -address. + if strings.HasPrefix(path, "-") || field == "" { + return "", fmt.Errorf("key %q is not a valid path/field", key) + } value, err := secretengine.Run(ctx, "vault", "kv", "get", "-field="+field, path) if err != nil { return "", fmt.Errorf("read %s/%s: %w", path, field, err)