Downlink replay protection rework - #335
Open
trond-snekvik wants to merge 2 commits into
Open
Conversation
As reported in #314, the downlink replay protection can be disarmed by pushing an invalid downlink session, as the SESSION_VALID flag gets cleared at the start of each session, which disables the `is_valid_downlink` check. The fix #314 only addresses the invalid sequence number decrement. This bug also disables replay protection for sessions that follow a session with only corrupted pouches, though which has to be addressed separately. We also reinitialize the session for every received pouch, which resets the session pouch ID, preventing the pouch ID replay check from working correctly. This patch addresses the core issue that causes the bug addressed in #314, and is intended to supersede #314. It additionally adds a check for the block size log parameter, and adds a `server.has_seqnum` flag that replaces the validation check for `server.seqnum` the `SESSION_VALID` flag previously covered. Note: As replay protection is not implemented on the server side, the session replay protection defect does not affect any active deployments, but all the while this code exists in this repo, it needs to be correct. Signed-off-by: Trond Snekvik <trond.snekvik@canonical.com>
Adds a downlink_session test that runs through the rules in the downlink session creation and validation. Signed-off-by: Trond Snekvik <trond.snekvik@canonical.com>
trond-snekvik
force-pushed
the
replay_check
branch
from
September 4, 2026 13:06
0f2157a to
7a41e7e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As reported in #314, the downlink replay protection can be disarmed by
pushing an invalid downlink session, as the SESSION_VALID flag gets cleared
at the start of each session, which disables the
is_valid_downlinkcheck.The fix #314 only addresses the invalid sequence number decrement. This bug
also disables replay protection for sessions that follow a session with
only corrupted pouches, though which has to be addressed separately. We
also reinitialize the session for every received pouch, which resets the
session pouch ID, preventing the pouch ID replay check from working
correctly.
This patch addresses the core issue that causes the bug addressed in #314,
and is intended to supersede #314. It additionally adds a check for the
block size log parameter, and adds a
server.has_seqnumflag that replacesthe validation check for
server.seqnumtheSESSION_VALIDflagpreviously covered.
Note
As replay protection is not implemented on the server side, the
session replay protection defect does not affect any active deployments,
but all the while this code exists in this repo, it needs to be correct.
Adds a quick test that verifies the ruleset.