fix: preserve env-backed secrets for scheduler subprocess runs#1877
fix: preserve env-backed secrets for scheduler subprocess runs#1877
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe PR modifies environment secret resolution for scheduled DAGs by introducing full DAG rehydration during catch-up enqueueing, removing environment variable pre-resolution, and filtering base environment to prevent variable leakage across scheduled executions. Changes
Sequence DiagramsequenceDiagram
actor Scheduler
participant EnqueueService as Enqueue Service
participant DAGRehydrate as DAG Rehydrate
participant DAGStore as DAG Store
participant SubCmd as SubCmd Builder
participant Subprocess as Subprocess Execution
Scheduler->>EnqueueService: EnqueueCatchupRun(dag, baseConfig, ...)
EnqueueService->>DAGRehydrate: rehydrateExecutionDAG(dag, baseConfig)
DAGRehydrate->>DAGRehydrate: Resolve full DAG from source
DAGRehydrate-->>EnqueueService: fullDAG with Secrets populated
EnqueueService->>DAGStore: Persist fullDAG.Clone()
DAGStore-->>EnqueueService: Confirmed
EnqueueService-->>Scheduler: Catchup queued
Scheduler->>SubCmd: TaskStart/TaskRetry(task, envHints, ...)
Note over SubCmd: No secretHints parameter
SubCmd->>SubCmd: Build parentEnv from os.Environ() + envHints
Note over SubCmd: No presolved secret transport
SubCmd->>Subprocess: Execute with parentEnv + BaseEnv
Subprocess->>Subprocess: Resolve env-backed secrets at runtime
Subprocess-->>SubCmd: Output with secret values
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1877 +/- ##
==========================================
+ Coverage 69.02% 69.11% +0.08%
==========================================
Files 446 447 +1
Lines 55352 55361 +9
==========================================
+ Hits 38208 38261 +53
+ Misses 13739 13698 -41
+ Partials 3405 3402 -3
... and 14 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Summary
start/retry/restartsubprocess launches while keeping workflow steps isolated to filteredBaseEnvSecretsand other execution fieldsRoot Cause
dagu start/retry/restartsubprocesses were launched from a filtered environment, soprovider: envsecrets could disappear before the child runtime resolved themTesting
go test ./internal/runtime ./internal/service/scheduler ./internal/core/exec ./internal/cmdgo test ./internal/intg -run TestOneOffScheduleResolvesEnvSecretsWithoutLeakingSourceEnv -count=1Closes #1864
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Refactor