Skip to content

sec: fix nil Data panic in ValidateAtSignatureTime - #218

Open
Harsh23Kashyap wants to merge 1 commit into
named-data:mainfrom
Harsh23Kashyap:fix/validate-sig-time-nil-data
Open

Harsh23Kashyap wants to merge 1 commit into
named-data:mainfrom
Harsh23Kashyap:fix/validate-sig-time-nil-data

Conversation

@Harsh23Kashyap

Copy link
Copy Markdown

Fixes #217

What

  • Restore the nil-Data deferral in ValidateAtSignatureTime (removed by d266606): when the certificate itself is being validated, accept and let the check run when the certificate validates another packet.
  • Guard ValidateSigTime against a nil Data (returns false).
  • Regression tests for both paths.

Evidence

Before (on main):

--- FAIL: TestValidateAtSignatureTimeNilData (0.00s)   -> panic: nil pointer dereference
--- FAIL: TestValidateSigTimeNilData (0.00s)           -> panic: nil pointer dereference

After (this branch):

--- PASS: TestValidateAtSignatureTimeNilData (0.00s)
--- PASS: TestValidateSigTimeNilData (0.00s)
ok  	github.com/named-data/ndnd/std/security

Full go test ./... green, including the trust_config tests added in d266606.

d266606 removed the nil Data branch from ValidateAtSignatureTime, so a
nil Data now reaches ValidateSigTime which dereferences it
(data.Signature()) and crashes the process with a nil pointer panic.

A nil Data is the documented case where the certificate itself is being
validated and the signature-time check is deferred until the certificate
is used to validate another packet. Restore the deferral, and guard
ValidateSigTime itself against nil Data.
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.

sec: ValidateAtSignatureTime panics on nil Data (regression from d2666063)

1 participant