Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func (ch Challenge) StringID() string {
type Authorization struct {
// An identifier for this authorization, unique across
// authorizations and certificates within this instance.
ID string `json:"-"`
ID int64 `json:"-"`

// The identifier for which authorization is being given
Identifier identifier.ACMEIdentifier `json:"identifier"`
Expand Down
139 changes: 74 additions & 65 deletions core/proto/core.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions core/proto/core.proto
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ message Registration {
}

message Authorization {
// Next unused field number: 12
// Next unused field number: 13
reserved 5, 7, 8;
string id = 1;
string id = 1; // TODO(#8722): reserve
int64 idInt = 12; // TODO(#8722): rename
int64 registrationID = 3;
// Fields specified by RFC 8555, Section 7.1.4
reserved 2; // Previously dnsName
Expand Down
18 changes: 16 additions & 2 deletions grpc/pb-marshalling.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package grpc
import (
"fmt"
"net/netip"
"strconv"
"time"

"github.com/go-jose/go-jose/v4"
Expand Down Expand Up @@ -291,7 +292,8 @@ func AuthzToPB(authz core.Authorization) (*corepb.Authorization, error) {
}

return &corepb.Authorization{
Id: authz.ID,
Id: fmt.Sprintf("%d", authz.ID),
IdInt: authz.ID,
Identifier: authz.Identifier.ToProto(),
RegistrationID: authz.RegistrationID,
Status: string(authz.Status),
Expand All @@ -315,8 +317,20 @@ func PBToAuthz(pb *corepb.Authorization) (core.Authorization, error) {
c := pb.Expires.AsTime()
expires = &c
}

// TODO(#8722): remove this series of checks when pb.Id is int64-only
var authzIDInt int64
if pb.IdInt != 0 {
authzIDInt = pb.IdInt
} else if pb.Id != "" {
parsed, err := strconv.ParseInt(pb.Id, 10, 64)
if err != nil {
return core.Authorization{}, ErrInvalidParameters
}
authzIDInt = parsed
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
}
} else {
return core.Authorization{}, ErrMissingParameters
}

@ezekiel ezekiel Jun 4, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This particular spot is very interesting - it did not historically have any protection against zero-values. When added, it causes other test failures. I'll re-add the error return here and see if there's something obvious to fix because I'd rather have the protection than not.

authz := core.Authorization{
ID: pb.Id,
ID: authzIDInt,
Identifier: identifier.FromProto(pb.Identifier),
RegistrationID: pb.RegistrationID,
Status: core.AcmeStatus(pb.Status),
Expand Down
4 changes: 2 additions & 2 deletions grpc/pb-marshalling_test.go

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This test file probably needs more updates than this: there should be tests for PBToAuthz with a string input, an int input, both, and neither.

Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func TestAuthz(t *testing.T) {
Token: "asd2",
}
inAuthz := core.Authorization{
ID: "1",
ID: 1,
Identifier: ident,
RegistrationID: 5,
Status: core.StatusPending,
Expand All @@ -230,7 +230,7 @@ func TestAuthz(t *testing.T) {
test.AssertDeepEquals(t, inAuthz, outAuthz)

inAuthzNilExpires := core.Authorization{
ID: "1",
ID: 1,
Identifier: ident,
RegistrationID: 5,
Status: core.StatusPending,
Expand Down
Loading