mirror of
https://github.com/containers/podman.git
synced 2025-11-29 17:48:05 +08:00
vendor: update containers/image
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
97
vendor/github.com/letsencrypt/boulder/core/objects.go
generated
vendored
97
vendor/github.com/letsencrypt/boulder/core/objects.go
generated
vendored
@@ -157,58 +157,44 @@ type ValidationRecord struct {
|
||||
UsedRSAKEX bool `json:"-"`
|
||||
}
|
||||
|
||||
func looksLikeKeyAuthorization(str string) error {
|
||||
parts := strings.Split(str, ".")
|
||||
if len(parts) != 2 {
|
||||
return fmt.Errorf("Invalid key authorization: does not look like a key authorization")
|
||||
} else if !LooksLikeAToken(parts[0]) {
|
||||
return fmt.Errorf("Invalid key authorization: malformed token")
|
||||
} else if !LooksLikeAToken(parts[1]) {
|
||||
// Thumbprints have the same syntax as tokens in boulder
|
||||
// Both are base64-encoded and 32 octets
|
||||
return fmt.Errorf("Invalid key authorization: malformed key thumbprint")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Challenge is an aggregate of all data needed for any challenges.
|
||||
//
|
||||
// Rather than define individual types for different types of
|
||||
// challenge, we just throw all the elements into one bucket,
|
||||
// together with the common metadata elements.
|
||||
type Challenge struct {
|
||||
// The type of challenge
|
||||
// Type is the type of challenge encoded in this object.
|
||||
Type AcmeChallenge `json:"type"`
|
||||
|
||||
// The status of this challenge
|
||||
Status AcmeStatus `json:"status,omitempty"`
|
||||
|
||||
// Contains the error that occurred during challenge validation, if any
|
||||
Error *probs.ProblemDetails `json:"error,omitempty"`
|
||||
|
||||
// A URI to which a response can be POSTed
|
||||
URI string `json:"uri,omitempty"`
|
||||
|
||||
// For the V2 API the "URI" field is deprecated in favour of URL.
|
||||
// URL is the URL to which a response can be posted. Required for all types.
|
||||
URL string `json:"url,omitempty"`
|
||||
|
||||
// Used by http-01, tls-sni-01, tls-alpn-01 and dns-01 challenges
|
||||
// Status is the status of this challenge. Required for all types.
|
||||
Status AcmeStatus `json:"status,omitempty"`
|
||||
|
||||
// Validated is the time at which the server validated the challenge. Required
|
||||
// if status is valid.
|
||||
Validated *time.Time `json:"validated,omitempty"`
|
||||
|
||||
// Error contains the error that occurred during challenge validation, if any.
|
||||
// If set, the Status must be "invalid".
|
||||
Error *probs.ProblemDetails `json:"error,omitempty"`
|
||||
|
||||
// Token is a random value that uniquely identifies the challenge. It is used
|
||||
// by all current challenges (http-01, tls-alpn-01, and dns-01).
|
||||
Token string `json:"token,omitempty"`
|
||||
|
||||
// The expected KeyAuthorization for validation of the challenge. Populated by
|
||||
// the RA prior to passing the challenge to the VA. For legacy reasons this
|
||||
// field is called "ProvidedKeyAuthorization" because it was initially set by
|
||||
// the content of the challenge update POST from the client. It is no longer
|
||||
// set that way and should be renamed to "KeyAuthorization".
|
||||
// TODO(@cpu): Rename `ProvidedKeyAuthorization` to `KeyAuthorization`.
|
||||
// ProvidedKeyAuthorization used to carry the expected key authorization from
|
||||
// the RA to the VA. However, since this field is never presented to the user
|
||||
// via the ACME API, it should not be on this type.
|
||||
//
|
||||
// Deprecated: use vapb.PerformValidationRequest.ExpectedKeyAuthorization instead.
|
||||
// TODO(#7514): Remove this.
|
||||
ProvidedKeyAuthorization string `json:"keyAuthorization,omitempty"`
|
||||
|
||||
// Contains information about URLs used or redirected to and IPs resolved and
|
||||
// used
|
||||
ValidationRecord []ValidationRecord `json:"validationRecord,omitempty"`
|
||||
// The time at which the server validated the challenge. Required by
|
||||
// RFC8555 if status is valid.
|
||||
Validated *time.Time `json:"validated,omitempty"`
|
||||
}
|
||||
|
||||
// ExpectedKeyAuthorization computes the expected KeyAuthorization value for
|
||||
@@ -273,43 +259,18 @@ func (ch Challenge) RecordsSane() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// CheckConsistencyForClientOffer checks the fields of a challenge object before it is
|
||||
// given to the client.
|
||||
func (ch Challenge) CheckConsistencyForClientOffer() error {
|
||||
err := ch.checkConsistency()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Before completion, the key authorization field should be empty
|
||||
if ch.ProvidedKeyAuthorization != "" {
|
||||
return fmt.Errorf("A response to this challenge was already submitted.")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// CheckConsistencyForValidation checks the fields of a challenge object before it is
|
||||
// given to the VA.
|
||||
func (ch Challenge) CheckConsistencyForValidation() error {
|
||||
err := ch.checkConsistency()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// If the challenge is completed, then there should be a key authorization
|
||||
return looksLikeKeyAuthorization(ch.ProvidedKeyAuthorization)
|
||||
}
|
||||
|
||||
// checkConsistency checks the sanity of a challenge object before issued to the client.
|
||||
func (ch Challenge) checkConsistency() error {
|
||||
// CheckPending ensures that a challenge object is pending and has a token.
|
||||
// This is used before offering the challenge to the client, and before actually
|
||||
// validating a challenge.
|
||||
func (ch Challenge) CheckPending() error {
|
||||
if ch.Status != StatusPending {
|
||||
return fmt.Errorf("The challenge is not pending.")
|
||||
return fmt.Errorf("challenge is not pending")
|
||||
}
|
||||
|
||||
// There always needs to be a token
|
||||
if !LooksLikeAToken(ch.Token) {
|
||||
return fmt.Errorf("The token is missing.")
|
||||
if !looksLikeAToken(ch.Token) {
|
||||
return fmt.Errorf("token is missing or malformed")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
4
vendor/github.com/letsencrypt/boulder/core/util.go
generated
vendored
4
vendor/github.com/letsencrypt/boulder/core/util.go
generated
vendored
@@ -76,9 +76,9 @@ func NewToken() string {
|
||||
|
||||
var tokenFormat = regexp.MustCompile(`^[\w-]{43}$`)
|
||||
|
||||
// LooksLikeAToken checks whether a string represents a 32-octet value in
|
||||
// looksLikeAToken checks whether a string represents a 32-octet value in
|
||||
// the URL-safe base64 alphabet.
|
||||
func LooksLikeAToken(token string) bool {
|
||||
func looksLikeAToken(token string) bool {
|
||||
return tokenFormat.MatchString(token)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user