Zum Inhalt springen
Plugins

agent_capability Plugin

Credential Store

The `credential_store` plugin owns generic credential records that should not be added as one-off encrypted columns on `User`. It is installed but disabled by default, and exposes broker-backed agent tools for generic credential operations such as SSH command execution. Because the plugin is experimental, an admin must enable instance beta mode before opting into it from **Admin → Plugins**. Operators manage records from **Credential Store** in the sidebar, or from **Admin > Credential Store** when they are global admins. The page and plugin-owned API list only safe metadata: credential type name, scope, target constraints, rotation/revocation timestamps, and last-used audit metadata. Payload material is write-only. Create, edit, and rotate forms accept new secret material, but list/show responses never include existing payload values.

credential_storeQuellcode

Credential Store

The credential_store plugin owns generic credential records that should not be added as one-off encrypted columns on User. It is installed but disabled by default, and exposes broker-backed agent tools for generic credential operations such as SSH command execution. Because the plugin is experimental, an admin must enable instance beta mode before opting into it from Admin → Plugins.

Operators manage records from Credential Store in the sidebar, or from Admin > Credential Store when they are global admins. The page and plugin-owned API list only safe metadata: credential type name, scope, target constraints, rotation/revocation timestamps, and last-used audit metadata. Payload material is write-only. Create, edit, and rotate forms accept new secret material, but list/show responses never include existing payload values.

CredentialStore::Credential stores credential_type as a lowercase type name such as ssh_private_key, token, json, env, file_blob, or a plugin-namespaced name such as k8s_cluster.kubeconfig, not as a storage strategy. Every credential payload is kept in one Active Record Encryption text column (payload), regardless of type. Display and probing data belongs in safe_metadata, which only accepts a small allowlist of non-secret keys such as host, username, cluster, context, namespace, fingerprint, known_host, and base_url.

Scopes use existing Syrus ownership entities:

  • user scope references User.
  • repository scope references Repository.
  • team scope references Team.
  • instance scope has no scope_id.

Management authorization follows the same scopes:

  • A user may manage their own user-scoped credentials.
  • A repository admin may manage credentials scoped to that repository.
  • A team owner may manage credentials scoped to that team.
  • Only global admins may manage instance-scoped credentials.

Credential types are strings. The store offers default types including ssh_private_key, token, json, env, and file_blob, legacy credential_store.* aliases, and type names declared by enabled plugins, such as Kubernetes credential types from k8s_cluster when that plugin is enabled. Plugins declare type names and safe descriptions. A declaration may also name one typed consumer for that plugin-owned type; consumer names are validated for uniqueness when plugins load. Typed consumers are inferred from the credential type and do not use the legacy allowed_tools list.

Credentials whose types belong to another plugin are managed credentials. The generic management API and page cannot change their allowed_tools, and the raw credential.exec and credential.ssh-agent wrappers refuse them even if an old record contains an explicit wrapper grant. Only the owning plugin's typed consumer may materialize them through the broker, so plugin-managed credentials are never exposed to a shell.

When a plugin is purged, Credential Store removes credentials in that plugin's enforced type namespace and their access-audit rows. This cleanup remains available after the owning plugin has been uninstalled.

The plugin also owns append-only CredentialStore::CredentialAccessEvent rows. Access events record which credential was used or denied, the actor and runtime context when available (user, repository, job, workflow, run, or chat_session), the tool/surface/action/purpose, result, and denial reason. They intentionally do not store payload material. Credentials are revocation-only at the model layer so destroying a credential cannot delete its audit history.

Brokered Tool Access

The plugin exposes a Ruby broker API for other bundled plugins that declare depends_on [ "credential_store" ]. The broker is intentionally not an MCP tool and never returns plaintext credential material to the agent:

CredentialStore::Broker.with_credential_file(
  context: mcp_tool_context,
  credential: credential_id_or_name,
  type: "k8s_cluster.kubeconfig",
  purpose: "kubectl apply",
  tool_name: "k8s.apply",
  target: { kube_context: "production" }
) do |path, metadata|
  # Run the local command with the temporary file.
end

