Skip to content

Commit 5ddd5ac

Browse files
Print key hash as hex in admin tool. (#8266)
The ProtoText printing of this structure prints the binary string as escaped utf8 text, which is essentially gibberish for my processes. --------- Co-authored-by: Aaron Gable <[email protected]>
1 parent cd02cae commit 5ddd5ac

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

cmd/admin/dryrun.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ type dryRunSAC struct {
3232
}
3333

3434
func (d dryRunSAC) AddBlockedKey(_ context.Context, req *sapb.AddBlockedKeyRequest, _ ...grpc.CallOption) (*emptypb.Empty, error) {
35-
b, err := prototext.Marshal(req)
36-
if err != nil {
37-
return nil, err
38-
}
39-
d.log.Infof("dry-run: %#v", string(b))
35+
d.log.Infof("dry-run: Block SPKI hash %x by %s %s", req.KeyHash, req.Comment, req.Source)
4036
return &emptypb.Empty{}, nil
4137
}

cmd/admin/key_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,6 @@ func TestBlockSPKIHash(t *testing.T) {
178178
err = a.blockSPKIHash(context.Background(), keyHash[:], u, "")
179179
test.AssertNotError(t, err, "")
180180
test.AssertEquals(t, len(log.GetAllMatching("Found 0 unexpired certificates")), 1)
181-
test.AssertEquals(t, len(log.GetAllMatching("dry-run:")), 1)
181+
test.AssertEquals(t, len(log.GetAllMatching("dry-run: Block SPKI hash "+hex.EncodeToString(keyHash[:]))), 1)
182182
test.AssertEquals(t, len(msa.blockRequests), 0)
183183
}

0 commit comments

Comments
 (0)