diff --git a/CHANGELOG.md b/CHANGELOG.md index f09bc71..47be07d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to Skeleton are documented here, following [Keep a Changelog - Add `secretspec.toml` to the template and the root: the secrets a repository reads, with a `ci` profile on the job environment, seeded once through `_skip_if_exists`. - Add the `secretspec-manifest` hook, which checks the declaration without reading a value and skips when `secretspec` is absent. +- Add a reason to the example read in the `secretspec.toml` comment, because secretspec refuses an agent session that reads without one. - Add `scripts/trash` and `tests/test_trash.py`: a recoverable delete into the system Trash, through `/usr/bin/trash` on macOS and `gio trash` on Linux, each with a fallback. - Add seven dcg packs under `.dcg/packs/`, one per rule (`search`, `parsers`, `secrets`, `push`, `provenance`, `rtk`, `homebrew`), ids `rune.`, in the template and the root (SKEL-0009). - Add `.dcg/fixtures.txt`, `.dcg/test-config.toml`, and `scripts/test-dcg-packs`: a denied command per rule and a permitted one per exemption, replayed through `dcg test` under an isolated config. diff --git a/docs/changes/secret-read-reason/proposal.md b/docs/changes/secret-read-reason/proposal.md new file mode 100644 index 0000000..2ce0222 --- /dev/null +++ b/docs/changes/secret-read-reason/proposal.md @@ -0,0 +1,24 @@ +--- +status: proposed +--- + +# Secret read reason + +## Why + +The comment at the top of `secretspec.toml` shows two reads: `secretspec run -- ` and `secretspec get `. Neither gives `--reason`. SecretSpec 0.21.1 refuses both in an agent session, because its `require_reason` policy defaults to `agents` ([SecretSpec][SECRETSPEC]). An agent that copies the example gets "Accessing secrets requires a reason". A bare `secretspec get` also prints the value into the transcript. + +## What Changes + +- `templates/base/secretspec.toml.jinja` and the root `secretspec.toml` show one read, `secretspec run --reason "" -- `, and say that an agent session must give a reason. +- `CHANGELOG.md` gains one line. + +## Capabilities + +- secret-read-reason (new) + +## Impact + +- One template file, one root file, and `CHANGELOG.md`. `copier.yaml` seeds `secretspec.toml` once, so only new repositories get the new comment. An existing consumer edits its own copy: the deck does that in runedeck/deck#86. + +[SECRETSPEC]: https://secretspec.dev/reference/configuration/ diff --git a/docs/changes/secret-read-reason/pull-request.md b/docs/changes/secret-read-reason/pull-request.md new file mode 100644 index 0000000..f3c16df --- /dev/null +++ b/docs/changes/secret-read-reason/pull-request.md @@ -0,0 +1,19 @@ +Shows the example read in `secretspec.toml` with `--reason`, which secretspec requires from an agent session. + +## Plan + +Change `secret-read-reason`: proposal, one ADDED delta (`secret-read-reason`), and tasks under `docs/changes/secret-read-reason/`. + +## Changes + +- Changes the comment in `templates/base/secretspec.toml.jinja` and the root `secretspec.toml`: the read is `secretspec run --reason "" -- `, and the bare `secretspec get ` example is gone, because it prints the value. +- Adds one `CHANGELOG.md` line. + +## Testing + +- With secretspec 0.21.1 in an agent session, a read without `--reason` exits 1 with "Accessing secrets requires a reason", and the same read with `--reason` succeeds. The probe used a scratch manifest with a synthetic value. +- `rune spec validate secret-read-reason` passes. The guarded push pipeline passed on this head. + +## Release Notes + +- The `secretspec.toml` comment shows a read that works in an agent session. diff --git a/docs/changes/secret-read-reason/specs/secret-read-reason/spec.md b/docs/changes/secret-read-reason/specs/secret-read-reason/spec.md new file mode 100644 index 0000000..921485d --- /dev/null +++ b/docs/changes/secret-read-reason/specs/secret-read-reason/spec.md @@ -0,0 +1,11 @@ +## ADDED Requirements + +### Requirement: Declaration shows a read with a reason + +The secret declaration that the generator writes MUST show its example read with a reason for the access. The secret manager refuses a read from an agent session that gives no reason, so an agent that copies a read without one fails. + +#### Scenario: Agent copies the example read + +- **WHEN** an agent copies the read that the generated declaration shows +- **THEN** the read gives a reason +- **AND** the secret manager accepts the read from an agent session diff --git a/docs/changes/secret-read-reason/tasks.md b/docs/changes/secret-read-reason/tasks.md new file mode 100644 index 0000000..2b378bb --- /dev/null +++ b/docs/changes/secret-read-reason/tasks.md @@ -0,0 +1,15 @@ +# Tasks + +## 1. Implementation + +- [x] 1.1 The example read in `templates/base/secretspec.toml.jinja` and the root `secretspec.toml` gives `--reason` +- [x] 1.2 One `CHANGELOG.md` line + +## 2. Verification + +- [x] 2.1 SecretSpec 0.21.1 refuses a read without `--reason` in an agent session and accepts the same read with one +- [x] 2.2 `rune spec validate secret-read-reason` and the guarded push pipeline + +## 3. Record + +- [ ] 3.1 Archive merges the delta into `docs/specs/` diff --git a/secretspec.toml b/secretspec.toml index 8b870a8..7d0b782 100644 --- a/secretspec.toml +++ b/secretspec.toml @@ -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 --description ""`, and read it with -# `secretspec run -- ` or `secretspec get `. No value ever enters -# the repository. On a workstation, values come from the provider the owner's +# `secretspec run --reason "" -- `. 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/ diff --git a/templates/base/secretspec.toml.jinja b/templates/base/secretspec.toml.jinja index 7f2118a..5412c96 100644 --- a/templates/base/secretspec.toml.jinja +++ b/templates/base/secretspec.toml.jinja @@ -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 --description ""`, and read it with -# `secretspec run -- ` or `secretspec get `. No value ever enters -# the repository. On a workstation, values come from the provider the owner's +# `secretspec run --reason "" -- `. 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/