Skip to content

feat(cdn): enhance CdnDefinitionProvider with environment variable ha…#2189

Open
sharjeelyunus wants to merge 2 commits intomainfrom
cdn-encryption
Open

feat(cdn): enhance CdnDefinitionProvider with environment variable ha…#2189
sharjeelyunus wants to merge 2 commits intomainfrom
cdn-encryption

Conversation

@sharjeelyunus
Copy link
Copy Markdown
Member

@sharjeelyunus sharjeelyunus commented Apr 25, 2026

…ndling and secret management

  • Added support for loading environment variables from asset files, including .env.secrets and .env.
  • Implemented methods to manage runtime secrets and ensure compatibility with existing dotenv initialization.
  • Enhanced the manifest decoding process to extract secrets from the artifacts section.
  • Introduced utility functions for base64 and hex decoding to support secret parsing.

Note

Medium Risk
Adds conditional fetching/decryption of an encrypted CDN manifest and new secret/env merging logic, which could break app startup or secret resolution if keys/payloads are misconfigured. Touches network loading and runtime configuration paths but is scoped to CdnDefinitionProvider.

Overview
CdnDefinitionProvider now preloads env values from bundled .env.secrets/.env assets (and merges existing dotenv) so it can reliably detect and use encryption settings during initialization.

Manifest fetching is enhanced to optionally request encrypted-manifest.json (with optional x-manifest-key), decrypt an AES-GCM envelope, and fall back to manifest.json on 404; decoding also now handles wrapped manifests via _decodeManifestRoot.

Secrets handling is expanded by extracting artifacts.secrets from the manifest into runtime secrets and returning them alongside dotenv secrets via getSecrets().

Reviewed by Cursor Bugbot for commit 3074ba4. Configure here.

…ndling and secret management

- Added support for loading environment variables from asset files, including `.env.secrets` and `.env`.
- Implemented methods to manage runtime secrets and ensure compatibility with existing dotenv initialization.
- Enhanced the manifest decoding process to extract secrets from the artifacts section.
- Introduced utility functions for base64 and hex decoding to support secret parsing.
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3074ba4. Configure here.

…DefinitionProvider

- Enhanced the _applySecretsFromRoot method to ensure runtime secrets are cleared when no artifacts are present.
- Updated secret retrieval logic to prioritize asset environment variables and handle dotenv initialization more robustly.
- Removed redundant calls to _applySecretsFromRoot in manifest processing to streamline the workflow.
- Introduced a flag to track successful fetching of encrypted manifests, improving error handling during HTTP requests.
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