mesh/repo-check head c61212eba77c merged into trunk c6e669f71e8e — pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (typescript)…
mesh/merge-gate head c61212eba77c merged into trunk c6e669f71e8e — pass: group feat/r4d composed: every machine composes with the change as it did without …
mesh/delivery delivered
mesh/delivery-group group feat/r4d delivered: every member is delivered
mesh/check failed: unit: ..test: node:internal/modules/esm/resolve:241 | c61212eba77c on 5652312f09d2 | unit 1629 run, 0 kept, 3 skipped | integration…
24 lines
746 B
Go
24 lines
746 B
Go
package process
|
|
|
|
import (
|
|
"crypto/sha256"
|
|
"encoding/hex"
|
|
"testing"
|
|
)
|
|
|
|
// The pin accepts exactly the leaf certificate with the named SHA-256, and no other (novox/hq issue 1633).
|
|
func TestThePinAcceptsOnlyTheNamedCertificate(t *testing.T) {
|
|
leaf := []byte("a certificate")
|
|
sum := sha256.Sum256(leaf)
|
|
cfg := PinnedToFingerprint("sha256:" + hex.EncodeToString(sum[:]))
|
|
if err := cfg.VerifyPeerCertificate([][]byte{leaf}, nil); err != nil {
|
|
t.Errorf("the pinned certificate was refused: %v", err)
|
|
}
|
|
if err := cfg.VerifyPeerCertificate([][]byte{[]byte("another")}, nil); err == nil {
|
|
t.Error("another certificate was accepted")
|
|
}
|
|
if err := cfg.VerifyPeerCertificate(nil, nil); err == nil {
|
|
t.Error("no certificate was accepted")
|
|
}
|
|
}
|