CredentialStore::Broker.with_credential_env(
  context: mcp_tool_context,
  credential: credential_id_or_name,
  type: "credential_store.url_token",
  env_key: "API_TOKEN",
  purpose: "probe deployment",
  tool_name: "deploy.probe",
  target: { host: "api.example.com", url: "https://api.example.com/status" }
) do |env, metadata|
  # Merge `env` into a child process environment.
end

Every broker call resolves the credential from the current McpToolContext, then authorizes the request against credential scope, current user, repository/team membership, allowed repository scope, MCP surface, allowed tool name, expected credential type, target constraints, revocation, and expiry. A successful call issues a short-lived local lease, materializes the payload only inside the block as either a restrictive temporary file or a per-call env hash, and cleans that local material in ensure.

An owning plugin can refresh its credential atomically with CredentialStore::Broker.refresh_credential!. The broker locks the database row, yields the current payload to the plugin, writes the replacement, updates the rotation timestamp, and records a separate refresh audit action. An operator-revoked credential cannot be refreshed. Human rotation through the management page remains the existing rotate action and explicitly un-revokes the credential. The safe-metadata key refreshable remains display metadata only; refresh authority comes from ownership of the plugin-declared credential type, not from an operator-editable metadata flag.

Name lookup considers active credentials only and resolves scopes in user, repository, team, then instance order. Names must be unique among active credentials within the same scope; an equally ranked match across multiple accessible repositories or teams is rejected as ambiguous. Admin status does not make another user's user-scoped credential available.

Target constraints are deliberately small and broker-owned. Supported keys are allowed_hosts, allowed_url_prefixes, allowed_kube_contexts, allowed_kube_clusters, and allowed_kube_namespaces. Dependent tools pass a target hash such as host, url, kube_context, kube_cluster, and kube_namespace; the broker records allowed/denied audit rows without storing payload material. Omitting a constraint leaves that dimension unrestricted; configuring it with an empty or blank-only array denies every target. URL prefixes match only HTTP(S) URLs with the same scheme, host, and effective port, paths must match at a slash boundary, and literal or percent-encoded dot-segment traversal is rejected.

Broker return values and broker-wrapped exceptions are scrubbed with CredentialStore::Redaction, which removes the known credential payload and common unsafe probe output shapes before a dependent MCP tool returns results or persistent dispatch records an error summary. Dependent tools should still avoid printing command environments or raw files; the broker is the last guard, not a substitute for careful tool design.

CLI

The CLI discovers the safe metadata commands from the enabled plugin at runtime. Local lease and process-wrapper behavior is supplied by the syrus-credential executable distributed alongside syrus. credential_store remains an alias for older scripts:

syrus credential types
syrus credential credentials
syrus credential credentials --type credential_store.url_token
syrus credential lease deploy-token \
  --type credential_store.url_token \
  --purpose deploy \
  --tool deploy.push \
  --target-json '{"host":"api.example.com"}'
syrus credential exec \
  --credential deploy-token \
  --type credential_store.url_token \
  --env-var SERVICE_TOKEN \
  -- ./script.sh
syrus credential exec \
  --credential kubeconfig \
  --type credential_store.kubeconfig \
  --file-env KUBECONFIG \
  -- kubectl get pods
syrus credential exec \
  --credential signing-token \
  --type credential_store.generic \
  --stdin \
  -- ./read-token-from-stdin.sh
syrus credential ssh-agent --credential homeassistant-ssh -- ./deploy.sh

types and credentials are discovery commands over the same app API used by the management page. They return credential type declarations, accessible credential ids/names, scope labels, safe metadata, target constraints, allowed surfaces/tools, and active/revoked/expiry status. They do not return payload material.

lease is only available inside a Syrus-managed runtime authenticated by SYRUS_CLI_INVOCATION_CONTEXT; a normal saved CLI API token receives a forbidden response. The command asks the existing broker for a scoped lease using the current run/chat context, records the normal credential access audit row, and prints lease metadata such as lease id, credential id/name/type, safe metadata, purpose, tool, and expiry. The response intentionally omits the credential payload.

