Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions casts/delivery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ runes:
- core/rules/AnchorWorkingDirectory
- core/rules/PreferTrash
- core/rules/CaptureOnTouch
- core/rules/DeclareSecrets
- development/skills/MergeTrain
- development/skills/ForgeCycle
- development/skills/AgentTeam
Expand Down
24 changes: 24 additions & 0 deletions docs/changes/declare-secrets-per-repository/proposal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
status: proposed
---

# Declare secrets per repository

## Why

The runedeck stack now declares secrets with SecretSpec ([SecretSpec][SECRETSPEC]). The skeleton gives each repository a `secretspec.toml`. Provision declares the machine's credentials and publishes the manifest at `~/.config/provision/secretspec.toml`. The owner's keys stay in the Keychain, and rune launch reads its credentials through that manifest. An agent that does not know this still reads `~/.env` or puts a key on a command line. A core rule tells every session how to declare, read, and pass a secret.

## What Changes

- `runes/core/rules/DeclareSecrets.md` tells an agent to declare each secret in the repository's `secretspec.toml` and to read it only through secretspec. Values stay out of the conversation and off argv, and every call gives a reason.
- The `delivery` cast selects the rule. The `core` cast selects it through `core/**`.

## Capabilities

- declare-secrets-per-repository (new)

## Impact

- One new rule and one cast entry. The rule enters without a provenance sidecar, because it is first-party content.

[SECRETSPEC]: https://github.com/cachix/secretspec
19 changes: 19 additions & 0 deletions docs/changes/declare-secrets-per-repository/pull-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Adds the DeclareSecrets rule: declare each secret in `secretspec.toml`, read it only through secretspec, and keep values out of the conversation.

## Plan

Change `declare-secrets-per-repository`: proposal, one ADDED delta (`declare-secrets-per-repository`), and tasks under `docs/changes/declare-secrets-per-repository/`.

## Changes

- Adds `runes/core/rules/DeclareSecrets.md`: declare with `secretspec add`, read with `secretspec run` or `secretspec get`, pass values on stdin, give every call a `--reason`, and use `~/.config/provision/secretspec.toml`, with the profile of the account, for the machine's credentials.
- Adds the rule to `casts/delivery.yaml`. The `core` cast selects it through `core/**`.

## Testing

- `rune validate`: 0 errors, `core/rules/DeclareSecrets.md` passes.
- `rune spec validate declare-secrets-per-repository` passes. The guarded push pipeline passed on this head.

## Release Notes

- New core rule DeclareSecrets for declaring and reading secrets through secretspec.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## ADDED Requirements

### Requirement: Agent declares each secret

The deck MUST hold a rule about secrets. The rule MUST tell an agent to declare every secret a repository reads in that repository's secret declaration, with a description of its purpose.

#### Scenario: Script needs a new token

- **WHEN** an agent adds a script that reads a token the repository did not use before
- **THEN** the agent adds the token to the repository's secret declaration with a description

### Requirement: Secret values stay out of the conversation

The rule MUST tell an agent to read a secret only through the secret manager. It MUST forbid printing a value or reading one into the conversation. It MUST tell the agent to pass a value to a program on stdin and to give every read a reason.

#### Scenario: Command needs a credential

- **WHEN** an agent runs a command that needs a credential
- **THEN** the agent runs the command under the secret manager and reports only its result
- **AND** no credential value appears in the transcript or in a process argument
15 changes: 15 additions & 0 deletions docs/changes/declare-secrets-per-repository/tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Tasks

## 1. Authoring

- [x] 1.1 Add `runes/core/rules/DeclareSecrets.md`
- [x] 1.2 Add the rule to the `delivery` cast

## 2. Verification

- [x] 2.1 `rune validate` passes with the rule present
- [ ] 2.2 One bench run against a baseline with no rule (BenchArtifact): an agent asked to call an authenticated API reads the key through secretspec and prints no value

## 3. Record

- [ ] 3.1 Archive merges the delta into `docs/specs/`
9 changes: 9 additions & 0 deletions runes/core/rules/DeclareSecrets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Declare every secret a repository reads in `secretspec.toml` at the repository root, each with a description. Add one with `secretspec add <NAME> --description "<purpose>"`. Read a secret only through `secretspec run -- <command>` or `secretspec get <NAME>`, never from a dotenv file or a shell profile.

Never print a secret value, and never read one into the conversation. When a command needs a secret, run it under `secretspec run` and report the result. Use `secretspec get` only where a pipe or a command substitution takes its output. A bare call prints the value into the transcript. Pass a value to a program on stdin, because a process list shows every argument. Never type or paste a value yourself. Ask the owner to store a new secret with `secretspec set <NAME>`, which prompts and does not echo. A program that makes a value pipes it into `secretspec set <NAME> --from-file -`.

Never show secretspec's own error text: a dotenv parse error quotes the line, value included. Send the stderr of `secretspec get` to `/dev/null` and report its exit code.

Give every call a reason with `--reason "<why>"`. By default SecretSpec refuses an agent session that gives none, and a provider that keeps an audit log writes the reason into it.

runedeck/provision declares the machine's credentials, the harness keys among them, and publishes that manifest at `~/.config/provision/secretspec.toml`. A repository that reads one of these credentials reads it from that manifest and does not declare it again. Each account reads its own profile: `owner` on the owner's machines, `agents` for the agent user on Cortex. A command that needs one runs as `secretspec run --file ~/.config/provision/secretspec.toml --profile owner --reason "<why>" -- <command>`. `rune launch` and `rune run` read an unset `from_env` key from that manifest. Do not export a credential in the shell to start a launch.
4 changes: 2 additions & 2 deletions secretspec.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#:schema https://secretspec.dev/schema/secretspec.schema.json
# The secrets this repository's scripts and checks read. Declare a new one with
# `secretspec add <NAME> --description "<purpose>"`, and read it with
# `secretspec run -- <command>` or `secretspec get <NAME>`. No value ever enters
# the repository. On a workstation, values come from the provider the owner's
# `secretspec run --reason "<why>" -- <command>`. An agent session must give a
# reason. No value ever enters the repository. On a workstation, values come from the provider the owner's
# secretspec config names, the Keychain by default. The ci profile reads them
# from the job environment only.
# Reference: https://secretspec.dev/reference/configuration/
Expand Down
Loading