[Schema Consistency] Schema Consistency Report - 2025-11-22: Security Fields & Type Coercion #4533
Closed
Replies: 1 comment
-
|
This discussion was automatically closed because it was created by an agentic workflow more than 1 week ago. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
🔍 Schema Consistency Check - 2025-11-22
This automated analysis examines consistency between the JSON schema, parser implementation, compiler code, documentation, and real workflows. This run focused on security-sensitive fields and type coercion patterns.
Summary
Analysis completed using strategy-006 (Security-Sensitive Field & Type Coercion Audit). This strategy audits security-sensitive fields for proper validation and warnings, and detects type coercion issues where code accepts types not in schema.
Full Report Details
Analysis Overview
Critical Issues
1. Float-to-Int Silent Truncation Not Documented in Schema
Severity: MODERATE
Location:
pkg/workflow/map_helpers.go:parseIntValue(),pkg/workflow/metrics.go:ConvertToInt()Problem: Runtime accepts float values for integer fields and silently truncates them with only a log warning. Schema doesn't document this behavior.
Example:
Impact:
Evidence:
Recommendation: Add
$commentto integer fields in schema documenting float truncation behavior:{ "type": "integer", "$comment": "Runtime accepts float values and truncates to integer with warning" }2. String-to-Integer Type Coercion Not Documented
Severity: MODERATE
Location:
pkg/workflow/engine.go:79-86(max-turns field)Problem: Runtime accepts string representations of integers (e.g.,
"300"), but schema only documents type asinteger.Example:
Impact:
Evidence:
Affected Fields:
engine.max-turnsparseIntValue()Recommendation: Document polymorphic type acceptance using
oneOfor$comment:{ "oneOf": [ {"type": "integer"}, {"type": "string", "pattern": "^[0-9]+$"} ], "description": "Maximum turns (integer or string representation)" }3. Type Coercion in error_patterns Fields
Severity: LOW
Location:
pkg/workflow/engine.go:162-176Problem: The
level_groupandmessage_groupfields acceptint,float64, anduint64types, but schema only documents them asinteger.Evidence:
Impact: Runtime is more permissive than schema suggests
Recommendation: Document type flexibility in schema
4. secret-masking Uses Potentially Dead githubActionsStep Reference
Severity: LOW
Location:
pkg/parser/schemas/main_workflow_schema.json:secret-masking.stepsProblem: Previous analysis (strategy-010) identified
githubActionsStepas potentially dead code, butsecret-masking.stepsstill references it.Schema:
Impact:
Recommendation: Verify githubActionsStep definition status and clarify intended use in secret-masking context
Positive Findings
1. Exemplary Security Documentation for github-token
Location:
docs/src/content/docs/reference/frontmatter.md:74-93The
github-tokenfield documentation is exemplary for security guidance:✅ Explicit caution callout
✅ Lists valid formats (secrets expressions only)
✅ Lists invalid formats (plaintext, env vars)
✅ Clear explanation of security rationale
✅ Token precedence hierarchy documented
Quote from docs:
This is a model for how all security-sensitive fields should be documented.
2. Comprehensive Permissions Schema
Location:
pkg/parser/schemas/main_workflow_schema.json:permissionsThe permissions field has excellent schema quality:
✅ Well-structured oneOf pattern (shorthand vs detailed object)
✅ Enum validation for all permission scopes
✅ Clear descriptions for every permission level
✅ Examples showing both simple and complex usage
✅ Security principle documented ("least privilege")
Example schema:
{ "description": "GitHub token permissions for the workflow. Use the principle of least privilege - only grant the minimum permissions needed.", "oneOf": [ { "type": "string", "enum": ["read-all", "write-all", "read", "write"] }, { "type": "object", "properties": { "contents": { "enum": ["read", "write", "none"], "description": "Permission for repository contents" } } } ] }3. Robust Domain Allowlist Implementation
Location:
pkg/workflow/domains.goThe network domain allowlist validation is well-implemented:
✅ Ecosystem identifiers for common tool stacks (node, python, ruby, etc.)
✅ Wildcard domain matching support (
*.example.com)✅ Proper default allowlist for backwards compatibility
✅ Empty allowlist means deny-all (secure default)
✅ Domain deduplication in Copilot domain merging
Secure default code:
4. Permissions Parser Validation
Location:
pkg/workflow/permissions.go:104-143The permissions parser includes proper validation:
✅ Validates shorthand permissions syntax
✅ Rejects invalid
all: writecombination✅ Rejects invalid
all: readwith: nonecombinations✅ Graceful handling (returns nil for invalid permissions)
Validation code:
5. Real Workflow Usage Validates Design
Examined 78 production workflows in
.github/workflows/*.md:✅ All use proper permissions syntax
✅ Network allowlists properly configured with ecosystem identifiers
✅ No plaintext tokens found
✅ All security-sensitive fields used correctly
Example from workflows:
Key Insights
Type System Flexibility vs Schema Strictness
The analysis reveals an intentional design choice: the runtime is more permissive than the schema suggests. This improves user experience (accepts more formats) but creates a gap for external validators.
Tradeoff:
max-turns: "300"(YAML numeric string) and it worksRecommendation: Document this intentional permissiveness in schema metadata using
$commentfields.Security Documentation Excellence
The
github-tokenfield demonstrates best practices for security-sensitive configuration:This model should be applied to other security fields like
networkandpermissions.Defense in Depth
The codebase implements multiple layers of validation:
Each layer adds value, but the gaps between layers create the inconsistencies found in this analysis.
Recommendations
High Priority
Document Type Coercion Behavior
$commentto integer fields explaining float truncation$commentdocumenting string-to-int conversiononeOffor polymorphic fields (int | string)Verify githubActionsStep Definition
Medium Priority
Standardize Type Flexibility
Expand Security Warnings
networkfieldpermissionsfieldLow Priority
--strict-typesflag to compilerSchema Field Coverage
Analyzed 4 security-sensitive fields:
permissionsgithub-tokennetworksecret-maskingType Coercion Matrix
Runtime type acceptance vs schema definitions:
max-turnslevel_groupmessage_groupImpact: 4 undocumented type coercion patterns
Strategy Performance
Why This Strategy Works:
Next Steps
Immediate Actions
$commentfields documenting type coercion behaviorFollow-up Analysis
Long-term Improvements
Conclusion
Overall Assessment: The security-sensitive fields show excellent implementation quality with only minor documentation gaps. The main finding is that runtime type coercion is more permissive than schema suggests, which is intentional for user experience but should be documented.
No Critical Security Issues Found. All security validations are working correctly:
The issues found are documentation and schema metadata gaps, not security vulnerabilities.
Strategy Used: strategy-006 (Security-Sensitive Field & Type Coercion Audit)
Date: 2025-11-22
Next Recommended Strategy: strategy-017 (Runtime Type Behavior vs Schema Type Definitions)
Beta Was this translation helpful? Give feedback.
All reactions