feat(assessment): find the attempt behind a leaked task text

This commit is contained in:
shira committed 2026-10-11 13:19:38 +03:00
1 parent bb917bf62e
commit 5a731c25b7
26 files changed
+2500

No files matched your search

+18
View File
@@ -86,6 +86,24 @@ func (config *Config) loadIdentity(lookup LookupEnv) error {
return err
}
// IdentityKeySecretFromEnv reads IDENTITY_KEY_SECRET for an operator command
// that recomputes keyed values of the server, such as the codes of the leak
// trace. It never draws an ephemeral secret: a random one would make every
// value unreadable, and a command that silently searched with it would report
// nothing found. The error never contains the secret.
func IdentityKeySecretFromEnv(lookup LookupEnv) ([]byte, error) {
secret := strings.TrimSpace(valueOrDefault(lookup, "IDENTITY_KEY_SECRET", ""))
switch {
case secret == "":
return nil, errors.New("config.IdentityKeySecretFromEnv - IDENTITY_KEY_SECRET is not set")
case strings.HasPrefix(secret, examplePlaceholderPrefix):
return nil, errors.New("config.IdentityKeySecretFromEnv - IDENTITY_KEY_SECRET is an example placeholder")
case len(secret) < MinIdentityKeySecretBytes:
return nil, fmt.Errorf("config.IdentityKeySecretFromEnv - IDENTITY_KEY_SECRET must have at least %d bytes", MinIdentityKeySecretBytes)
}
return []byte(secret), nil
}
// ValidateIdentity checks the registration settings. Errors never include
// the secret.
func (config Config) ValidateIdentity() error {