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)
| 42 | // When zizmor is enabled with --zizmor flag, strict mode will treat any security |
| 43 | // findings as compilation errors rather than warnings. |
| 44 | func (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 | } |