Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed validations from serial number #933

Open
wants to merge 3 commits into
base: v3
Choose a base branch
from
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 api/grpc/mpi/v1/command.pb.go

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

2 changes: 1 addition & 1 deletion api/grpc/mpi/v1/common.pb.go

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

133 changes: 66 additions & 67 deletions api/grpc/mpi/v1/files.pb.go

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

3 changes: 1 addition & 2 deletions api/grpc/mpi/v1/files.proto
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,7 @@ message X509Name {
repeated string postal_code = 7 [(buf.validate.field).repeated.items.string.min_len = 1];

// Serial Number (SN): Unique identifier or serial number.
// Must be non-empty.
string serial_number = 8 [(buf.validate.field).string.min_len = 1];
string serial_number = 8 [(buf.validate.field).bytes.min_len = 0, (buf.validate.field).bytes.max_len = 21];

// Common Name (CN): Typically the person’s or entity's full name.
string common_name = 9 [(buf.validate.field).string.min_len = 1];
Expand Down
2 changes: 1 addition & 1 deletion docs/proto/protos.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ Represents the dates for which a certificate is valid as seen at https://pkg.go.
| province | [string](#string) | repeated | State or Province name (ST): Name of the state or province. |
| street_address | [string](#string) | repeated | Street Address (STREET): Physical street address. |
| postal_code | [string](#string) | repeated | Postal Code (PC): Postal or ZIP code for the address. |
| serial_number | [string](#string) | | Serial Number (SN): Unique identifier or serial number. Must be non-empty. |
| serial_number | [string](#string) | | Serial Number (SN): Unique identifier or serial number. |
| common_name | [string](#string) | | Common Name (CN): Typically the person’s or entity's full name. |
| names | [AttributeTypeAndValue](#mpi-v1-AttributeTypeAndValue) | repeated | Parsed attributes including any non-standard attributes, as specified in RFC 2253. These attributes are parsed but not marshaled by this package. |
| extra_names | [AttributeTypeAndValue](#mpi-v1-AttributeTypeAndValue) | repeated | Additional attributes to be included in the marshaled distinguished names. These override any attributes with the same OID in `names`. |
Expand Down
2 changes: 1 addition & 1 deletion pkg/files/file_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func FileMetaWithCertificate(filePath string) (*mpi.FileMeta, error) {
// Populate certificate-specific metadata
fileMeta.FileType = &mpi.FileMeta_CertificateMeta{
CertificateMeta: &mpi.CertificateMeta{
SerialNumber: []byte{},
SerialNumber: loadedCert.SerialNumber.Bytes(),
Issuer: &mpi.X509Name{
Country: loadedCert.Issuer.Country,
Organization: loadedCert.Issuer.Organization,
Expand Down
2 changes: 1 addition & 1 deletion test/protos/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func CertMeta(fileName, fileHash string) *mpi.FileMeta {
Permissions: "0600",
FileType: &mpi.FileMeta_CertificateMeta{
CertificateMeta: &mpi.CertificateMeta{
SerialNumber: []byte("12345-67890"),
Issuer: &mpi.X509Name{
Country: []string{"IE"},
Organization: []string{"F5"},
Expand All @@ -39,7 +40,6 @@ func CertMeta(fileName, fileHash string) *mpi.FileMeta {
Province: []string{"Munster"},
StreetAddress: []string{"90 South Mall"},
PostalCode: []string{"T12 KXV9"},
SerialNumber: "12345-67890",
CommonName: "Example Name",
Names: []*mpi.AttributeTypeAndValue{
{Type: "email", Value: "noreply@nginx.com"},
Expand Down
Loading