Skip to content

Commit 6c43456

Browse files
Copilotzarenner
andauthored
Always inherit top-level environment in detection job unconditionally
Co-authored-by: zarenner <13670625+zarenner@users.noreply.github.com>
1 parent d11316c commit 6c43456

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

pkg/workflow/threat_detection.go

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,23 +1026,15 @@ func (c *Compiler) buildDetectionJob(data *WorkflowData) (*Job, error) {
10261026
permissions := perms.RenderToYAML()
10271027

10281028
// Determine environment: use threat detection override if set, otherwise inherit from
1029-
// the top-level environment when OIDC is required (GitHub OIDC auth or OTLP GitHub OIDC auth).
1030-
// Azure OIDC federation rules require the environment to match the configured OIDC subject claims.
1029+
// the top-level environment (matching the same unconditional fallback used by agent
1030+
// and safe-output jobs so that environment-scoped secrets are accessible).
10311031
environment := ""
10321032
if data.SafeOutputs.ThreatDetection.Environment != "" {
10331033
// ThreatDetectionConfig.Environment holds the raw environment name; normalize it to
10341034
// a YAML field so Job.Environment renders as "environment: <name>" not just "<name>".
10351035
environment = "environment: " + data.SafeOutputs.ThreatDetection.Environment
1036-
} else if data.EngineConfig != nil && data.EngineConfig.Auth != nil && data.EngineConfig.Auth.Type == "github-oidc" {
1037-
// When engine uses GitHub OIDC, inherit top-level environment for Azure federation
1038-
if data.Environment != "" {
1039-
environment = data.Environment
1040-
}
1041-
} else if hasOTLPGitHubOIDCAuth(data.ParsedFrontmatter, data.RawFrontmatter) {
1042-
// When OTLP uses GitHub OIDC, inherit top-level environment
1043-
if data.Environment != "" {
1044-
environment = data.Environment
1045-
}
1036+
} else {
1037+
environment = data.Environment
10461038
}
10471039

10481040
job := &Job{

0 commit comments

Comments
 (0)