Skip to content

feat: update Flowise encryption key handling to use AWS Secrets Manager - #534

Merged
ct3685 merged 1 commit into
productionfrom
staging
Sep 11, 2025
Merged

feat: update Flowise encryption key handling to use AWS Secrets Manager#534
ct3685 merged 1 commit into
productionfrom
staging

Conversation

@ct3685

@ct3685 ct3685 commented Sep 11, 2025

Copy link
Copy Markdown

Title

feat: update Flowise encryption key handling to use AWS Secrets Manager

Description

Motivation & Scope

Refactors Flowise’s encryption key configuration to use AWS Secrets Manager instead of a filesystem path. While conceptually small, this change improves security posture and standardizes secret management. Motivation inferred from diff: security and environment isolation.

Major Changes

  • copilot/copilot.appName.env.template

    • Removed SECRETKEY_PATH=/var/efs/.
    • Updated documentation comments to describe Secrets Manager–based configuration:
      • Variables: SECRETKEY_STORAGE_TYPE=aws, SECRETKEY_AWS_REGION, SECRETKEY_AWS_NAME.
      • Notes per-environment isolation and warns that key changes invalidate credentials.
    • Retained FLOWISE_SECRETKEY_OVERWRITE as an advanced override option.
  • copilot/environments/addons/flowise-encryption-key.yml (new)

    • Adds CloudFormation resource to generate a secret in AWS Secrets Manager.
    • Outputs secret Name, Arn, and Region for consumption by the service.
  • copilot/flowise/addons/flowise-secrets-manager-access-policy.yml

    • Clarified description and metadata.
    • Adjusted IAM policy to reference env-specific secret ARN ${App}-${Env}-FlowiseEncryptionKey-*.
    • Allows actions GetSecretValue, CreateSecret, and DescribeSecret.
  • copilot/flowise/manifest.yml

    • Injects new environment variables to reference the secret via CFN outputs.
    • Sets count: 2 to scale Flowise service.

Expected Impact

  • More secure and isolated management of Flowise encryption keys.
  • Simplified deployment: keys automatically provisioned and injected via env vars.
  • Slight capacity increase from scaling to two tasks.

Breaking Changes & Migrations

  • Encryption Key Migration: Credentials encrypted with the old filesystem key will be invalid unless migrated. Existing encrypted values may need re-entry.
  • No API or schema changes apparent.

Env/Config Changes

  • Introduces a new CloudFormation addon for secret provisioning.
  • Requires updated manifest variables (SECRETKEY_STORAGE_TYPE, SECRETKEY_AWS_REGION, SECRETKEY_AWS_NAME).
  • FLOWISE_SECRETKEY_OVERWRITE remains as an override option.

Testing Notes

  • Deploy to staging to confirm service can read secrets correctly.
  • Verify encrypted credentials behavior post-migration.
  • Check app startup with missing or rotated secrets.
  • Validate scaling to count: 2 functions as expected.

Related Issues/Links

  • None referenced in the diff.

…er (#533)

## Title
feat: update Flowise encryption key handling to use AWS Secrets Manager

## Description
### Motivation & Scope
Refactors Flowise’s encryption key configuration to use AWS Secrets
Manager instead of a filesystem path. While conceptually small, this
change improves security posture and standardizes secret management.
Motivation inferred from diff: security and environment isolation.

### Major Changes
- **copilot/copilot.appName.env.template**
  - Removed `SECRETKEY_PATH=/var/efs/`.
- Updated documentation comments to describe Secrets Manager–based
configuration:
- Variables: `SECRETKEY_STORAGE_TYPE=aws`, `SECRETKEY_AWS_REGION`,
`SECRETKEY_AWS_NAME`.
- Notes per-environment isolation and warns that key changes invalidate
credentials.
- Retained `FLOWISE_SECRETKEY_OVERWRITE` as an advanced override option.

- **copilot/environments/addons/flowise-encryption-key.yml** *(new)*
- Adds CloudFormation resource to generate a secret in AWS Secrets
Manager.
- Outputs secret **Name**, **Arn**, and **Region** for consumption by
the service.

- **copilot/flowise/addons/flowise-secrets-manager-access-policy.yml**
  - Clarified description and metadata.
- Adjusted IAM policy to reference env-specific secret ARN
`${App}-${Env}-FlowiseEncryptionKey-*`.
- Allows actions `GetSecretValue`, `CreateSecret`, and `DescribeSecret`.

- **copilot/flowise/manifest.yml**
- Injects new environment variables to reference the secret via CFN
outputs.
  - Sets `count: 2` to scale Flowise service.

### Expected Impact
- More secure and isolated management of Flowise encryption keys.
- Simplified deployment: keys automatically provisioned and injected via
env vars.
- Slight capacity increase from scaling to two tasks.

### Breaking Changes & Migrations
- **Encryption Key Migration:** Credentials encrypted with the old
filesystem key will be invalid unless migrated. Existing encrypted
values may need re-entry.
- No API or schema changes apparent.

### Env/Config Changes
- Introduces a new CloudFormation addon for secret provisioning.
- Requires updated manifest variables (`SECRETKEY_STORAGE_TYPE`,
`SECRETKEY_AWS_REGION`, `SECRETKEY_AWS_NAME`).
- `FLOWISE_SECRETKEY_OVERWRITE` remains as an override option.

### Testing Notes
- Deploy to staging to confirm service can read secrets correctly.
- Verify encrypted credentials behavior post-migration.
- Check app startup with missing or rotated secrets.
- Validate scaling to `count: 2` functions as expected.

### Related Issues/Links
- None referenced in the diff.
@vercel

vercel Bot commented Sep 11, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
answerai-docs Building Building Preview Sep 11, 2025 2:31am
the-answerai Building Building Preview Sep 11, 2025 2:31am

@ct3685
ct3685 merged commit 30641e5 into production Sep 11, 2025
8 of 9 checks passed
@maxtechera
maxtechera temporarily deployed to staging - theanswer-iek0 September 11, 2025 02:31 — with Render Inactive
@sonarqubecloud

Copy link
Copy Markdown

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.

2 participants