Repository navigation
Honor imported engine secret allowlists in strict mode - #75382
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
❌ Design Decision Gate 🏗️ failed to deliver outputs during design decision gate check.
|
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
Warning The 🏗️ Design Decision Gate — ADR RequiredThis PR makes significant changes to core business logic (>100 new lines) but does not have a linked Architecture Decision Record (ADR). 📄 Draft ADR committed:
📋 What to do next
The gate will re-run after the ADR is linked and verify that the implementation matches the decision. 🔎 Evidence usedThe pre-fetched gate summary reports 109 added lines in the default business-logic directories and no 📋 Michael Nygard ADR formatA complete ADR must contain Context, Decision, Alternatives Considered, and Consequences, with positive and negative trade-offs.
|
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Reviewed the changed validation flow and regression tests. One medium test-isolation issue should be addressed: assertion failures inside captureStderr can skip restoration of os.Stderr and contaminate later tests.
Highlights
- Imported-engine validation is deferred appropriately while top-level
envremains checked early. - The added coverage exercises allowlisted and undeclared engine environment keys.
- Please make stderr restoration unconditional in the test path.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
| Say hello. | ||
| `, tt.strict, tt.key, tt.topLevelEnv) | ||
| require.NoError(t, os.WriteFile(path, []byte(content), 0600)) | ||
| stderr := captureStderr(func() { |
There was a problem hiding this comment.
This require inside captureStderr can terminate the test goroutine before the helper restores os.Stderr, leaving the process pointed at a closed pipe and corrupting output for subsequent tests.
💡 Restore stderr even on assertion failure
require.ErrorContains and require.NoError call runtime.Goexit on failure, so the helper's post-callback restoration is skipped. Move assertions outside the capture callback, use the t-aware helper that defers restoration, or update the shared helper to restore os.Stderr with defer.
There was a problem hiding this comment.
Fixed in 313b98c: the capture callback only records compilation results. All assertions now run after captureStderr has restored stderr; file and string regression cases pass.
There was a problem hiding this comment.
🟡 Changes recommended
Strict workflows accept imported engine secrets with firewall versions below v0.25.3, where missing environment-exclusion support leaves those secrets visible to the agent container.
1 open issue
What changed in this PR
Fixes strict-mode validation so imported engines can use secrets under their declared environment-variable allowlists, addressing #75272.
Changes:
- Defers
engine.envvalidation until imported engines are registered. - Keeps top-level environment checks early, avoids duplicate warnings, and preserves positioned errors.
- Adds regression coverage for declared and undeclared keys, warning counts, and fallback-model context.
| File | Description |
|---|---|
pkg/workflow/strict_mode_env_validation.go |
Separates engine environment validation and defers it for imports. |
pkg/workflow/env_secrets_validation_test.go |
Adds imported-engine and fallback-model regression tests. |
pkg/workflow/compiler_orchestrator_workflow.go |
Runs deferred validation after imports resolve and formats errors with source positions. |
Review effort: Balanced (auto)
| if err := c.withEffectiveStrictMode(ctx.frontmatter.Frontmatter, func() error { | ||
| return c.validateEnvSecretsWithModels(ctx.frontmatter.Frontmatter, ctx.workflowData.ModelMappings) | ||
| // Top-level env was already checked before imports were merged. | ||
| return c.validateEngineEnvSecretsWithModels(ctx.frontmatter.Frontmatter, ctx.workflowData.ModelMappings) |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs, /tdd, and /codebase-design. Requesting changes because the new early return opens a strict-mode bypass on the string-compile path.
📋 Key Themes & Highlights
Key Themes
- Strict-mode bypass (blocking):
ParseWorkflowStringnever runs the deferredengine.envcheck, so an undeclared secret on an imported engine passes understrict: true. Reproduced with a probe test. - Test hygiene:
require.*insidecaptureStderrcan leaveos.Stderrredirected on failure (confirmed with a probe). - Brittle assertion: the hardcoded
:7:1:ties the test to fixture layout. - Coverage gap: no test exercises the string-API path, and I could not confirm the new tests fail on the base commit.
Positive Highlights
- ✅ The import-aware split of
validateEnvSecretsWithModelsintovalidateEngineEnvSecretsWithModelsis a clean seam. - ✅ The new branch is commented to explain why the early check is deferred.
- ✅ Targeted tests pass and gofmt is clean.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~7 AIC · ⌖ ~1 AIC · ⊞ 5.4K
Comment /matt to run again
| } | ||
|
|
||
| func (c *Compiler) validateEarlyEnvSecrets(frontmatter map[string]any) error { | ||
| if frontmatterDeclaresImports(frontmatter) { |
There was a problem hiding this comment.
[/diagnosing-bugs] Strict-mode bypass on the string-compile path. The new early return skips engine.env secret validation for imported engines, and that check only runs from validateWorkflowBuildContext. ParseWorkflowString in compiler_string_api.go calls setupWorkflowBuildContext but never calls validateWorkflowBuildContext, so an undeclared engine.env secret passes with err=nil under strict: true. I reproduced this with a temporary probe test. It errors correctly once this early-return branch is removed.
💡 Suggested fix
Run the deferred engine.env check on the string path too. The simplest option is to call validateEngineEnvSecretsWithModels from validateStringWorkflowData, or from a shared step that both paths call. Then add a regression test that uses ParseWorkflowString with an imported engine that declares an undeclared secret in engine.env under strict mode.
@copilot please address this.
There was a problem hiding this comment.
Fixed in 313b98c: deferred validation now runs from shared setupWorkflowBuildContext, covering both parsing APIs after imports resolve. Regression tests verify ParseWorkflowString itself rejects undeclared secrets, accepts declared keys, and emits non-strict warnings once.
| Say hello. | ||
| `, tt.strict, tt.key, tt.topLevelEnv) | ||
| require.NoError(t, os.WriteFile(path, []byte(content), 0600)) | ||
| stderr := captureStderr(func() { |
There was a problem hiding this comment.
[/tdd] captureStderr restores os.Stderr only after its callback returns, and require.* calls t.FailNow(), which exits the goroutine. A failing assertion here leaves stderr redirected for the rest of the test binary. I confirmed this with a probe. Use assert.* inside the closure, or move the assertions outside the capture.
@copilot please address this.
There was a problem hiding this comment.
Fixed in 313b98c: moved every assertion outside the stderr-capture callback, so fatal assertions cannot interrupt stderr restoration.
| err := NewCompiler().CompileWorkflow(path) | ||
| if tt.wantSection != "" { | ||
| require.ErrorContains(t, err, "strict mode: secrets detected in '"+tt.wantSection+"' section") | ||
| assert.Contains(t, err.Error(), path+":7:1:") |
There was a problem hiding this comment.
[/codebase-design] Hardcoding path+":7:1:" ties this test to the line layout of the fixture YAML. It also points at the engine: line rather than env:, which is a pre-existing location quirk this PR does not need to fix. Assert on the section name (already covered by wantSection) and drop the line assertion, or derive the expected line from findFrontmatterFieldLine.
@copilot please address this.
There was a problem hiding this comment.
Fixed in 313b98c: removed the hardcoded :7:1: assertion while retaining the section-specific error assertions for both file and string parsing.
|
Copilot assignment requested for the following outstanding work:
Once you start work, post this work summary as a PR comment without the leading Copilot mention, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI. Sous-chef requested-head: 82fde01
|
Assignment running:
I’ll reply to and resolve addressed review threads where supported, without merging the PR or triggering CI. Sous-chef requested-head: 82fde01 |
…de-env-vars Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
🎉 This pull request is included in a new release. Release: |

Strict mode checked
engine.envbefore imported engines were registered, rejecting secrets under keys declared inbehaviors.supported-env-var-keys.engine.envchecks until imports resolve; keep top-levelenvchecks early.supported-env-var-keysforengine.envsecrets #75272