mirror of
https://github.com/cheat/cheat.git
synced 2026-03-07 11:13:33 +01:00
chore: modernize CI and update Go toolchain
- Bump Go from 1.19 to 1.26 and update all dependencies - Rewrite CI workflow with matrix strategy (Linux, macOS, Windows) - Update GitHub Actions to current versions (checkout@v4, setup-go@v5) - Update CodeQL actions from v1 to v3 - Fix cross-platform bug in mock/path.go (path.Join -> filepath.Join) - Clean up dependabot config (weekly schedule, remove stale ignore) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
100
vendor/github.com/ProtonMail/go-crypto/openpgp/errors/errors.go
generated
vendored
100
vendor/github.com/ProtonMail/go-crypto/openpgp/errors/errors.go
generated
vendored
@@ -6,9 +6,22 @@
|
||||
package errors // import "github.com/ProtonMail/go-crypto/openpgp/errors"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrDecryptSessionKeyParsing is a generic error message for parsing errors in decrypted data
|
||||
// to reduce the risk of oracle attacks.
|
||||
ErrDecryptSessionKeyParsing = DecryptWithSessionKeyError("parsing error")
|
||||
// ErrAEADTagVerification is returned if one of the tag verifications in SEIPDv2 fails
|
||||
ErrAEADTagVerification error = DecryptWithSessionKeyError("AEAD tag verification failed")
|
||||
// ErrMDCHashMismatch
|
||||
ErrMDCHashMismatch error = SignatureError("MDC hash mismatch")
|
||||
// ErrMDCMissing
|
||||
ErrMDCMissing error = SignatureError("MDC packet not found")
|
||||
)
|
||||
|
||||
// A StructuralError is returned when OpenPGP data is found to be syntactically
|
||||
// invalid.
|
||||
type StructuralError string
|
||||
@@ -17,6 +30,34 @@ func (s StructuralError) Error() string {
|
||||
return "openpgp: invalid data: " + string(s)
|
||||
}
|
||||
|
||||
// A DecryptWithSessionKeyError is returned when a failure occurs when reading from symmetrically decrypted data or
|
||||
// an authentication tag verification fails.
|
||||
// Such an error indicates that the supplied session key is likely wrong or the data got corrupted.
|
||||
type DecryptWithSessionKeyError string
|
||||
|
||||
func (s DecryptWithSessionKeyError) Error() string {
|
||||
return "openpgp: decryption with session key failed: " + string(s)
|
||||
}
|
||||
|
||||
// HandleSensitiveParsingError handles parsing errors when reading data from potentially decrypted data.
|
||||
// The function makes parsing errors generic to reduce the risk of oracle attacks in SEIPDv1.
|
||||
func HandleSensitiveParsingError(err error, decrypted bool) error {
|
||||
if !decrypted {
|
||||
// Data was not encrypted so we return the inner error.
|
||||
return err
|
||||
}
|
||||
// The data is read from a stream that decrypts using a session key;
|
||||
// therefore, we need to handle parsing errors appropriately.
|
||||
// This is essential to mitigate the risk of oracle attacks.
|
||||
if decError, ok := err.(*DecryptWithSessionKeyError); ok {
|
||||
return decError
|
||||
}
|
||||
if decError, ok := err.(DecryptWithSessionKeyError); ok {
|
||||
return decError
|
||||
}
|
||||
return ErrDecryptSessionKeyParsing
|
||||
}
|
||||
|
||||
// UnsupportedError indicates that, although the OpenPGP data is valid, it
|
||||
// makes use of currently unimplemented features.
|
||||
type UnsupportedError string
|
||||
@@ -41,9 +82,6 @@ func (b SignatureError) Error() string {
|
||||
return "openpgp: invalid signature: " + string(b)
|
||||
}
|
||||
|
||||
var ErrMDCHashMismatch error = SignatureError("MDC hash mismatch")
|
||||
var ErrMDCMissing error = SignatureError("MDC packet not found")
|
||||
|
||||
type signatureExpiredError int
|
||||
|
||||
func (se signatureExpiredError) Error() string {
|
||||
@@ -58,6 +96,14 @@ func (ke keyExpiredError) Error() string {
|
||||
return "openpgp: key expired"
|
||||
}
|
||||
|
||||
var ErrSignatureOlderThanKey error = signatureOlderThanKeyError(0)
|
||||
|
||||
type signatureOlderThanKeyError int
|
||||
|
||||
func (ske signatureOlderThanKeyError) Error() string {
|
||||
return "openpgp: signature is older than the key"
|
||||
}
|
||||
|
||||
var ErrKeyExpired error = keyExpiredError(0)
|
||||
|
||||
type keyIncorrectError int
|
||||
@@ -92,12 +138,24 @@ func (keyRevokedError) Error() string {
|
||||
|
||||
var ErrKeyRevoked error = keyRevokedError(0)
|
||||
|
||||
type WeakAlgorithmError string
|
||||
|
||||
func (e WeakAlgorithmError) Error() string {
|
||||
return "openpgp: weak algorithms are rejected: " + string(e)
|
||||
}
|
||||
|
||||
type UnknownPacketTypeError uint8
|
||||
|
||||
func (upte UnknownPacketTypeError) Error() string {
|
||||
return "openpgp: unknown packet type: " + strconv.Itoa(int(upte))
|
||||
}
|
||||
|
||||
type CriticalUnknownPacketTypeError uint8
|
||||
|
||||
func (upte CriticalUnknownPacketTypeError) Error() string {
|
||||
return "openpgp: unknown critical packet type: " + strconv.Itoa(int(upte))
|
||||
}
|
||||
|
||||
// AEADError indicates that there is a problem when initializing or using a
|
||||
// AEAD instance, configuration struct, nonces or index values.
|
||||
type AEADError string
|
||||
@@ -114,3 +172,39 @@ type ErrDummyPrivateKey string
|
||||
func (dke ErrDummyPrivateKey) Error() string {
|
||||
return "openpgp: s2k GNU dummy key: " + string(dke)
|
||||
}
|
||||
|
||||
// ErrMalformedMessage results when the packet sequence is incorrect
|
||||
type ErrMalformedMessage string
|
||||
|
||||
func (dke ErrMalformedMessage) Error() string {
|
||||
return "openpgp: malformed message " + string(dke)
|
||||
}
|
||||
|
||||
type messageTooLargeError int
|
||||
|
||||
func (e messageTooLargeError) Error() string {
|
||||
return "openpgp: decompressed message size exceeds provided limit"
|
||||
}
|
||||
|
||||
// ErrMessageTooLarge is returned if the read data from
|
||||
// a compressed packet exceeds the provided limit.
|
||||
var ErrMessageTooLarge error = messageTooLargeError(0)
|
||||
|
||||
// ErrEncryptionKeySelection is returned if encryption key selection fails (v2 API).
|
||||
type ErrEncryptionKeySelection struct {
|
||||
PrimaryKeyId string
|
||||
PrimaryKeyErr error
|
||||
EncSelectionKeyId *string
|
||||
EncSelectionErr error
|
||||
}
|
||||
|
||||
func (eks ErrEncryptionKeySelection) Error() string {
|
||||
prefix := fmt.Sprintf("openpgp: key selection for primary key %s:", eks.PrimaryKeyId)
|
||||
if eks.PrimaryKeyErr != nil {
|
||||
return fmt.Sprintf("%s invalid primary key: %s", prefix, eks.PrimaryKeyErr)
|
||||
}
|
||||
if eks.EncSelectionKeyId != nil {
|
||||
return fmt.Sprintf("%s invalid encryption key %s: %s", prefix, *eks.EncSelectionKeyId, eks.EncSelectionErr)
|
||||
}
|
||||
return fmt.Sprintf("%s no encryption key: %s", prefix, eks.EncSelectionErr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user