test: add fast-check properties for CSV escaping - #1438
Open
Viccodes11 wants to merge 1 commit into
Open
Viccodes11 wants to merge 1 commit into
Viccodes11 wants to merge 1 commit into
Conversation
|
@Viccodes11 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Closes #1322
This PR adds rigorous property-based testing to the CSV export functionality to prevent formula injection vulnerabilities and verify correct RFC 4180 escaping.
Acceptance Criteria Mapped
unescapeCsvFieldhelper correctly reverses the quoting and doubling. We assert that the unescaped content completely matches the original (modulo the safe'prefix for formulas).expect(escaped).not.toMatch(/^[=+\-@\t\r]/).{ interruptAfterTimeLimit: 1900 }on the fast-check assert configurations.Security and Failure-Mode Handling
This test verifies the defenses against CSV Injection (Formula Injection). The fuzzing properties exhaustively test strings containing structural delimiters (quotes, commas, newlines) alongside dangerous formula trigger prefixes (
=,+,-,@,\t,\r). It proves that our escaping strategy prevents payload evaluation—by unconditionally prepending a single quote (') to dangerous values, spreadsheet applications will securely treat the cell as raw text rather than an executable command or formula, neutralizing DDE (Dynamic Data Exchange) and related attacks.