Skip to content

Fix syslog server panic on RFC5424 nil timestamp - #614

Merged
chombium merged 1 commit into
cloudfoundry:mainfrom
dlinsley:fix/nil-timestamp
Oct 29, 2026
Merged

chombium merged 1 commit into
cloudfoundry:mainfrom
dlinsley:fix/nil-timestamp

Conversation

@dlinsley

Copy link
Copy Markdown
Contributor

Description

RFC5424 §6.2.3 allows the TIMESTAMP field to be the NILVALUE "-", in which case the parser leaves msg.Timestamp nil. convertToEnvelope dereferenced it unconditionally, so a single such message panicked the syslog server.

  • Fall back to the time of receipt when the timestamp is nil.
  • Return early in parseListener when the result is not an RFC5424 message; previously it logged the error and fell through.
  • Add a test that a nil-timestamp message is accepted and stamped with the receive time.

Checked for other unchecked dereferencing scenarios. Only other possibility was with *msg.Priority but confirmed in the vendored code it could only be nil if configured with: rfc5424.WithOptionalPriority() in github.com/leodido/go-syslog/v4. It is not configured as such in this codebase.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Testing performed?

  • Unit tests
  • Integration tests
  • Acceptance tests

Checklist:

  • This PR is being made against the main branch, or relevant version branch
  • I have made corresponding changes to the documentation
  • I have added testing for my changes

If you have any questions, or want to get attention for a PR or issue please reach out on the #logging-and-metrics channel in the cloudfoundry slack

RFC5424 §6.2.3 allows the TIMESTAMP field to be the NILVALUE "-", in
which case the parser leaves msg.Timestamp nil. convertToEnvelope
dereferenced it unconditionally, so a single such message panicked the
syslog server.

- Fall back to the time of receipt when the timestamp is nil.
- Return early in parseListener when the result is not an RFC5424
  message; previously it logged the error and fell through.
- Add a test that a nil-timestamp message is accepted and stamped with
  the receive time.

@chombium chombium left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! Yet another great fix @dlinsley

@github-project-automation github-project-automation Bot moved this from Inbox to Pending Merge | Prioritized in Application Runtime Platform Working Group Oct 29, 2026
@chombium
chombium merged commit b5de572 into cloudfoundry:main Oct 29, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from Pending Merge | Prioritized to Done in Application Runtime Platform Working Group Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants