-
Notifications
You must be signed in to change notification settings - Fork 46
Description
Description
The workflow schema defines 18 minItems constraints but 0 maxItems constraints, allowing unbounded array sizes. This creates potential security and resource management issues as workflows can specify arbitrarily large arrays without validation.
Current State
From schema analysis (2026-01-25):
- 18 array fields have
minItemsconstraints (minimum size enforced) - 0 array fields have
maxItemsconstraints (no maximum size limits) - All array fields are unbounded and accept unlimited elements
Impact
Security Risks:
- Potential for denial-of-service through extremely large arrays
- Unbounded memory usage during schema validation
- No protection against maliciously crafted workflows
Resource Management:
- CI/CD workflows could consume excessive memory processing large arrays
- GitHub Actions runners could be overwhelmed
- Workflow compilation could timeout on massive arrays
Suggested Changes
Step 1: Audit array field usage to determine reasonable maximums
# Find all array fields with minItems in schema
grep -A 2 '"minItems"' pkg/parser/schemas/main_workflow_schema.json
# Review real-world workflows for typical array sizes
grep -r 'branches:' .github/workflows/*.md | wc -lStep 2: Add maxItems constraints based on real usage patterns
Example fields likely needing limits:
branches/branches-ignorearrays → reasonable max: 50paths/paths-ignorearrays → reasonable max: 100typesarrays (issue/PR triggers) → reasonable max: 20- Tool configuration arrays → reasonable max: 25
Step 3: Update schema with constraints
{
"branches": {
"type": "array",
"minItems": 1,
"maxItems": 50, // NEW
"items": { "type": "string" }
}
}Step 4: Test schema changes
make build # Rebuild with updated schema
make test # Verify existing workflows still validate
make recompile # Recompile all workflowsFiles Affected
pkg/parser/schemas/main_workflow_schema.json(add maxItems constraints)- Potentially workflow validation error messages if new limits trigger
Success Criteria
- ✅ All 18 array fields with
minItemsnow have reasonablemaxItemsconstraints - ✅ Constraints based on analysis of real workflow usage patterns (not arbitrary)
- ✅ All existing workflows continue to validate successfully
- ✅ Schema documentation updated with rationale for chosen limits
- ✅ Tests pass with new constraints
Source
Extracted from Schema Validation Complexity Analysis discussion #11802
Relevant excerpt:
Zero maxItems Constraints:
- Schema has 18 minItems but 0 maxItems
- All array fields are unbounded
- Potential for unbounded memory usage
- No protection against extremely large arrays
Priority
High - Addresses both security (DoS protection) and resource management. Should be completed before next security audit.
Implementation Estimate
Effort: 1-2 days
- Day 1: Audit real workflow usage, determine reasonable limits, update schema
- Day 2: Test changes, recompile workflows, verify all tests pass
AI generated by Discussion Task Miner - Code Quality Improvement Agent
- expires on Feb 9, 2026, 9:07 PM UTC