Security Specification for ExamForge
1. Data Invariants
- A student profile cannot have the 'teacher' role without admin approval (if admin existed).
- An Exam can only be published/edited by its creator (teacherId).
- A Student can only see results of their own attempts.
- An Attempt must reference a valid Exam ID.
- Scores cannot be modified after submission.
2. The Dirty Dozen Payloads
- Identity Spoofing: Attempt to create a student profile with
role: 'teacher'. - Identity Spoofing: Attempt to read another student's profile settings.
- Privilege Escalation: Attempt to update an exam created by another teacher.
- Data Poisoning: Attempt to inject 1MB string into
examId. - State Shortcut: Attempt to update an Attempt's status from 'completed' back to 'started'.
- Integrity Violation: Attempt to update an Attempt's score directly from the client after completion.
- Bypassing Invariants: Attempt to create an Attempt with a non-existent Exam ID.
- Shadow Field: Attempt to update an Exam with a hidden
verified: truefield. - Query Scraping: Attempt to list all Exam records without a specific filter.
- Resource Exhaustion: Attempt to create a document ID with 1000 characters.
- PII Leak: Attempt to read user
pinwithout ownership. - Time Spoofing: Attempt to set
createdAtto a future date instead of server time.
3. Test Runner (Draft)
The test runner will ensure these payloads return PERMISSION_DENIED.