Skip to content

S7CommPlus V1 integration test silently skips SessionKey authentication #829

Description

@gijzelaerr

Problem

The SessionKey-enabled server emulator encodes the public-key fingerprint WString as UTF-16-BE, while the S7CommPlus WString codec and real protocol use UTF-8. The client therefore fails to parse the fingerprint, _try_session_key_auth() returns None, and the tests in TestSessionKeyIntegration complete the ordinary session setup path instead of exercising SessionKey authentication.

The test currently passes while its “full SessionKey handshake” claim is false.

Scope

  • Encode the emulator fingerprint through the normal S7CommPlus WString codec.
  • Make the integration test assert that SessionKey authentication was actually selected and activated.
  • Make the emulator inspect the submitted SecurityKey structure sufficiently to reject a missing or malformed handshake.
  • Add a regression test proving that an incorrectly encoded or unknown fingerprint cannot satisfy the authenticated test.

Full V3 server framing remains tracked by #803. Generated crypto maintainability remains tracked by #828.

Acceptance criteria

  • The parsed CreateObject attributes contain the configured fingerprint.
  • The authenticated integration test fails if _try_session_key_auth() is bypassed.
  • The test asserts a non-null active session key after accepted setup.
  • A malformed SecurityKey request is rejected rather than treated as successful.
  • Existing non-SessionKey server mode continues to work.

Out of scope

  • Session-key renewal
  • Partial-fingerprint fallback
  • General V3 emulator implementation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions