Skip to content

Commit

Permalink
[border-agent] return invalid args when lifetime exceeds 10min
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzhyang committed Oct 29, 2024
1 parent 8fe126f commit f6cd512
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dbus/server/dbus_thread_object_rcp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
#define OTBR_CONFIG_BORDER_AGENT_MESHCOP_E_UDP_PORT 0
#endif

#define OTBR_BORDER_AGENT_MAX_EPHEMERAL_KEY_TIMEOUT (10 * 60 * 1000u)

using std::placeholders::_1;
using std::placeholders::_2;

Expand Down Expand Up @@ -2036,6 +2038,7 @@ void DBusThreadObjectRcp::ActivateEphemeralKeyModeHandler(DBusRequest &aRequest)
VerifyOrExit(mBorderAgent.GetEphemeralKeyEnabled(), error = OT_ERROR_NOT_CAPABLE);

SuccessOrExit(DBusMessageToTuple(*aRequest.GetMessage(), args), error = OT_ERROR_INVALID_ARGS);
VerifyOrExit(lifetime <= OTBR_BORDER_AGENT_MAX_EPHEMERAL_KEY_TIMEOUT, error = OT_ERROR_INVALID_ARGS);

SuccessOrExit(mBorderAgent.CreateEphemeralKey(ePskc), error = OT_ERROR_INVALID_ARGS);
otbrLogInfo("Created Ephemeral Key: %s", ePskc.c_str());
Expand Down

0 comments on commit f6cd512

Please sign in to comment.