exec is also runtime-only and is for bespoke scripts that need non-SSH credential material in a tightly scoped process-local form. The caller must choose exactly one materialization mode: --env-var NAME exports the payload as NAME for the child process, --file-env NAME writes it to a temporary 0600 file outside the repository and exports that path as NAME, and --stdin provides the payload as the child process standard input. The wrapper uses the same broker authorization, target constraints, and access audit rows as lease, then records a completion audit row with the lease id, mode, exit status, and duration. It removes temporary files after the child process exits, does not print command previews containing credential-derived values, and redacts the exact payload from child stdout/stderr before streaming it back. There is intentionally no mode that echoes plaintext credentials or writes them to a caller-selected persistent path.

ssh-agent is also runtime-only. It requests an ssh_private_key lease, starts a short-lived local ssh-agent, writes the private key only to a temporary 0600 file long enough to run ssh-add, exports SSH_AUTH_SOCK to the child command, and tears down the agent plus temp files on success or failure. Payloads may be a raw private key or JSON with private_key and optional passphrase; passphrases are supplied through a temporary askpass helper and are not passed to the child command. The wrapper records a completion audit row with the lease id, credential handle, current job/workflow/run/repository/user context, wrapper command namespace, child exit status, and duration. It does not print private keys, passphrases, raw payload material, or child command arguments.

Completion audit submissions are accepted exactly once for an unexpired lease issued to the same credential, wrapper tool, and runtime context. Exit status must be an integer, and wrapper tool names cannot be overridden by the child process. Direct SSH execution records a SHA-256 command digest, a bounded command preview, duration, and exit status; rejected input and policy checks are also recorded as denied attempts. Creating or editing a credential records an admin audit row with the non-secret scope, surface, tool, and target-constraint changes. Payload replacement is recorded only as a boolean, never as payload material, and rotating a revoked credential explicitly records that it was un-revoked.

Repository-Owned Script Policy

Repository-owned deploy/debug scripts should call credential wrappers from the script command line rather than reading secrets from the agent environment or from committed config. For a Home Assistant-style SSH deploy, the preferred shape is:

syrus credential ssh-agent \
  --credential homeassistant-ssh \
  --purpose deploy \
  --target-json '{"host":"ha.example.com"}' \
  -- ./deploy.sh

For non-SSH material, use syrus credential exec with exactly one materialization mode:

syrus credential exec \
  --credential deploy-api-token \
  --type credential_store.url_token \
  --env-var SERVICE_TOKEN \
  --purpose deploy \
  --target-json '{"host":"api.example.com"}' \
  -- ./deploy.sh

Agents may invoke a wrapper from a Job or chat-assisted runtime only when all of these are true:

  • The repository declares the script intent in .syrus.yml scripts: or the

operator gives an equivalent explicit instruction in the current trusted context.

  • The declaration or instruction names a credential handle, type, wrapper,

purpose, and target metadata; it never includes payload material.

  • The credential is scoped so the current user/repository/team/instance context

can use it, and its allowed surfaces, explicit credential-wrapper grants, type, target constraints, expiry, and revocation state authorize the requested wrapper.

  • The agent is running inside Syrus runtime authentication

(SYRUS_CLI_INVOCATION_CONTEXT), not from a human's local ~/.syrus/credentials.

  • The child command matches the declared repository script intent. If the

script is undeclared or allow_agent_invocation is false, ask an operator before running it.

The .syrus.yml declaration is policy metadata, not a capability grant:

scripts:
  deploy:
    run: ./deploy.sh
    description: Deploy the Home Assistant appliance.
    allow_agent_invocation: true
    credentials:
      - name: ssh
        credential: homeassistant-ssh
        type: ssh_private_key
        wrapper: ssh-agent
        purpose: deploy
        tool: credential.ssh-agent
        target:
          host: ha.example.com

The credential handle is a stable name or id for lookup. The encrypted payload stays in credential_store; do not put private keys, tokens, passphrases, or inline kubeconfigs in .syrus.yml.

Operator setup flow:

  1. Create the credential in Credential Store with the appropriate type, such as

ssh_private_key for ssh-agent or credential_store.url_token for exec.

  1. Scope it as narrowly as possible: user-scoped for a personal workflow,

