A Partial Sample Seal Code Incorrectly Confirms a Handover
Level 2 · node · Security · Seal verification accepts a code prefix as the complete code
Scenario
A fictional laboratory handover service stores a seal verification code for each specimen. An operator must enter the complete code to confirm a sealed specimen. However, entering only the beginning of the code, or even an empty string, can mark a specimen as verified. Inspect the comparison and state update across the repository, service, and controller.
Requirements
Mark a sealed specimen as verified only when the entered code exactly equals the stored seal code. Reject prefixes and empty input without changing the state. Preserve behavior for unknown specimens, previously verified specimens, and unrelated records. Do not add dependencies.
Acceptance criteria
- A sealed specimen is verified when its complete seal code matches exactly.
- A request for an unknown specimen does not modify records.
- An incorrect seal code is rejected without changing state.
- Entering only a prefix of the seal code is rejected.
- An empty code cannot verify a specimen.
- A previously verified specimen cannot be verified again.
- Verifying one specimen does not change another specimen.