Skip to content

Commit 218e682

Browse files
Copilotpelikhan
andcommitted
Remove 'enabled' field from OIDC config - check token_exchange_url at runtime
- Removed 'enabled' boolean field from OIDCConfig struct - Changed schema to require 'token_exchange_url' instead of 'enabled' - Updated HasOIDCConfig to check for presence of token_exchange_url - Updated all engine GetOIDCConfig methods to check token_exchange_url - Updated tests to remove enabled field checks - OIDC is now implicitly enabled when token_exchange_url is present Co-authored-by: pelikhan <[email protected]>
1 parent 00def6c commit 218e682

File tree

6 files changed

+14
-34
lines changed

6 files changed

+14
-34
lines changed

pkg/parser/schemas/main_workflow_schema.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2977,19 +2977,15 @@
29772977
},
29782978
"oidc": {
29792979
"type": "object",
2980-
"description": "OpenID Connect authentication configuration for agentic engines. When enabled, the workflow will use OIDC to obtain tokens with PAT fallback support.",
2980+
"description": "OpenID Connect authentication configuration for agentic engines. When configured, the workflow will use OIDC to obtain tokens with PAT fallback support.",
29812981
"properties": {
2982-
"enabled": {
2983-
"type": "boolean",
2984-
"description": "Enable OIDC authentication for this engine"
2985-
},
29862982
"audience": {
29872983
"type": "string",
29882984
"description": "OIDC audience identifier (e.g., 'claude-code-github-action'). Defaults to engine-specific audience if not specified."
29892985
},
29902986
"token_exchange_url": {
29912987
"type": "string",
2992-
"description": "URL endpoint to exchange OIDC token for an app token (required when OIDC is enabled)"
2988+
"description": "URL endpoint to exchange OIDC token for an app token (required for OIDC authentication)"
29932989
},
29942990
"token_revoke_url": {
29952991
"type": "string",
@@ -3004,7 +3000,7 @@
30043000
"description": "Fallback environment variable to use if OIDC token acquisition fails. Typically references a secret (e.g., ${{ secrets.ANTHROPIC_API_KEY }})"
30053001
}
30063002
},
3007-
"required": ["enabled"],
3003+
"required": ["token_exchange_url"],
30083004
"additionalProperties": false
30093005
}
30103006
},

