MCPcopy Create free account
hub / github.com/github/gh-aw / validateOIDCPermissions

Function validateOIDCPermissions

pkg/workflow/permissions_compiler_validator.go:225–256  ·  view source on GitHub ↗
(workflowData *WorkflowData, workflowPermissions *Permissions)

Source from the content-addressed store, hash-verified

223}
224
225func validateOIDCPermissions(workflowData *WorkflowData, workflowPermissions *Permissions) error {
226 if workflowData == nil {
227 return nil
228 }
229
230 requiresIDTokenWrite := false
231 errorPrefix := ""
232
233 if workflowData.EngineConfig != nil && workflowData.EngineConfig.Auth != nil && workflowData.EngineConfig.Auth.Type == "github-oidc" {
234 requiresIDTokenWrite = true
235 errorPrefix = "engine.auth.type: github-oidc"
236 }
237
238 if !requiresIDTokenWrite && hasOTLPGitHubOIDCAuth(workflowData.ParsedFrontmatter, workflowData.RawFrontmatter) {
239 requiresIDTokenWrite = true
240 errorPrefix = "observability.otlp.github-app"
241 }
242
243 if !requiresIDTokenWrite {
244 return nil
245 }
246
247 if workflowPermissions == nil {
248 return errors.New(errorPrefix + " requires permissions.id-token: write")
249 }
250
251 if level, exists := workflowPermissions.Get(PermissionIdToken); !exists || level != PermissionWrite {
252 return errors.New(errorPrefix + " requires permissions.id-token: write")
253 }
254
255 return nil
256}

Callers 1

validatePermissionsMethod · 0.85

Calls 2

hasOTLPGitHubOIDCAuthFunction · 0.85
GetMethod · 0.45

Tested by

no test coverage detected