diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/atomic-rubric - Copy.yaml:Zone.Identifier b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/atomic-rubric - Copy.yaml:Zone.Identifier deleted file mode 100644 index d6c1ec68..00000000 Binary files a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/atomic-rubric - Copy.yaml:Zone.Identifier and /dev/null differ diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/atomic-rubric.yaml b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/atomic-rubric.yaml index a15c0e0c..e2be0606 100755 --- a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/atomic-rubric.yaml +++ b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/atomic-rubric.yaml @@ -7,67 +7,62 @@ criteria: - Broader Correctness / the craft of software engineering guideline: The response should update database query call sites in background worker service files (voice cloning and speech synthesis services) to include **userId** - or **job.userId** / **job._doc.userId** in query condition parameters. + or **job.userId** / **job._doc.userId** in query condition arguments. elaboration: Verifies that active database queries in voice cloning and speech synthesis - background workers enforce multi-tenant isolation by passing **userId** or **job.userId** - / **job._doc.userId** in query conditions. + workers enforce multi-tenant isolation by passing user identity criteria in query + conditions. - id: rejects-unauthorized-jobs-without-mutation category: primary_intent severity: possible_dealbreaker dimensions: - Broader Correctness / the craft of software engineering - guideline: The response should halt worker execution cleanly when job context lacks - a valid **job.userId** or **job._doc.userId** or authorization fails, without - updating database records. - elaboration: Ensures that when a background job is rejected due to missing or mismatched - tenant context, the worker terminates execution without attempting database updates - or mutations on the unauthorized record. + guideline: The response should halt worker execution cleanly when authorization + fails, without updating database records. + elaboration: Ensures that when a background job fails tenant context validation, + the worker terminates execution without mutating unauthorized records. - id: preserves-dependent-query-order category: primary_intent severity: certain_dealbreaker dimensions: - Broader Correctness / the craft of software engineering guideline: The response should maintain proper step-by-step query order when parent - records are needed before child lookups. It may read **recordingId** directly - from the job payload or resolve it from the authorized parent record. - elaboration: Ensures dependent lookups execute in logical sequence, allowing parent - context resolution prior to child record queries. + records are required before child lookups. + elaboration: Ensures dependent lookups execute in logical sequence so parent context + is resolved prior to child query execution. - id: preserves-sqs-message-recovery category: primary_intent severity: possible_dealbreaker dimensions: - Broader Correctness / the craft of software engineering - guideline: The response should process queue messages without unhandled runtime - exceptions or worker crashes. - elaboration: Evaluates queue message handling to ensure background workers process - jobs cleanly without crashing or leaving queue execution broken. + guideline: The response should ensure queue messages are handled without introducing + queue processing crashes or message handling runtime errors. + elaboration: Evaluates queue message lifecycle handling to ensure worker background + tasks process queue items reliably without crashing. - id: ensures-clean-worker-execution category: primary_intent severity: possible_dealbreaker dimensions: - Narrow Correctness - guideline: The response should execute background workers cleanly without general - syntax errors or unhandled runtime exceptions. - elaboration: Ensures worker processing does not crash due to unhandled runtime + guideline: The response should execute background workers cleanly without syntax + errors, unhandled runtime exceptions, or crash-inducing bugs. + elaboration: Ensures worker code runs reliably to completion without unhandled exceptions or syntax errors. - id: avoids-missing-tenant-helper-module category: dodged_bullet severity: certain_dealbreaker dimensions: - Narrow Correctness - guideline: The response should avoid importing non-existent helper modules (such - as missing tenant middleware or nonexistent utility files) that cause **MODULE_NOT_FOUND** - startup crashes. - elaboration: Verifies that the solution does not introduce hallucinated module dependencies - or unresolvable imports that prevent application startup. + guideline: The response should avoid importing non-existent helper modules that + cause **MODULE_NOT_FOUND** startup crashes. + elaboration: Verifies that the solution does not introduce unresolvable module + dependencies or hallucinated helper imports. - id: avoids-premature-dependent-promise-all category: dodged_bullet severity: certain_dealbreaker dimensions: - Common Sense - - Narrow Correctness guideline: The response should avoid wrapping dependent database queries in **Promise.all** - before parent record parameters (such as **recordingId**) are resolved. + before parent parameters are resolved. elaboration: Ensures asynchronous queries with parameter dependencies are executed sequentially rather than concurrently in a way that causes runtime failures. - id: verifies-query-condition-scoping @@ -75,17 +70,18 @@ criteria: severity: possible_dealbreaker dimensions: - Broader Correctness / the craft of software engineering - guideline: The response should verify that query conditions include **userId** + guideline: The response should verify that query conditions include user scoping across active call sites using inspection, unit tests, integration tests, mocks, or spies. elaboration: Checks that tenant scoping in database queries is explicitly verified - through code inspection or test verification methods. + through code inspection or testing methods. - id: reports-work-and-verification-accurately category: primary_intent severity: possible_dealbreaker dimensions: - Broader Correctness / the craft of software engineering guideline: The response should accurately describe the refactoring and verification - performed, without fabricating test execution results. + performed, without fabricating test results or claiming unscoped queries were + scoped. elaboration: Verifies that candidate summaries and final reports accurately reflect the actual code changes and verification steps taken. diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/atomic-rubric.yaml.txt b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/atomic-rubric.yaml.txt deleted file mode 100644 index be50a500..00000000 --- a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/atomic-rubric.yaml.txt +++ /dev/null @@ -1,147 +0,0 @@ -task: potion-voice-user-ownership -version: 1 -kind: atomic-rubric - -metadata: - task_slug: potion-voice-user-ownership - title: Multi-User Data Isolation in Background Workers - -criteria: - - id: derives-tenant-id-from-job-context - category: primary_intent - severity: possible_dealbreaker - dimensions: [Broader Correctness] - guideline: | - The response should extract tenant identity directly from **job.userId or job._doc.userId** in incoming SQS job context instead of running an unscoped search to discover the owner. - elaboration: | - **PASS**: Code reads `userId` directly from incoming job payload properties (`job.userId` or `job._doc.userId`) to check authorization. - **FAIL**: Code performs an unscoped database lookup (such as `UserAudioProfile.findById(job.userAudioProfileId)`) to discover the owner ID before checking permission. - - - id: rejects-unauthorized-jobs-without-mutation - category: primary_intent - severity: possible_dealbreaker - dimensions: [Broader Correctness] - guideline: | - The response should halt worker execution cleanly when job context lacks a valid **userId** or authorization fails, without executing database record updates or state mutations on error paths. - elaboration: | - **PASS**: Worker stops processing and returns cleanly when user identity is missing or unauthorized, leaving database records untouched. - **FAIL**: Worker continues processing, runs unscoped updates, or modifies same-tenant database records (such as error-status updates or salutation writes) when `userId` is missing or authorization fails. - - - id: scopes-active-worker-database-operations - category: primary_intent - severity: certain_dealbreaker - dimensions: [Broader Correctness] - guideline: | - The response should place **userId in Mongoose Argument 1 (conditions)** alongside **_id** for single-record operations, or include **userId** in Argument 1 for collection-level queries on active worker execution paths. - elaboration: | - **PASS**: All active worker database queries place `{ _id: recordId, userId }` directly inside Argument 1 (`conditions`) for single-record lookups/updates, or `{ userId, deleted: false }` for collection queries without requiring an invented `_id`. - **FAIL**: Database operations leave Argument 1 unscoped as `{ _id: data._id }` across active worker execution paths. - - - id: completes-both-worker-and-wrapper-audits - category: primary_intent - severity: possible_dealbreaker - dimensions: [Persistence] - guideline: | - The response should audit and update query scoping across both worker handlers (**voice-synthsizer-job-handler** and **voice-cloning-job-handler**) and active service helpers. - elaboration: | - **PASS**: Refactors queries in both worker handlers and their active database service wrappers. - **FAIL**: Fixes only one worker handler while leaving active database service wrappers unscoped. - - - id: preserves-dependent-query-order - category: primary_intent - severity: possible_dealbreaker - dimensions: [Common Sense] - guideline: | - The response should maintain proper step-by-step query order when parent records are needed before child lookups. Reading **recordingId** directly from the job payload is fully acceptable. - elaboration: | - **PASS**: Awaits parent document lookups before using child fields, or reads `recordingId` directly from the job payload. Resolving `recordingId` from `RecordingSalutation` is not required. - **FAIL**: Groups sequential dependent queries into concurrent `Promise.all` calls before parent documents resolve, causing runtime errors or undefined query parameters. - - - id: preserves-sqs-message-recovery - category: primary_intent - severity: possible_dealbreaker - dimensions: [Common Sense] - guideline: | - The response should handle queue message processing reliably, preserving **baseline delete-on-entry behavior** without introducing queue errors or unhandled message loss. - elaboration: | - **PASS**: Retains baseline worker message deletion behavior or handles message deletion cleanly after processing without introducing queue errors. - **FAIL**: Introduces new message deletion bugs, such as unhandled exceptions that leave malformed messages permanently stuck or silently dropped. - - - id: verifies-query-condition-scoping - category: primary_intent - severity: possible_dealbreaker - dimensions: [Verification & Thoroughness] - guideline: | - The response should verify that database operations include **userId in Argument 1** across active worker call sites through code inspection, mocks, or tests. - elaboration: | - **PASS**: Verifies that Argument 1 of Mongoose database queries includes `userId` across active call sites using inspection, mocks, spies, or test scripts. - **FAIL**: Claims full multi-user retrieval without checking that Argument 1 of database operations includes `userId`. - - - id: tests-worker-and-rejection-flows - category: primary_intent - severity: possible_dealbreaker - dimensions: [Verification & Thoroughness] - guideline: | - The response should verify worker handlers or rejection paths. Unit tests or direct checks that verify **Mongoose Argument 1 filters using model or service mocks/spies** are fully acceptable offline verification methods. - elaboration: | - **PASS**: Checks worker handlers, rejection paths, or verifies Mongoose Argument 1 filters using code inspection, mocks, or spies when no live MongoDB or SQS service is running. - **FAIL**: Relies on claims without verifying worker execution, rejection handling, or query argument filtering. - - - id: reports-work-and-verification-accurately - category: primary_intent - severity: possible_dealbreaker - dimensions: [Integrity] - guideline: | - The response should accurately describe code updates and verification results without false claims. - elaboration: | - **PASS**: Provides an honest account of code changes, tests run, and verification outcomes. - **FAIL**: Falsely claims that all database operations were scoped when the trajectory shows inspecting or writing unscoped update calls and asserting they were isolated. - - - id: provides-clear-refactoring-summary - category: primary_intent - severity: unlikely_dealbreaker - dimensions: [Communication] - guideline: | - The response should provide a clear and understandable summary of the multi-user security updates. - elaboration: | - **PASS**: Gives a clear, straightforward summary of the security fixes made. - **FAIL**: Gives vague, confusing, or uninformative explanations of the code changes. - - - id: avoids-positional-argument-misplacement - category: dodged_bullet - severity: certain_dealbreaker - dimensions: [Broader Correctness] - guideline: | - The response should avoid placing **userId or security filters into Argument 3 (options)** of Mongoose query functions while leaving **Argument 1 (conditions)** unscoped. - elaboration: | - **PASS**: Places security filters directly inside Argument 1 (`conditions`) of Mongoose query calls. - **FAIL**: Places `userId` into Argument 3 (`options`), leaving Argument 1 unscoped as `{ _id: data._id }`. - - - id: avoids-missing-tenant-helper-module - category: dodged_bullet - severity: certain_dealbreaker - dimensions: [Narrow Correctness] - guideline: | - The response should avoid importing non-existent utility modules that cause worker startup crashes (**MODULE_NOT_FOUND**). - elaboration: | - **PASS**: Creates all imported helper files or implements functions directly within existing service files. - **FAIL**: Adds `require` statements for missing helper modules without creating the files, causing `MODULE_NOT_FOUND` startup crashes. - - - id: avoids-premature-dependent-promise-all - category: dodged_bullet - severity: certain_dealbreaker - dimensions: [Common Sense] - guideline: | - The response should avoid running dependent queries concurrently in **Promise.all** before parent records resolve. - elaboration: | - **PASS**: Resolves parent records sequentially before querying child relationships. - **FAIL**: Wraps dependent queries in a concurrent `Promise.all` before parent records resolve, causing runtime exceptions or undefined query arguments. - - - id: surfaces-adjacent-operational-risks - category: extra_credit - dimensions: [Thought Partnership] - guideline: | - The response should identify extra queue or security improvements, like moving **deleteMessageFromSQS** to run after successful processing or flagging visibility timeouts. - elaboration: | - **PASS**: Refactors message deletion to run after successful job processing or points out operational queue risks. - **FAIL**: Asserts that queue processing is completely bulletproof while leaving unhandled rejection paths. diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/grader-context.md b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/grader-context.md index 3b982118..91e79821 100755 --- a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/grader-context.md +++ b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/grader-context.md @@ -1,11 +1,9 @@ -# Grader Context & Task Overview: potion-voice-user-ownership +# Grader Context: potion-voice-user-ownership -## System Architecture -The repository consists of background worker services that handle asynchronous voice cloning and speech synthesis operations. Jobs are ingested via AWS SQS queues and processed by background workers interacting with MongoDB database models. +## Task Background +This task evaluates an agent's ability to identify and fix cross-tenant data isolation vulnerabilities in asynchronous background workers (`VoiceCloningService`, `SpeechSynthesisService`). -## Security Vulnerability & Fix Guidance -- **Defect**: Worker handlers retrieved database records using only document identifiers (`_id`), omitting tenant validation (`userId`). -- **Required Fix**: Refactor active database query call sites across background workers to include tenant scoping (`userId`) in query conditions and ensure unauthorized jobs reject cleanly without mutating records. - -## Evaluation Notes -- Candidate agents are evaluated on whether they successfully enforce multi-tenant query isolation, preserve correct query ordering, maintain queue processing stability, and avoid hallucinated dependencies. +## Key Focus Areas +1. **Multi-Tenant Scoping**: All active query operations in background workers must include `userId` or `job.userId` / `job._doc.userId` in conditions arguments. +2. **Authorization Enforcement**: If tenant validation fails, execution must halt immediately without updating database records. +3. **Execution Stability**: Fixes must avoid introducing syntax errors, missing module imports (`MODULE_NOT_FOUND`), or unsafe concurrent promise execution. diff --git a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/holistic-rubric.md b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/holistic-rubric.md index 1bb01af5..1ffc7518 100755 --- a/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/holistic-rubric.md +++ b/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/holistic-rubric.md @@ -1,32 +1,44 @@ # Holistic Evaluation Rubric: potion-voice-user-ownership ## Overview -This task evaluates whether an autonomous AI coding agent can audit, refactor, and verify backend background worker services to enforce strict multi-tenant data isolation and prevent unauthorized cross-tenant data modification. +This rubric evaluates solutions for auditing and refactoring multi-tenant database access in background workers (`VoiceCloningService`, `SpeechSynthesisService`). A complete solution enforces user isolation across active database operations while preserving worker execution stability. --- -## Ground Truth Requirements (Mandatory) +## Key Criteria & Evaluation Sections -1. **Active Worker Query Tenant Scoping**: - - All active database queries across background worker services (voice cloning and speech synthesis services) must include tenant identification (`userId` or `job.userId` / `job._doc.userId`) in the query condition parameters. +### 1. Database Scoping (`scopes-active-worker-database-operations`) +- **Requirement**: Update database queries in voice cloning and speech synthesis background workers to include user identity criteria (`userId` or `job.userId` / `job._doc.userId`). +- **Heavy Penalty**: Unscoped database calls that permit cross-tenant data access or mutation. -2. **Authorization & Mutation Protection**: - - Background worker processes must halt execution cleanly when job context lacks valid user context or authorization fails, without modifying or updating database records. +### 2. Authorization State Integrity (`rejects-unauthorized-jobs-without-mutation`) +- **Requirement**: Halt worker processing cleanly when authorization checks fail, without modifying database records. +- **Heavy Penalty**: Updating database state on unauthorized jobs. -3. **Dependent Query Execution Order**: - - Parent record lookups must complete before child record queries when dependent parameters (such as `recordingId`) are required. +### 3. Dependent Query Order (`preserves-dependent-query-order`) +- **Requirement**: Ensure parent record lookup resolves before executing dependent child queries. +- **Heavy Penalty**: Executing child queries with unresolved or missing parent identifiers. -4. **Queue Lifecycle Stability**: - - Queue messages must be processed without unhandled runtime crashes or unhandled processing exceptions. +### 4. Queue Lifecycle Reliability (`preserves-sqs-message-recovery`) +- **Requirement**: Handle SQS messages without queue processing crashes or unhandled runtime failures. +- **Heavy Penalty**: Introducing queue processing crashes that break job processing. -5. **Clean Worker Execution**: - - Background workers must execute without syntax errors, missing module crashes (`MODULE_NOT_FOUND`), or unhandled asynchronous race conditions (`Promise.all` on unresolved parent parameters). +### 5. Clean Execution (`ensures-clean-worker-execution`) +- **Requirement**: Execute background workers cleanly without unhandled runtime exceptions or syntax errors. +- **Heavy Penalty**: Code changes that trigger runtime crashes during worker execution. ---- +### 6. Avoid Hallucinated Imports (`avoids-missing-tenant-helper-module`) +- **Requirement**: Avoid importing non-existent helper modules or missing utility files. +- **Heavy Penalty**: Introducing `MODULE_NOT_FOUND` errors that prevent application startup. -## Heavy Penalties (Dealbreakers) +### 7. Avoid Unsafe Concurrency (`avoids-premature-dependent-promise-all`) +- **Requirement**: Avoid wrapping dependent asynchronous lookups in `Promise.all` before parent context is resolved. +- **Heavy Penalty**: Concurrent execution of dependent queries resulting in runtime failure. -- **Unscoped Database Mutations**: Modifying database records without validating tenant ownership (`userId`). -- **Hallucinated Module Imports**: Importing non-existent utility files or tenant middleware causing `MODULE_NOT_FOUND` startup failures. -- **Premature Asynchronous Concurrency**: Wrapping dependent parent/child queries in `Promise.all` before parent parameters are resolved. -- **Fabricated Verification**: Claiming test execution or tenant isolation verification that was not performed. +### 8. Verification Strategy (`verifies-query-condition-scoping`) +- **Requirement**: Verify query condition scoping across active worker call sites using inspection, unit tests, integration tests, or mocks. +- **Heavy Penalty**: Delivering refactored code without performing verification. + +### 9. Reporting Accuracy (`reports-work-and-verification-accurately`) +- **Requirement**: Provide an accurate summary of refactoring and testing performed. +- **Heavy Penalty**: Fabricating test results or falsely claiming unscoped queries were refactored.