repository-scoped for one repo, team-scoped for a team-owned fleet, or instance-scoped only for shared operational credentials.

  1. Add safe metadata and target constraints such as host,

allowed_hosts, base_url, or allowed_url_prefixes.

  1. Set allowed_surfaces to the intended runtime, usually workflow for Jobs

and optionally chat for chat-assisted runs.

  1. Under Allowed credential wrappers, explicitly select a raw-materialization

wrapper such as credential.ssh-agent or credential.exec. This setting is not a command allowlist. Specialized typed consumers do not require a wrapper grant.

  1. Commit a .syrus.yml scripts: entry that names the handle and wrapper,

then invoke the wrapper command from the deploy/debug script or from the trusted runtime instruction.

Transcripts and audits should show the wrapper command namespace, credential handle, type, purpose, target metadata, exit status, and timing. They must not show plaintext credential payloads, passphrases, temporary file contents, or runtime invocation tokens. The CLI removes temporary material after the child process exits and redacts the exact payload from child stdout/stderr before it is streamed back.

SSH MCP Tools

credential_store_list_credentials is a read-only deferred chat and workflow tool. It lists active credentials visible to the current user and attached repository context, returning only safe selection metadata. Listing never decrypts payload material or creates a credential-access audit event. Discovery does not grant use: the broker still enforces permissions, leases, scope, surface, target constraints, expiration, and execution-time audit logging. Discovery reports inferred typed consumers separately from explicit raw-wrapper grants so the reason a credential is eligible remains visible.

credential_store_ssh_exec is available to workflow agents and as a deferred chat tool when the plugin is enabled. It accepts a credential id or name, host, user, optional port, and a remote command. The tool requests an ssh_private_key broker lease, materializes the key into a temporary 0600 file only for the duration of the SSH process, and returns sanitized stdout, stderr, and exit status. Payloads may be a raw private key or JSON with private_key and optional passphrase; passphrases are passed through a temporary askpass helper and redacted from results. SSH private-key material is written with exactly one final newline for OpenSSH compatibility; this runtime normalization does not rewrite the encrypted credential payload.

Credential type selects safe typed consumers: every ssh_private_key is eligible for credential_store_ssh_exec, regardless of empty, stale, or command-like legacy allowed_tools values. This inference does not authorize a command. Unified permissions and the exact invocation fingerprint authorize the operation, while scope, surfaces, destinations, host identity, and target constraints limit where the key can be used. Broader raw-materialization wrappers (credential.exec and credential.ssh-agent) always require their own explicit Allowed credential wrappers grant.

The plugin publishes a unified permission descriptor that is evaluated from the invocation arguments before the credential broker resolves or materializes a key. Permission requests are scoped to the credential handle, host, user, and port. Read-only classification reads quoting the way a shell does, so an allowlisted command is not demoted by a metacharacter that is quoted - grep "a*b" file globs nothing and classifies as a read - while anything the shell would act on outside quotes still classifies as risky. The review card shows a redacted command while durable permission material stores only its SHA-256 fingerprint. Read-only diagnostics classify as ssh.execute/read@v1; every other command and any explicit risky-command bypass classifies as ssh.execute/risky@v1. Both default to ask. An operator may allow the queued invocation once, allow future exact matches in the originating chat, or create a revocable permanent rule. Chat and permanent authority remain bound to the operation classification, credential handle, host, user, port, command fingerprint, and authorization flags; changing any of them asks again.

A rule's destination may stop short of a full address. The destination scope is a prefix of credential, host, user, port, so one rule can name every destination, every destination reachable with a single credential, every user on one host, or one exact address. A rule that skips a level - a host without its credential, a port without its user - is refused, because such a scope cannot be compared against a real destination. Stopping early widens where a rule applies and nothing else: the command fingerprint or prefix, the read-versus-risky classification, and every broker ceiling still apply, and an execution still has to name a host and a user whatever the rule says.

