Add comprehensive input file validation and security checks#12
Open
kallal79 wants to merge 1 commit intoveraison:masterfrom
Open
Add comprehensive input file validation and security checks#12kallal79 wants to merge 1 commit intoveraison:masterfrom
kallal79 wants to merge 1 commit intoveraison:masterfrom
Conversation
This commit implements comprehensive validation for input files to address security vulnerabilities and improve robustness as described in issue veraison#11. Security features added: - Path traversal protection: Detects and blocks ../.. patterns - File size limits: 10MB maximum to prevent resource exhaustion - File permission validation: Ensures files are readable - File type validation: Validates CBOR and JSON file formats - Empty file detection: Prevents processing empty files - Directory vs file validation: Ensures paths point to files Validation features: - Evidence file validation: .cbor extension + basic CBOR format check - Key file validation: .json extension + JWK format validation - Enhanced error messages: More descriptive and user-friendly errors New functions added: - validateInputFile(): Main validation orchestrator - validateEvidenceFile(): CBOR-specific validation - validateKeyFile(): JWK-specific validation - isValidCBORStart(): Basic CBOR format detection The checkGenCorimArgs() function has been updated to use these new validation functions, providing multiple security layers before file processing begins. Comprehensive test coverage added with 20+ test cases covering: - Path traversal attacks - File size limits - Permission errors - Invalid file formats - Empty files - Directory vs file confusion - Edge cases and security scenarios Fixes veraison#11 Signed-off-by: Kallal Mukherjee <ritamukherje62@gmail.com>
4f23fc1 to
fbd968f
Compare
Author
|
Hi sir @thomas-fossati @setrofim @carl-wallace @yogeshbdeshpande —could you please review and approve when convenient? |
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.
This commit implements comprehensive validation for input files to address security vulnerabilities and improve robustness as described in issue #11.
Security features added:
Validation features:
New functions added:
The checkGenCorimArgs() function has been updated to use these new validation functions, providing multiple security layers before file processing begins.
Comprehensive test coverage added with 20+ test cases covering:
Fixes #11