← 输入框|github.com|刷新
Skip to content

Reject trailing data after signatures. - #83

Open
vcsjones wants to merge 1 commit into
remove-unsupported-ruby-from-cifrom
reject-sig-trailing-data
Open

vcsjones wants to merge 1 commit into
remove-unsupported-ruby-from-cifrom
reject-sig-trailing-data

Conversation

@vcsjones

Copy link
Copy Markdown
Member

Our signature decoder does not validate that the bytes read is the same as the total number of bytes. This permitted trailing data after signatures.

This isn't really a security issue because you still need a correct signature to validate. This is more of a correctness issue because it permits additional data in the signature that is more or less ignored.

@vcsjones
vcsjones requested review from a team as code owners October 27, 2026 17:25
Copilot AI max review requested due to automatic review settings October 27, 2026 17:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The checks consistently enforce full signature consumption, with focused regression specs covering all affected algorithms and certificate parsing.

No open issues 🎉

What changed in this PR

Tightens SSH signature verification to reject trailing bytes that were previously ignored, improving decoding correctness.

Changes:

  • Validate full signature consumption for RSA, DSA, ECDSA, and Ed25519.
  • Add regression specs for trailing data in direct verification and certificate signatures.
File Description
spec/​public_key/​rsa_spec.rb Tests rejection of trailing RSA signature data.
spec/​public_key/​ed25519_spec.rb Tests rejection of trailing Ed25519 signature data.
spec/​public_key/​ecdsa_spec.rb Tests rejection of trailing ECDSA signature data.
spec/​public_key/​dsa_spec.rb Tests rejection of trailing DSA signature data.
spec/​certificate_spec.rb Tests malformed certificate signatures across all four key types.
lib/​ssh_data/​public_key/​rsa.rb Checks that RSA signature decoding consumes all bytes.
lib/​ssh_data/​public_key/​ed25519.rb Checks that Ed25519 signature decoding consumes all bytes.
lib/​ssh_data/​public_key/​ecdsa.rb Checks that ECDSA signature decoding consumes all bytes.
lib/​ssh_data/​public_key/​dsa.rb Checks that DSA signature decoding consumes all bytes.

Review effort: Max

Our signature decoder does not validate that the bytes read is the same as the total number of bytes. This permitted trailing data after signatures.
@vcsjones
vcsjones force-pushed the reject-sig-trailing-data branch from 044f565 to 5681054 Compare October 27, 2026 17:37
@vcsjones
vcsjones changed the base branch from main to remove-unsupported-ruby-from-ci October 27, 2026 17:37
@vcsjones
vcsjones added this pull request to stack #85 October 27, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants