Skip to content

Conversation

@alltheseas
Copy link

Summary

  • enforce the NIP-01 non-empty, ≤64 byte limit inside SubId
  • shrink MAX_SUBID_SIZE so every subscription constructor shares the same cap

Motivation

  • Prevent the documented DoS: 10,000 REQs with 100 KB IDs previously consumed ~1
    GB of RAM and forced EVENT replies to echo 100 KB; with the cap, worst-case REQs
    reserve ~640 KB and replies echo <=64 bytes.

Breaking changes

  • REQ subscription IDs longer than 64 characters now fail validation per NIP-01;
    clients that relied on longer IDs must adjust.

Testing

  • make test-subid
  • PATH="$PWD/nostril:$PATH" perl test/writeTest.pl

@alltheseas
Copy link
Author

cc @jb55

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