Skip to content

Add bounds checks tests for MT940 structured parsing#25

Merged
larsdecker merged 5 commits intomasterfrom
limit-content-parse
Dec 27, 2025
Merged

Add bounds checks tests for MT940 structured parsing#25
larsdecker merged 5 commits intomasterfrom
limit-content-parse

Conversation

@larsdecker
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings December 27, 2025 00:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds security bounds checks to three MT940 parsing functions to prevent processing of excessively long input strings that could impact performance or security. The changes include input length validation with appropriate error handling and comprehensive test coverage for these new bounds checks.

  • Added length validation checks (1000 chars for parsePaymentReferenceDate and parsePaymentReferenceTan, 10000 chars for assemblePaymentReference)
  • Implemented error throwing when input exceeds defined limits
  • Added comprehensive test suites covering boundary conditions, error cases, and valid input scenarios

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 15 comments.

File Description
packages/fints/src/mt940-86-structured.ts Added bounds check validation to three parsing functions with error handling
packages/fints/src/tests/test-mt940-86-structured.ts Added three new test suites with 9 tests total covering bounds validation, edge cases, and normal operation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/fints/src/mt940-86-structured.ts Outdated
Comment thread packages/fints/src/mt940-86-structured.ts Outdated
Comment thread packages/fints/src/mt940-86-structured.ts Outdated
Comment thread packages/fints/src/__tests__/test-mt940-86-structured.ts Outdated
Comment thread packages/fints/src/__tests__/test-mt940-86-structured.ts Outdated
Comment thread packages/fints/src/__tests__/test-mt940-86-structured.ts Outdated
Comment thread packages/fints/src/__tests__/test-mt940-86-structured.ts Outdated
Comment thread packages/fints/src/__tests__/test-mt940-86-structured.ts Outdated
Comment thread packages/fints/src/__tests__/test-mt940-86-structured.ts Outdated
Comment thread packages/fints/src/mt940-86-structured.ts Outdated
@larsdecker larsdecker merged commit 228a77c into master Dec 27, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants