Skip to content

Centralize deployment.secrets through DeploymentState#152

Merged
jonathonbyrdziak merged 3 commits intomasterfrom
refactor/deployment-secrets-state
Mar 24, 2026
Merged

Centralize deployment.secrets through DeploymentState#152
jonathonbyrdziak merged 3 commits intomasterfrom
refactor/deployment-secrets-state

Conversation

@jonathonbyrdziak
Copy link
Copy Markdown
Contributor

Summary

  • Adds secretsMode() and setSecretsMode() to DeploymentState, making it the single source of truth for reading/writing deployment.secrets
  • Production nodes (those with a NodeConfig entry) read exclusively from ~/.protocol/.node/nodes/<project>.json — never falling back to the repo-level protocol.json
  • Dev/staging (no NodeConfig) reads from the repo-level protocol.json as before
  • Replaces all 5 direct Json::read('deployment.secrets') calls and all 9 Json::write('deployment.secrets') calls across the codebase
  • Moves aws-secrets.log to /var/log/protocol/

Root cause: On production, SecretsProvider was reading deployment.secrets from protocol.json inside the release directory (e.g. /home/ec2-user/enterprise-gateway-releases/v1.0.9/protocol.json), which had "encrypted" baked into the release tag. The node-level config at ~/.protocol/.node/nodes/enterprise-gateway.json had the correct "aws" value but was never consulted.

Files changed

  • DeploymentState.php — new secretsMode() / setSecretsMode() methods
  • SecretsProvider.php, Soc2Check.php, ProtocolStatus.php, ConfigSave.php, Migrate.php — replaced direct reads
  • AwsSecretsInit.php, ConfigInit.php, Migrate.php, ProtocolInit.php — replaced direct writes
  • AwsSecretsHelper.php — log path moved to /var/log/protocol/

Test plan

  • Run protocol restart on gateway production — verify protocol exec env shows AWS secrets
  • Verify /var/log/protocol/secrets-provider.log shows mode=aws (not encrypted)
  • Run protocol config:init on a dev machine — verify protocol.json still gets deployment.secrets written
  • Run protocol aws:init on a dev machine — verify both protocol.json and NodeConfig are updated

🤖 Generated with Claude Code

jonathonbyrdziak and others added 3 commits March 23, 2026 21:19
Production nodes now read secrets mode from NodeConfig
(~/.protocol/.node/nodes/<project>.json) instead of protocol.json
in the release directory. Dev/staging falls back to repo-level
protocol.json. This fixes AWS secrets not being injected on
production deployments where protocol.json had "encrypted" baked
into the release tag.

Also moves aws-secrets.log to /var/log/protocol/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ets mode

If a NodeConfig exists (production), return its deployment.secrets
value or default to "file" — never read from the release directory's
protocol.json.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jonathonbyrdziak jonathonbyrdziak merged commit 8209075 into master Mar 24, 2026
5 of 8 checks passed
@jonathonbyrdziak jonathonbyrdziak deleted the refactor/deployment-secrets-state branch March 24, 2026 04:20
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