(path string, value []byte)
| 503 | } |
| 504 | |
| 505 | func rejectTaskSecretJSON(path string, value []byte) error { |
| 506 | if len(value) == 0 { |
| 507 | return nil |
| 508 | } |
| 509 | decoded, ok := decodeTaskSecretJSON(value) |
| 510 | if !ok { |
| 511 | if redactTaskSecretText(string(value)) != string(value) { |
| 512 | return fmt.Errorf("%w: %s must not embed raw secret material", ErrValidation, path) |
| 513 | } |
| 514 | return nil |
| 515 | } |
| 516 | if taskSecretValueContainsSecret(decoded) { |
| 517 | return fmt.Errorf("%w: %s must not embed raw secret material", ErrValidation, path) |
| 518 | } |
| 519 | return nil |
| 520 | } |
| 521 | |
| 522 | func redactTaskSecretText(value string) string { |
| 523 | return diagnostics.Redact(RedactClaimTokens(value)) |
no test coverage detected