Commit 58ffbc2
committed
feat: secure document upload for educator KYC
Adds the upload step for educator verification documents (government ID,
teaching/school certificate). The app previously had no document flow, and its
only upload primitive posted to an unsigned Cloudinary preset that returns a
public secure_url β acceptable for a course thumbnail, not for an identity
document.
Client pre-flight (lib/verification/documents/)
- fileSignature.js reads the leading bytes of the File and identifies the real
format, naming recognisably hostile payloads (MZ, ELF, ZIP, RAR, gzip, #!)
- policy.js gates on declared MIME, size, and magic-byte agreement. A file that
fails never reaches the network, so no signed target is requested for it.
Upload path (lib/actions/educators/uploadDocument.js)
- Requests a short-lived signed upload target from the backend, PUTs the bytes
straight to it, then finalises to start server-side malware scanning
- The signed PUT uses a bare axios client (withCredentials: false) so the
user's bearer token never reaches the storage origin
- Only { documentId, status, ... } is stored β never a URL
UI
- DocumentUpload.jsx: drag/drop, click-to-browse, camera capture, per-file
progress, preview, replace, remove, and a scan-pending state resolving to
accepted or rejected
- Reachable at /educator-onboarding/documents; the liveness capture step now
routes here on success
Docs
- docs/secure-document-upload.md
- .env.example now states the unsigned Cloudinary preset is course media only
Closes #1721 parent 307b829 commit 58ffbc2
13 files changed
Lines changed: 2658 additions & 6 deletions
File tree
- __tests__/documents
- app/[locale]/educator-onboarding
- documents
- components/organisms/educator-onboarding
- docs
- e2e
- hooks
- lib
- actions/educators
- verification/documents
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
22 | 27 | | |
23 | 28 | | |
24 | 29 | | |
| |||
0 commit comments