test: add MITM attack resilience test and refactor security secrets (CNF-19576)#151
Draft
gtannous-spec wants to merge 1 commit intok8snetworkplumbingwg:mainfrom
Draft
test: add MITM attack resilience test and refactor security secrets (CNF-19576)#151gtannous-spec wants to merge 1 commit intok8snetworkplumbingwg:mainfrom
gtannous-spec wants to merge 1 commit intok8snetworkplumbingwg:mainfrom
Conversation
edcdavid
reviewed
Jan 7, 2026
Collaborator
edcdavid
left a comment
There was a problem hiding this comment.
This does not look like a man-in-the-middle scenario, more like a misconfigured/rogue endpoint. The man in the middle imo should test:
- modifying all frames sent by the grandmaster for instance and make sure sync fails, or look for bad packet log after injecting 1 bad frame ->somewhat equivalent to proposed test but not exactly.
- save and replay a valid frame later and monitor the log for 1 bad frame -> not covered
gtannous-spec
commented
Jan 10, 2026
Collaborator
Author
gtannous-spec
left a comment
There was a problem hiding this comment.
Thanks for the comment David, I actually missed the second point in the test.
I will fix it, and then push another commit :)
- Add test case verifying PTP rejects packets with mismatched ICV when attacker uses same Key ID but different secret value - Extract CreateMITMAttackerSecret and CreateMismatchSecret helpers to testconfig.go for reusability - Add sa_file path constants to consts.go - Refactor existing security tests to use new helpers and constants
5369d7e to
678cd18
Compare
edcdavid
pushed a commit
to edcdavid/ptp-operator-upstream
that referenced
this pull request
Feb 17, 2026
CNF-21360: Add Dell XR8720t settings
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.
Summary
Add a functional test for MITM (Man-in-the-Middle) attack resilience when TLV Authentication is enabled, and refactor security-related test infrastructure for better maintainability. CNF-19576
Files Changed
test/conformance/serial/ptp.gotest/pkg/testconfig/testconfig.goCreateMITMAttackerSecret,CreateMismatchSecret) and secret name constantstest/pkg/consts.gosa_filepath constants for PTP security configurationTest Added
"PTP rejects MITM attack with same Key ID but different secret"
This test validates that PTP authentication correctly rejects tampered packets:
Refactoring: Magic Values → Constants
Moved inline secret definitions and hardcoded
sa_filepaths to shared locations:testconfig.MITMAttackerSecretName,testconfig.MismatchSecretNametestconfig.CreateMITMAttackerSecret(),testconfig.CreateMismatchSecret()pkg.SaFileSecurityConf,pkg.SaFileMismatchConf,pkg.SaFileMITMAttackerConfThis improves readability, reduces duplication, and makes future security tests easier to implement.