pkg/workflow/claude_engine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func (e *ClaudeEngine) GetVersionCommand() string {
8585

8686
// GetOIDCConfig returns the OIDC configuration for Claude engine
8787
func (e *ClaudeEngine) GetOIDCConfig(workflowData *WorkflowData) *OIDCConfig {
88-
if workflowData.EngineConfig != nil && workflowData.EngineConfig.OIDC != nil && workflowData.EngineConfig.OIDC.Enabled {
88+
if workflowData.EngineConfig != nil && workflowData.EngineConfig.OIDC != nil && workflowData.EngineConfig.OIDC.TokenExchangeURL != "" {
8989
return workflowData.EngineConfig.OIDC
9090
}
9191
return nil

pkg/workflow/codex_engine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (e *CodexEngine) GetVersionCommand() string {
8484

8585
// GetOIDCConfig returns the OIDC configuration for Codex engine
8686
func (e *CodexEngine) GetOIDCConfig(workflowData *WorkflowData) *OIDCConfig {
87-
if workflowData.EngineConfig != nil && workflowData.EngineConfig.OIDC != nil && workflowData.EngineConfig.OIDC.Enabled {
87+
if workflowData.EngineConfig != nil && workflowData.EngineConfig.OIDC != nil && workflowData.EngineConfig.OIDC.TokenExchangeURL != "" {
8888
return workflowData.EngineConfig.OIDC
8989
}
9090
return nil

pkg/workflow/copilot_engine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (e *CopilotEngine) GetVersionCommand() string {
9999

100100
// GetOIDCConfig returns the OIDC configuration for Copilot engine
101101
func (e *CopilotEngine) GetOIDCConfig(workflowData *WorkflowData) *OIDCConfig {
102-
if workflowData.EngineConfig != nil && workflowData.EngineConfig.OIDC != nil && workflowData.EngineConfig.OIDC.Enabled {
102+
if workflowData.EngineConfig != nil && workflowData.EngineConfig.OIDC != nil && workflowData.EngineConfig.OIDC.TokenExchangeURL != "" {
103103
return workflowData.EngineConfig.OIDC
104104
}
105105
return nil

pkg/workflow/openid.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ import "fmt"
44

55
// OIDCConfig represents OpenID Connect authentication configuration for agentic engines
66
type OIDCConfig struct {
7-
// Enabled indicates whether OIDC authentication is enabled
8-
Enabled bool `yaml:"enabled,omitempty"`
9-
107
// Audience is the OIDC audience identifier (e.g., "claude-code-github-action")
118
Audience string `yaml:"audience,omitempty"`
129

@@ -37,13 +34,6 @@ func ParseOIDCConfig(engineObj map[string]any) *OIDCConfig {
3734

3835
oidcConfig := &OIDCConfig{}
3936

40-
// Extract enabled field (defaults to false)
41-
if enabled, hasEnabled := oidcObj["enabled"]; hasEnabled {
42-
if enabledBool, ok := enabled.(bool); ok {
43-
oidcConfig.Enabled = enabledBool
44-
}
45-
}
46-
4737
// Extract audience field
4838
if audience, hasAudience := oidcObj["audience"]; hasAudience {
4939
if audienceStr, ok := audience.(string); ok {
@@ -83,8 +73,9 @@ func ParseOIDCConfig(engineObj map[string]any) *OIDCConfig {
8373
}
8474

8575
// HasOIDCConfig checks if the engine has OIDC configuration
76+
// OIDC is considered enabled if token_exchange_url is present
8677
func HasOIDCConfig(config *EngineConfig) bool {
87-
return config != nil && config.OIDC != nil && config.OIDC.Enabled
78+
return config != nil && config.OIDC != nil && config.OIDC.TokenExchangeURL != ""
8879
}
8980

9081
// GetOIDCAudience returns the OIDC audience identifier, with a default based on engine

pkg/workflow/openid_test.go

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ func TestOIDCConfigExtraction(t *testing.T) {
1515
"engine": map[string]any{
1616
"id": "claude",
1717
"oidc": map[string]any{
18-
"enabled": true,
1918
"audience": "test-audience",
2019
"token_exchange_url": "https://api.example.com/token-exchange",
2120
"token_revoke_url": "https://api.example.com/token-revoke",
@@ -39,10 +38,6 @@ func TestOIDCConfigExtraction(t *testing.T) {
3938
t.Fatal("Expected OIDC config to be non-nil")
4039
}
4140

42-
if !config.OIDC.Enabled {
43-
t.Error("Expected OIDC to be enabled")
44-
}
45-
4641
if config.OIDC.Audience != "test-audience" {
4742
t.Errorf("Expected audience 'test-audience', got '%s'", config.OIDC.Audience)
4843
}
@@ -67,7 +62,6 @@ func TestOIDCConfigExtraction(t *testing.T) {
6762
func TestOIDCConfigDefaults(t *testing.T) {
6863
// Test with minimal OIDC configuration
6964
oidcConfig := &OIDCConfig{
70-
Enabled: true,
7165
TokenExchangeURL: "https://api.example.com/exchange",
7266
}
7367

@@ -106,7 +100,6 @@ func TestClaudeEngineWithOIDC(t *testing.T) {
106100
EngineConfig: &EngineConfig{
107101
ID: "claude",
108102
OIDC: &OIDCConfig{
109-
Enabled: true,
110103
Audience: "claude-code-github-action",
111104
TokenExchangeURL: "https://api.anthropic.com/api/github/github-app-token-exchange",
112105
TokenRevokeURL: "https://api.anthropic.com/api/github/github-app-token-revoke",
@@ -198,17 +191,17 @@ func TestHasOIDCConfig(t *testing.T) {
198191
t.Error("Expected HasOIDCConfig to return false when OIDC is nil")
199192
}
200193

201-
// Test with OIDC disabled
194+
// Test with OIDC but no token_exchange_url
202195
config.OIDC = &OIDCConfig{
203-
Enabled: false,
196+
Audience: "test-audience",
204197
}
205198
if HasOIDCConfig(config) {
206-
t.Error("Expected HasOIDCConfig to return false when OIDC is disabled")
199+
t.Error("Expected HasOIDCConfig to return false when token_exchange_url is not set")
207200
}
208201

209-
// Test with OIDC enabled
210-
config.OIDC.Enabled = true
202+
// Test with OIDC and token_exchange_url
203+
config.OIDC.TokenExchangeURL = "https://api.example.com/exchange"
211204
if !HasOIDCConfig(config) {
212-
t.Error("Expected HasOIDCConfig to return true when OIDC is enabled")
205+
t.Error("Expected HasOIDCConfig to return true when token_exchange_url is set")
213206
}
214207
}

0 commit comments

Comments
 (0)