Skip to content

[codex] Address high CodeQL findings#1612

Merged
PhilippeR26 merged 2 commits into
developfrom
codex/address-codeql-high-findings
Jun 12, 2026
Merged

[codex] Address high CodeQL findings#1612
PhilippeR26 merged 2 commits into
developfrom
codex/address-codeql-high-findings

Conversation

@adrienlacombe

Copy link
Copy Markdown
Collaborator

Summary

  • replace CodeQL-flagged regex checks with deterministic string parsing for tuple, fixed-array, and Starknet ID domain validation
  • replace single-occurrence * removal with replaceAll in calldata array type handling
  • add focused regression coverage for the flagged patterns

Validation

  • npm run lint
  • npm run ts:check
  • npx jest -i --config "{\"transform\":{\"^.+\\\\.(t|j)sx?$\":\"@swc/jest\"},\"testMatch\":[\"**/__tests__/**/(*.)+(spec|test).[jt]s?(x)\"]}" __tests__/utils/calldata/cairo.test.ts __tests__/utils/cairoDataTypes/CairoFixedArray.test.ts __tests__/utils/starknetId.test.ts

Note: the repo default Jest config requires a local Starknet devnet, so the focused unit test command bypasses global setup for these pure utility tests.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses high-severity CodeQL findings by removing potentially backtracking regex patterns in ABI/type validation utilities and replacing them with deterministic string parsing, plus adding regression tests for the flagged inputs.

Changes:

  • Replace regex-based tuple, named-tuple, fixed-array, and Starknet ID domain checks with deterministic string parsing.
  • Use replaceAll('*', '') when normalizing Cairo 0 array element types (calldata + response parsing).
  • Add focused unit/regression tests covering previously flagged backtracking-style inputs and nested fixed-array types.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/utils/starknetId.ts Replaces regex-based .stark domain validation with deterministic label parsing.
src/utils/calldata/responseParser.ts Normalizes Cairo 0 array element types using replaceAll when parsing responses.
src/utils/calldata/cairo.ts Replaces tuple/named-tuple regex checks and strips all * in getArrayType.
src/utils/cairoDataTypes/fixedArray.ts Adds deterministic fixed-array type parsing and reuses it across helpers.
tests/utils/starknetId.test.ts Adds regression tests for deterministic Starknet ID domain validation.
tests/utils/calldata/cairo.test.ts Adds regression tests for tuple/named-tuple checks and multi-* array types.
tests/utils/cairoDataTypes/CairoFixedArray.test.ts Adds regression tests for nested fixed-array types and pathological inputs.

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

Comment thread src/utils/starknetId.ts
Comment on lines +422 to +430
return name.split('.').every((label) => {
return (
label.length > 0 &&
label.length <= 48 &&
[...label].every((char) => {
return (char >= 'a' && char <= 'z') || (char >= '0' && char <= '9') || char === '-';
})
);
});
@adrienlacombe adrienlacombe marked this pull request as ready for review May 26, 2026 11:41
@PhilippeR26 PhilippeR26 self-requested a review June 12, 2026 08:29

@PhilippeR26 PhilippeR26 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me

@PhilippeR26 PhilippeR26 merged commit e941662 into develop Jun 12, 2026
9 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.

3 participants