🚨 CRITICAL: v0.7.19 - None Value Validation Bypass Regression Fix#55
Merged
Conversation
CRITICAL SECURITY/INTEGRITY BUG FIX: - GraphQL mutations were completely bypassing FraiseQL input validation - Empty strings and invalid data were reaching the database unvalidated - Root cause: coerce_input() used object.__new__() instead of constructor CHANGES: - Fixed coerce_input() to call cls(**coerced_data) instead of manual object creation - Added comprehensive regression tests for GraphQL validation enforcement - Verified all existing functionality remains intact IMPACT: - Restores intended validation behavior for GraphQL mutations - Prevents invalid data from bypassing FraiseQL type safety - Critical fix for data integrity and security TESTING: - All 110+ regression tests pass - New test suite prevents future validation bypass regressions - Validated fix works with existing coercion patterns 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Make version test version-agnostic using regex pattern - Support automatic version updates without test changes - Maintains test validity while allowing version flexibility 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This hotfix resolves a critical validation bypass where None values were accepted for required string fields in GraphQL input processing. ## Critical Issue Fixed - **Problem**: None values bypassed validation for required fields - **Impact**: Complete data integrity failure in GraphQL mutations - **Root Cause**: Validation checked `final_value is not None` before applying validation - **Solution**: Enhanced validation to reject None for required fields ## Changes Made - Enhanced `_validate_input_string_value()` to validate None values - Added field metadata parameter for required field detection - Improved error messages for None vs empty string validation - Added comprehensive regression tests for None value validation ## Validation Behavior (v0.7.19) ✅ Required fields: `name: str` rejects None with clear error ✅ Empty strings: Still rejected as before ✅ Optional fields: `name: str | None = None` works correctly ✅ Backward compatibility: No breaking changes for valid code ## Files Modified - src/fraiseql/utils/fraiseql_builder.py (validation logic) - tests/regression/test_v0717_graphql_validation_bypass_regression.py (test coverage) - src/fraiseql/__init__.py (version bump to 0.7.19) - pyproject.toml (version bump) - CHANGELOG.md (release notes) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
🚨 Critical Security Hotfix: v0.7.19
This PR fixes a critical validation bypass vulnerability where
Nonevalues were accepted for required string fields in GraphQL input processing.Critical Issue Fixed
final_value is not Nonebefore applying validationChanges Made
_validate_input_string_value()to validate None values for required fieldsValidation Behavior (Fixed in v0.7.19)
Files Modified
src/fraiseql/utils/fraiseql_builder.py- Core validation logic fixtests/regression/test_v0717_graphql_validation_bypass_regression.py- Added None validation testssrc/fraiseql/__init__.py- Version bump to 0.7.19pyproject.toml- Version bump to 0.7.19CHANGELOG.md- Comprehensive release notesTest Results
Upgrade Priority
🔴 IMMEDIATE - All users should upgrade from v0.7.18 to prevent data integrity issues.
Backward Compatibility
✅ No breaking changes - Only fixes validation that should have been working
🤖 Generated with Claude Code