Feat/pydantic yaml validation#2436
Closed
khushal-winner wants to merge 4 commits intoOWASP:masterfrom
Closed
Conversation
- Add Pydantic as dev dependency (v2.12.5) - Create comprehensive Pydantic models for card validation: - Card: Individual card structure with id, value, url, desc, misc, and optional card type - Suit: Container for cards with id and name - Meta: File metadata (edition, component, language, version) - CornucopiaData: Main model allowing extra top-level fields - Integrate validation into convert.py get_language_data function - Add 21 comprehensive unit tests covering all models and edge cases - Validation complements existing FAILSAFE_SCHEMA (OWASP#2406) - Strict validation for card structures while allowing flexibility for additional sections Testing: - All 21 tests pass - Successfully validates real webapp-cards-3.0-en.yaml file - Handles Joker cards with 'card' field - Provides clear error messages for validation failures
- Prevents ClusterFuzzLite from running on feature branches - Only runs on master pull requests as intended - Fixes workflow failures on feature branches
- Fix duplicate 'uses' in scorecard.yml (removed duplicate line) - Fix multi-line Python script in smoke-tests.yaml (converted to single line) - Both workflow files now pass YAML validation - Resolves GitHub Actions workflow syntax errors
- Remove branch restriction from cflite_pr.yml - Restores original behavior (runs on all PRs with matching paths) - Maintains consistency with master branch configuration
8f03876 to
6e73026
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: Add Pydantic models for stricter YAML card validation
Closes #2430
Changes
card_models.pywith baseCardmodel (requiredtitle,description; typedmappings; optional suit fields)convert.py(raisesValidationErroron invalid structure)Why?
Tested
Before vs After
ValidationError(e.g. "title required", "mappings must be dict")Ready for review — happy to adjust schema or extend to other files.