feat(assessment): watermark the task text of real attempts
This commit is contained in:
1 parent
24b64d698a
commit
c975a0d506
57 files changed
+2429
-92
No files matched your search
@@ -125,6 +125,33 @@ func TestAssessmentSessionAndNetworkDigestsAreBoundToTheAttempt(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAssessmentWatermarkSeedIsKeyedBoundToTheAttemptAndSeparateFromTheDigests(t *testing.T) {
|
||||
keyring, err := NewKeyring(bytes.Repeat([]byte{1}, MinKeySecretBytes))
|
||||
if err != nil {
|
||||
t.Fatalf("NewKeyring() error = %v", err)
|
||||
}
|
||||
other, err := NewKeyring(bytes.Repeat([]byte{2}, MinKeySecretBytes))
|
||||
if err != nil {
|
||||
t.Fatalf("NewKeyring(other secret) error = %v", err)
|
||||
}
|
||||
attempt, otherAttempt := uuid.New(), uuid.New()
|
||||
seed := keyring.AssessmentWatermarkSeed(attempt)
|
||||
if seed.IsZero() || seed != keyring.AssessmentWatermarkSeed(attempt) {
|
||||
t.Fatal("the watermark seed is empty or not deterministic")
|
||||
}
|
||||
if seed == keyring.AssessmentWatermarkSeed(otherAttempt) {
|
||||
t.Fatal("two attempts have the same watermark seed")
|
||||
}
|
||||
if seed == other.AssessmentWatermarkSeed(attempt) {
|
||||
t.Fatal("the watermark seed does not depend on the server secret, so it could be computed by anyone")
|
||||
}
|
||||
// The purpose key is its own: no other digest of the attempt equals the seed.
|
||||
if seed == domain.AssessmentWatermarkSeed(keyring.AssessmentSessionDigest(attempt, attempt)) ||
|
||||
seed == domain.AssessmentWatermarkSeed(keyring.AssessmentNetworkDigest(attempt, string(attempt[:]))) {
|
||||
t.Fatal("the watermark seed shares a key with another assessment digest")
|
||||
}
|
||||
}
|
||||
|
||||
func TestResultHistoryCursorKeyIsSeparateFromIdempotencyAndBoundToTheCandidate(t *testing.T) {
|
||||
keyring, err := NewKeyring([]byte(strings.Repeat("k", MinKeySecretBytes)))
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user