A permanent grant may instead be widened to a command prefix, which the card offers as an editable field: "allow commands starting with git commit". The prefix replaces the command fingerprint rather than joining it, since a rule carrying both would still match one command only. Prefixes are compared a whole token at a time, so git commit does not cover git commitfoo, and a command carrying shell syntax - a pipe, a semicolon, a substitution, a redirect - is never projected into prefix-matchable form at all. Shell syntax is judged by where a character sits rather than whether it appears: a metacharacter inside quotes is text the shell passes through, so sqlite3 -readonly db "select count(*) from states" projects normally, while "$(cat ~/.ssh/id_rsa)" does not, because a shell still expands $, a backtick and a backslash inside double quotes. Single quotes are literal throughout, and quoting that never closes is treated as unsafe.

A prefix covers whatever arguments follow it, so it is only ever as narrow as the argument surface of the command it names. Tools that read a leading-dot word as an instruction to themselves are the sharp edge here: sqlite3 -readonly db ".shell rm -rf /" runs that command, because -readonly constrains the database and not the interpreter. A command carrying such a word is therefore not projected and keeps asking, while a path that merely begins with a dot - ./deploy.sh - is unaffected. Choose a prefix for what the named command can be made to do with further arguments, not only for what this invocation did. That last point is the one that matters: git commit -m x; rm -rf / begins with the same two tokens as any other commit, and it is excluded because there is nothing for a prefix rule to match, not because the comparison rejects it. The prefix an operator types is stored on the rule; the full command is not, and the fingerprint that identifies an exact invocation is unchanged by the projection, so approvals already granted keep matching. A missing or invisible credential produces the same not-found lookup result, so permission discovery does not disclose whether a hidden credential exists.

Permission authority and the broker lease are separate controls. Permission grants authority only for the fingerprinted SSH invocation shape; the existing short broker lease bounds secret materialization and continues to enforce scope, surface, tool, destination, expiry, revocation, redaction, and audit rules. Permission cannot override any of those broker ceilings.

SSH targets use a deliberately narrow syntax. user must begin with an ASCII letter, digit, or underscore and may then contain only ASCII letters, digits, underscores, dots, or hyphens. host must be an ASCII hostname beginning with a letter or digit, or a raw IPv4 or unbracketed IPv6 address. Option-like values, whitespace, and control characters are rejected rather than passed to OpenSSH. port and connect_timeout, when supplied, must contain decimal digits only; port is limited to 1..65535 and connect_timeout to 1..120 seconds.

Use target policy on SSH credentials:

  • Set safe_metadata.host and safe_metadata.username when a key belongs to

one target account.

  • Set target_constraints.allowed_hosts for host allowlists.
  • Enroll safe_metadata.known_host through the guided Credential Store form.

Discovery displays the key type, SHA-256 fingerprint, target, and complete known-hosts line but does not prove identity; verify the fingerprint through a trusted channel and explicitly confirm it. If the web process cannot reach the server, paste a complete known-hosts line for validation and confirmation.

  • Set safe_metadata.fingerprint for operator-visible fingerprint tracking;

the confirmed known_host is what enforces host identity.

Client authentication, destination authorization, and server identity are separate controls: the private key authenticates the client; safe_metadata.host and target_constraints.allowed_hosts authorize where it may connect; the confirmed known-hosts line identifies the server. SSH execution fails before spawning ssh when enrollment is missing. Confirmed entries are written to a credential-specific temporary 0600 file and used with StrictHostKeyChecking=yes; Syrus never falls back to a worker user's ambient known-hosts file. Replacing a key repeats the fingerprint confirmation flow and shows both fingerprints.

The tool refuses credentials that have no host, known-host, or allowed_hosts constraint unless a workflow caller explicitly sets allow_unconstrained_host: true. Only a conservative allowlist of read-only diagnostic commands runs without confirmation; shell expansion, globbing, redirection, and every command outside that allowlist are refused unless a workflow caller supplies allow_risky_command: true. Chat-surface calls cannot self-authorize either bypass; they fail instead of executing. The exact read-only diagnostics hostname, date -Is, and ha core info are allowed; mutating variants and all compound shell commands remain refused. All access attempts are audited by the broker, including denials for revoked credentials, wrong credential types, surface/tool policy mismatches, SSH metadata mismatches, unconstrained credentials, and target constraint failures.