fix(secret-engines/vault): refuse keys that would become CLI flags; document extension safety rules
This commit is contained in:
3 files changed
+27
-1
No files matched your search
@@ -20,6 +20,27 @@ Regenerate `sdk/` from it with `buf generate ../archie-core/proto --path
|
||||
../archie-core/proto/<surface>`. 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
|
||||
|
||||
```
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user