Skip to content

feat(relay): log client IP address and connection ID on error/validation failures#245

Open
PrarthanaPurohit wants to merge 1 commit into
hoytech:masterfrom
PrarthanaPurohit:feat/log-ip
Open

feat(relay): log client IP address and connection ID on error/validation failures#245
PrarthanaPurohit wants to merge 1 commit into
hoytech:masterfrom
PrarthanaPurohit:feat/log-ip

Conversation

@PrarthanaPurohit

Copy link
Copy Markdown

Description

This PR implements "log IP address in sendNoticeError and elsewhere where it makes sense".

Currently, when incoming client requests (such as EVENT, REQ, CLOSE, NEG-OPEN, etc.) fail validation or contain malformed JSON, the relay logs generic messages (e.g., Rejected invalid event: <reason>) or sends NOTICE responses back to the client without logging the client's connection details. This makes debugging misbehaving clients or diagnosing malicious actions difficult for relay operators since they cannot associate these errors with a specific Connection ID or client IP address.

This PR prepends client connection details [connId/ipAddr] (rendering the parsed client IP) to console logs across five validation and exception paths inside RelayServer::runIngester:

  1. Invalid Event Rejections (e.g., event validation/timestamp failures).
  2. Malformed REQ/COUNT Queries (failures to compile filter requests).
  3. Failed CLOSE Message Parses.
  4. Negentropy Sync Protocol Errors.
  5. Unparseable Outer JSON / Bad Messages.

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