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

Method validateStrictMode

pkg/workflow/strict_mode_validation.go:44–100  ·  view source on GitHub ↗

validateStrictMode performs strict mode validations on the workflow This is the main orchestrator that calls individual validation functions. It performs progressive validation: 1. validateStrictPermissions() - Refuses write permissions on sensitive scopes 2. validateStrictNetwork() - Requires expl

(frontmatter map[string]any, networkPermissions *NetworkPermissions)

Source from the content-addressed store, hash-verified

42// When zizmor is enabled with --zizmor flag, strict mode will treat any security
43// findings as compilation errors rather than warnings.
44func (c *Compiler) validateStrictMode(frontmatter map[string]any, networkPermissions *NetworkPermissions) error {
45 if !c.strictMode {
46 strictModeValidationLog.Printf("Strict mode disabled, skipping validation")
47 return nil
48 }
49
50 strictModeValidationLog.Printf("Starting strict mode validation")
51
52 // Collect all strict mode validation errors
53 collector := NewErrorCollector(c.failFast)
54
55 // 1. Refuse write permissions
56 if err := c.validateStrictPermissions(frontmatter); err != nil {
57 if returnErr := collector.Add(err); returnErr != nil {
58 return returnErr // Fail-fast mode
59 }
60 }
61
62 // 2. Require network configuration and refuse "*" wildcard
63 if err := c.validateStrictNetwork(networkPermissions); err != nil {
64 if returnErr := collector.Add(err); returnErr != nil {
65 return returnErr // Fail-fast mode
66 }
67 }
68
69 // 3. Require network configuration on custom MCP servers
70 if err := c.validateStrictMCPNetwork(frontmatter, networkPermissions); err != nil {
71 if returnErr := collector.Add(err); returnErr != nil {
72 return returnErr // Fail-fast mode
73 }
74 }
75
76 // 4. Validate tools configuration
77 if err := c.validateStrictTools(frontmatter); err != nil {
78 if returnErr := collector.Add(err); returnErr != nil {
79 return returnErr // Fail-fast mode
80 }
81 }
82
83 // 5. Refuse deprecated fields
84 if err := c.validateStrictDeprecatedFields(frontmatter); err != nil {
85 if returnErr := collector.Add(err); returnErr != nil {
86 return returnErr // Fail-fast mode
87 }
88 }
89
90 // 6. Refuse disable-xpia-prompt feature flag
91 if err := c.validateStrictDisableXPIA(frontmatter); err != nil {
92 if returnErr := collector.Add(err); returnErr != nil {
93 return returnErr // Fail-fast mode
94 }
95 }
96
97 strictModeValidationLog.Printf("Strict mode validation completed: error_count=%d", collector.Count())
98
99 return collector.FormattedError("strict mode")
100}

Calls 11

AddMethod · 0.95
validateStrictNetworkMethod · 0.95
validateStrictToolsMethod · 0.95
CountMethod · 0.95
FormattedErrorMethod · 0.95
NewErrorCollectorFunction · 0.85
PrintfMethod · 0.45

Tested by 2

TestValidateStrictModeFunction · 0.76