Skip to content

Security: Weak NodeID validation allows arbitrary identifier values#1103

Open
tuanaiseo wants to merge 1 commit intoepfml:developfrom
tuanaiseo:contribai/fix/security/weak-nodeid-validation-allows-arbitrary-
Open

Security: Weak NodeID validation allows arbitrary identifier values#1103
tuanaiseo wants to merge 1 commit intoepfml:developfrom
tuanaiseo:contribai/fix/security/weak-nodeid-validation-allows-arbitrary-

Conversation

@tuanaiseo
Copy link
Copy Markdown

Problem

The isNodeID type guard accepts any string as a valid node identifier. In distributed/federated protocols, permissive identifiers can enable impersonation, collision attacks, log/message confusion, or protocol abuse (e.g., empty strings, extremely long IDs, crafted control characters).

Severity: medium
File: discojs/src/client/types.ts

Solution

Enforce a strict NodeID format (length bounds + regex whitelist, e.g. ^[a-zA-Z0-9_-]{1,64}$), and reject invalid IDs at all trust boundaries (both client and server). Consider canonicalization and uniqueness checks server-side.

Changes

  • discojs/src/client/types.ts (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

The `isNodeID` type guard accepts any string as a valid node identifier. In distributed/federated protocols, permissive identifiers can enable impersonation, collision attacks, log/message confusion, or protocol abuse (e.g., empty strings, extremely long IDs, crafted control characters).

Affected files: types.ts

Signed-off-by: tuanaiseo <221258316+tuanaiseo@users.noreply.github.com>
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.

1 participant