Skip to content

Document dynamic references for sensitive parameters - #137

Open
QuiltSimon wants to merge 1 commit into
mainfrom
docs/sso-secrets-dynamic-references
Open

QuiltSimon wants to merge 1 commit into
mainfrom
docs/sso-secrets-dynamic-references

Conversation

@QuiltSimon

Copy link
Copy Markdown
Contributor

Customers ask how to keep SSO client secrets out of Terraform code and state. Adds an EXAMPLES.md section showing {{resolve:secretsmanager:...}} / {{resolve:ssm-secure:...}} on the sensitive parameters, with required permissions and the rotation caveat, plus a pointer from VARIABLES.md. Docs only.

Made with Cursor

Co-authored-by: Cursor <cursoragent@cursor.com>
@greptile-apps

greptile-apps Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Confidence Score: 4/5RetriggerView in Greptile

[Low impact] The PR changes documentation for Terraform users deploying SSO secrets.

The documentation appears safe to merge, with non-blocking improvements to secret creation and access requirements.

Findings

  1. P2 Secret access requirements are incomplete ▶
  2. P2 Security Secrets enter shell history ▶

Reviews (1) · Last reviewed commit: "Document dynamic references for sensitiv..." · Reviewed by Greptile

Comment thread EXAMPLES.md
Comment on lines +486 to +488
- The identity that runs the stack create/update (or the CloudFormation service role, if
the stack uses one) needs `secretsmanager:GetSecretValue` on the secret (or
`ssm:GetParameter` and `kms:Decrypt` for `ssm-secure`).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Secret access requirements are incomplete

If a Secrets Manager secret uses a customer-managed KMS key, the deploying identity also needs kms:Decrypt and access through the key's policy. Following the listed permissions alone can leave CloudFormation unable to read the secret. Add these requirements, and note that cross-account secrets also need a secret policy that allows the deploying identity.

Comment thread EXAMPLES.md
```bash
aws secretsmanager create-secret \
--name quilt/okta-client-secret \
--secret-string 'YOUR-OKTA-CLIENT-SECRET'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 security Secrets enter shell history

Replacing this placeholder with a real client secret puts it directly in the shell command. The shell can save it in history, and other local processes may see it in the command's arguments. Show the Secrets Manager console or a protected file passed with --secret-string file://... instead.

How this was verified: The example passes the client secret directly as the --secret-string command-line argument.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@sir-sigurd sir-sigurd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this on a minimal stack that reproduces the pattern: a NoEcho parameter Ref'd into an AWS::SecretsManager::Secret's SecretString, which is where the client secret parameters end up (KB). I drove it through the CloudFormation API, not through the Quilt template or Terraform. A {{resolve:secretsmanager:...}} string passed as the parameter value does resolve: the stack's secret held the source value. Two parts don't work as written.

1. ssm-secure is rejected. CreateStack fails with SSM Secure reference is not supported in: [AWS::SecretsManager::Secret/Properties/SecretString]. ssm-secure works only in the properties AWS lists, and SecretString isn't one of them. This affects the ssm-secure example, the ssm:GetParameter/kms:Decrypt part of the first note, and the VARIABLES.md tip.

2. The rotation steps don't pick up the new value. "After rotating, run a stack update" leaves the parameter string unchanged, and with an unchanged string the stack's secret keeps the old value. After rotating the source:

  • an update with identical inputs is refused: No updates are to be performed.
  • an update that changes only another parameter completes and leaves the secret untouched;
  • switching the reference to pin the new version's version-id reports the secret UPDATE_COMPLETE but writes no new version.

So the redeploy that follows restarts the registry with the old value. Two changes did write a new version: changing a literal value, and moving a version-id pin from one version to another. AWS flags the unpinned-to-pinned case: "CloudFormation doesn't track which version of a secret was used in previous deployments. … Monitor and validate resource updates when making changes to dynamic reference configurations, such as when transitioning from unversioned to versioned dynamic references, and vice versa." (docs). What rotation flow is this section meant to support?

Smaller:

  • The read isn't one-time. CloudTrail logged GetSecretValue on the source, by the caller, during an update that changed only an unrelated parameter. So the identity running Terraform appears to need access on every stack update, not just the first; I didn't test an update with that access removed. With the source secret deleted, stack delete fails: You can't perform this operation on the secret because it was marked for deletion.
  • aws ecs update-service --force-new-deployment also needs --cluster and --service.
  • --secret-string 'YOUR-OKTA-CLIENT-SECRET' leaves the secret in shell history.
  • Greptile's KMS and cross-account notes hold.
  • Pre-existing, not from this PR: state still holds the DB password (inside DBUrl) and AdminPassword, which the module sets itself, so state stays sensitive with this pattern too.

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.

3 participants