Skip to content

Comments

Allow overriding agentic engine env vars with custom secrets in engine.env#17211

Merged
pelikhan merged 6 commits intomainfrom
copilot/update-engine-env-secret-filtering
Feb 20, 2026
Merged

Allow overriding agentic engine env vars with custom secrets in engine.env#17211
pelikhan merged 6 commits intomainfrom
copilot/update-engine-env-secret-filtering

Conversation

Copy link
Contributor

Copilot AI commented Feb 20, 2026

  • Update FilterEnvForSecrets to allow secrets where the env var KEY is in the allowed set (enabling override of engine env vars like COPILOT_GITHUB_TOKEN: ${{ secrets.MY_ORG_TOKEN }})
  • Add getEngineBaseEnvVarKeys helper that looks up the engine in the registry and returns its base required env var key names
  • Update validateEnvSecretsSection to accept allowed env var keys and skip those when checking engine.env secrets
  • Update validateEnvSecrets to look up the engine's base required secret names and pass them as allowed keys for engine.env validation
  • Add/update tests for both changes
  • Code review feedback addressed
  • Update wasm golden test files to reflect new compiled output
  • Recompile workflow lock files
  • Rename allowedSecrets param to allowedNamesAndKeys and update docs to reflect dual-purpose allowlist
  • Add nil guard for allowedEnvVarKeys in validateEnvSecretsSection
Original prompt

Update the engine.env secret filtering to allow overriding the agentic engine environment variables. No other engine.env var is allowed to have secrets.


💡 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.

… 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
Copilot AI requested a review from pelikhan February 20, 2026 16:04
@pelikhan pelikhan marked this pull request as ready for review February 20, 2026 16:06
Copilot AI review requested due to automatic review settings February 20, 2026 16:06
@pelikhan
Copy link
Contributor

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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>
Copy link
Contributor Author

Copilot AI commented Feb 20, 2026

@copilot fix tests

Fix https://github.com/github/gh-aw/actions/runs/22231235044/job/64311625729#step:9:1

Fixed in 792404f. The wasm golden test files were out of date — updated them with go test -update and recompiled all workflow lock files.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan merged commit be3520c into main Feb 20, 2026
43 of 44 checks passed
@pelikhan pelikhan deleted the copilot/update-engine-env-secret-filtering branch February 20, 2026 17:02
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