Skip to content

Commit

Permalink
Re-wrap partial failure improvements, CE side (#24293)
Browse files Browse the repository at this point in the history
* Re-wrap partial failure improvements, CE side

* Resolve import cycle
  • Loading branch information
sgmiller authored Nov 29, 2023
1 parent ef3021f commit 31f399d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions vault/seal/seal_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ import (
wrapping "github.com/hashicorp/go-kms-wrapping/v2"
)

type PartialSealWrapError struct {
Err error
}

func (p *PartialSealWrapError) Error() string {
return p.Err.Error()
}

// SealWrapper contains a Wrapper and related information needed by the seal that uses it.
// Use NewSealWrapper to construct new instances, do not do it directly.
type SealWrapper struct {
Expand Down
2 changes: 1 addition & 1 deletion vault/seal_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type PartialWrapFailCallback func(context.Context, map[string]error) error
// Helper function to use for partial wrap fail callbacks where we don't want to allow a partial failure. See
// for example barrier or recovery key wrapping. Just don't allow for those risky scenarios
var DisallowPartialSealWrap = func(ctx context.Context, errs map[string]error) error {
return seal.JoinSealWrapErrors("not allowing operation to proceed without full wrapping involving all configured seals", errs)
return &seal.PartialSealWrapError{seal.JoinSealWrapErrors("not allowing operation to proceed without full wrapping involving all configured seals", errs)}
}

// SealWrapValue creates a SealWrappedValue wrapper with the entryValue being optionally encrypted with the give seal Access.
Expand Down

0 comments on commit 31f399d

Please sign in to comment.