Skip to content

feat(secret): set app.yaml secrets from the CLI - #6

Merged
Alexanderamiri merged 2 commits into
mainfrom
feat/secret-command
Oct 23, 2026
Merged

Alexanderamiri merged 2 commits into
mainfrom
feat/secret-command

Conversation

@Alexanderamiri

@Alexanderamiri Alexanderamiri commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Adds javabin secret for setting values of secrets declared in app.yaml (resources.secrets).

  • javabin secret list — shows which declared secrets still hold PLACEHOLDER (decrypts only to compare; values are never printed)
  • javabin secret set <name> [--stdin] — hidden prompt (terminal restored on Ctrl-C) or stdin; overwrites the existing SSM SecureString under /javabin/apps/<team>/<app>/<name>. Never creates parameters: if it doesn't exist yet, deploy first (the platform creates declared secrets, and IAM denies writes to parameters not tagged with the team)
  • No restart flag: the platform restarts <team>-<app> automatically when a secret changes (feat(org): let developers set their own team's app secrets platform#139)

Tests cover path/app.yaml parsing, input validation, and the not-found vs exists behaviour of set.

🤖 Generated with Claude Code

Alexanderamiri and others added 2 commits October 23, 2026 17:17
Secrets declared in app.yaml resources.secrets are created with a
PLACEHOLDER value, and developers had no way to set the real one.
javabin secret list shows which still hold PLACEHOLDER (never the
values); javabin secret set <name> stores a value as an SSM SecureString
under /javabin/apps/<team>/<app>/, prompting without echo or reading
--stdin, and --restart forces a new ECS deployment so tasks pick it up.
Only names declared in app.yaml are accepted.

Needs the developer permission set change in javaBin/platform
(terraform/org, human-applied).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…Ctrl-C

- set checks the parameter exists first and refuses to create it
  (the platform creates declared secrets on deploy)
- remove --restart / ECS UpdateService; the platform restarts the
  service automatically when a secret changes (javaBin/platform#139)
- restore the terminal if interrupted during the hidden prompt
- document why list decrypts; update CLAUDE.md

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Alexanderamiri added a commit to javaBin/platform that referenced this pull request Oct 23, 2026
## Why
`app.yaml` `resources.secrets` are created with the value `PLACEHOLDER`,
but the `javabin-developer` permission set can only *read*
`/javabin/apps/<team>/*`, so no team can give its secrets real values.
cupcake needs `SP_USER`, `SP_PASSWORD`, `BRING_API_USER` and
`BRING_API_KEY`.

## What changed
- **`terraform/org/identity-center.tf`, `javabin-developer`
(human-applied):**
- `ssm:PutParameter`, `LabelParameterVersion` and `GetParameterHistory`
on `/javabin/apps/${PrincipalTag/team}/*`, **only for parameters tagged
with that team**. That means only secrets the platform created; a
hand-made parameter would break the app's next `terraform apply`.
- An explicit Deny on `*/cognito-client-*`, `*/auth` and
`*/db-master-password`, which are platform-managed.
- **New Lambda `javabin-app-secret-rollout` (CI-applied):** on an SSM
`Update` under `/javabin/apps/`, it forces a new deployment of
`{team}-{app}`, because ECS reads secrets only at task start. Developers
get no `ecs:UpdateService`: that action would also let them change
networking and task definitions.
- **Docs:** app-yaml-reference, lambda-functions, CLAUDE.md. The CLI
side is javaBin/javabin-cli#6, `javabin secret list/set`.

## Applying
- Merging applies the Lambda through platform CI.
- `terraform/org` must be applied by hand: `cd terraform/org &&
terraform plan && terraform apply` (javabin admin). It should show one
in-place update to
`aws_ssoadmin_permission_set_inline_policy.developer`.

## Known limit
A session carries a single `team` tag. A hero in several teams can
manage only the team their session is tagged with.

## Checks
- Lambda tests pass, including the new `test_app_secret_rollout.py`.
- `terraform validate` passes on `terraform/platform` and
`terraform/org`.
- An independent review agent's findings are addressed: the tag
condition, the `db-master-password` deny, and dropping UpdateService.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Alexanderamiri
Alexanderamiri merged commit 8744762 into main Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant