Update StructuredDataMessage Javadoc for RFC 5424 compliance#4103
Update StructuredDataMessage Javadoc for RFC 5424 compliance#4103DrDrunkenstien-10 wants to merge 2 commits into
Conversation
|
@ppkarwasz, would you mind helping with reviewing this one, please? |
|
Thank you for the contribution, the Javadoc improvement is very appreciated! ❤️ However, since we'll be preparing a new minor version soon, I think we can push this further: throw an Regarding the recommendation of using
While the above is true, there seems to be another small problem in the code: the possible fields specified by |
|
@ppkarwasz Thank you for the feedback! I’ll work on updating the PR to incorporate these changes. |
…to sdId and type to msgId; validate SD-ID and MSGID inputs in StructuredDataMessage
|
Updated the PR to validate invalid SD-ID and MSGID inputs, renamed I did not implement enforcement of the allowed keys defined by |
|
Appreciate your patience! This is a really fantastic PR. Not only does it fix the documentation as requested in Issue #4051, but you also made a great catch by adding the fail-fast validation directly into the constructors to strictly enforce RFC 5424 compliance. Before we merge this, there are just a few small things we need to wrap up:
Thank you again for this excellent contribution. Please feel free to ping here if you have any questions or need help setting up the tests or changelog! Note: Avoid force push |
|
@ramanathan1504 Thank you for the feedback! I'll work on updating the PR to incorporate these changes. |
| validateSdId(sdId); | ||
| validateMsgId(msgId); | ||
|
|
||
| this.sdId = new StructuredDataId(sdId, null, null, maxLength); |
There was a problem hiding this comment.
Doesn't StructuredDataId::new need to have some validation too?
| */ | ||
| public StructuredDataMessage(final String id, final String msg, final String type, final int maxLength) { | ||
| this.id = new StructuredDataId(id, null, null, maxLength); | ||
| public StructuredDataMessage(final String sdId, final String msg, final String msgId, final int maxLength) { |
There was a problem hiding this comment.
Can we have one canonical constructor and make the rest of the constructors to delegate to that, please?
Fixes #4051
This pull request improves the Javadoc of StructuredDataMessage constructors by clarifying
the expected format and usage of the
id(SD-ID) andtype(MSGID) parameters.Specifically:
This change is documentation-only and does not modify runtime behavior.
This improvement is based on feedback from the YesWeHack bug bounty report (#YWH-PGM10209-37),
which identified a lack of clarity in the existing documentation.
Checklist
Base your changes on
2.xbranch if you are targeting Log4j 2; usemainotherwise2.x)./mvnw verifysucceeds (the build instructions)Non-trivial changes contain an entry file in the
src/changelog/.2.x.xdirectoryTests are provided