Allow overriding agentic engine env vars with custom secrets in engine.env#17211
Merged
Allow overriding agentic engine env vars with custom secrets in engine.env#17211
Conversation
… environment variables Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update engine.env secret filtering for agentic engine variables
Allow overriding agentic engine env vars with custom secrets in engine.env
Feb 20, 2026
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates engine.env secret handling so users can override engine-required environment variables (e.g. COPILOT_GITHUB_TOKEN) with differently-named org secrets, while still rejecting secrets in any other engine.env keys.
Changes:
- Update runtime env filtering (
FilterEnvForSecrets) to allow a secret reference when either the referenced secret name or the env var key is allowlisted. - Update strict-mode validation to exempt engine-required env var keys from secret detection within
engine.env, using engine registry lookup to derive an allowlist. - Add tests covering the new override behavior and ensuring non-engine secret keys still fail.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| pkg/workflow/strict_mode_validation.go | Adds engine-based allowlist for engine.env secret validation and new helper to derive base required keys. |
| pkg/workflow/engine_helpers.go | Adjusts runtime secret filtering to allow overrides based on env var key allowlisting. |
| pkg/workflow/env_secrets_validation_test.go | Adds strict-mode tests for allowed override + still-failing non-engine secret keys. |
| pkg/workflow/engine_helpers_secrets_test.go | Adds tests for allowing override with differently named secret and still filtering unrelated secrets. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
Fixed in 792404f. The wasm golden test files were out of date — updated them with |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
This was referenced Feb 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FilterEnvForSecretsto allow secrets where the env var KEY is in the allowed set (enabling override of engine env vars likeCOPILOT_GITHUB_TOKEN: ${{ secrets.MY_ORG_TOKEN }})getEngineBaseEnvVarKeyshelper that looks up the engine in the registry and returns its base required env var key namesvalidateEnvSecretsSectionto accept allowed env var keys and skip those when checking engine.env secretsvalidateEnvSecretsto look up the engine's base required secret names and pass them as allowed keys for engine.env validationallowedSecretsparam toallowedNamesAndKeysand update docs to reflect dual-purpose allowlistallowedEnvVarKeysinvalidateEnvSecretsSectionOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.