-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Better error messages when HMAC authentication is attempted by federates when RTI does not support it #461
Conversation
WalkthroughThe recent updates to the RTI system's federated components enhance authentication handling by introducing a specific error message when an RTI nonce is not executed with HMAC authentication. This comprehensive modification affects the message rejection process with refined error handling and logging, ensuring clearer communication and stricter security protocols. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant RTI Remote
participant Authentication Module
Client->>RTI Remote: Send MSG_TYPE_FED_NONCE
RTI Remote->>Authentication Module: Authenticate Message
Authentication Module-->>RTI Remote: Authentication Failed
RTI Remote->>Client: Send MSG_TYPE_REJECT with RTI_NOT_EXECUTED_WITH_AUTH
RTI Remote->>Log System: Log error "RTI not executed with HMAC authentication"
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- core/federated/RTI/rti_remote.c (1 hunks)
- core/federated/federate.c (1 hunks)
- include/core/federated/network/net_common.h (1 hunks)
Files skipped from review due to trivial changes (1)
- include/core/federated/network/net_common.h
Additional comments not posted (3)
core/federated/RTI/rti_remote.c (2)
1203-1203
: LGTM!The log message provides useful information for debugging and aligns with the PR objectives.
1201-1203
: LGTM! But verify the usage ofRTI_NOT_EXECUTED_WITH_AUTH
.The new case for handling
MSG_TYPE_FED_NONCE
correctly sends a rejection withRTI_NOT_EXECUTED_WITH_AUTH
and logs an error message.However, ensure that
RTI_NOT_EXECUTED_WITH_AUTH
is used consistently across the codebase.Verification successful
Verified: Consistent usage of
RTI_NOT_EXECUTED_WITH_AUTH
The constant
RTI_NOT_EXECUTED_WITH_AUTH
is consistently used across the codebase, defined innet_common.h
and utilized infederate.c
andrti_remote.c
.
net_common.h
: Definition ofRTI_NOT_EXECUTED_WITH_AUTH
federate.c
: Usage in handlingMSG_TYPE_REJECT
rti_remote.c
: Usage in handlingMSG_TYPE_FED_NONCE
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `RTI_NOT_EXECUTED_WITH_AUTH` in the codebase. # Test: Search for the usage of the constant. Expect: Consistent usage across the codebase. rg --type c --type h 'RTI_NOT_EXECUTED_WITH_AUTH'Length of output: 340
core/federated/federate.c (1)
865-867
: Improve error message for missing HMAC authentication.The error message "RTI is not executed with HMAC option." can be made more user-friendly and informative.
- lf_print_error("RTI is not executed with HMAC option."); + lf_print_error("RTI is not executed with the HMAC authentication option. Please start the RTI with the -a or --auth option.");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This gives better error messages in lf-lang/lingua-franca#2326.
When the federates are using the HMAC authentication as
auth:true
, and the RTI is not executed using the-a
or--auth
option, the RTI will not expect theMSG_TYPE_FED_NONCE
type, and reject it.For better errors, add a rejection code
RTI_NOT_EXECUTED_WITH_AUTH
and messages.