Skip to content

Addmoretests #3

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
5 changes: 4 additions & 1 deletion internal/scti/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ func deadlineTime(opts *HandlerOptions) time.Time {

// verifyAddChain is used by add-chain and add-pre-chain. It does the checks that the supplied
// cert is of the correct type and chains to a trusted root.
// TODO(phbnf): add tests
// TODO(phbnf): move to chain_validation.go
Comment on lines +396 to +397

Choose a reason for hiding this comment

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

medium

It's great that you've added TODOs for tests and moving this function. Consider adding a brief description of what these tests should cover, or what the motivation is for moving the function.

Comment on lines +396 to +397

Choose a reason for hiding this comment

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

medium

Consider adding tests for verifyAddChain to ensure it handles various scenarios correctly. Also, moving this function to chain_validation.go would improve code organization.

func verifyAddChain(log *log, req rfc6962.AddChainRequest, expectingPrecert bool) ([]*x509.Certificate, error) {
// We already checked that the chain is not empty so can move on to verification
validPath, err := validateChain(req.Chain, log.chainValidationOpts)
Expand Down Expand Up @@ -452,7 +454,8 @@ func marshalAndWriteAddChainResponse(sct *rfc6962.SignedCertificateTimestamp, w

// entryFromChain generates an Entry from a chain and timestamp.
// copied from certificate-transparency-go/serialization.go
// TODO(phboneff): move in a different file maybe?
// TODO(phboneff): move to ct.go
// TODO(phboneff): add tests
Comment on lines +457 to +458

Choose a reason for hiding this comment

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

medium

Consider adding a brief description of what these tests should cover, or what the motivation is for moving the function.

Comment on lines +457 to +458

Choose a reason for hiding this comment

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

medium

Moving entryFromChain to ct.go would align it with related functionality and improve modularity. Adding tests for this function is also recommended.

func entryFromChain(chain []*x509.Certificate, isPrecert bool, timestamp uint64) (*ctonly.Entry, error) {
leaf := ctonly.Entry{
IsPrecert: isPrecert,
Expand Down
Loading
Loading