Skip to content

fix: harden classroom persistence and editor flows#124

Open
cropsgg wants to merge 1 commit intoTHU-MAIC:mainfrom
cropsgg:fix/security-and-editor-hardening
Open

fix: harden classroom persistence and editor flows#124
cropsgg wants to merge 1 commit intoTHU-MAIC:mainfrom
cropsgg:fix/security-and-editor-hardening

Conversation

@cropsgg
Copy link

@cropsgg cropsgg commented Mar 19, 2026

Summary

  • harden classroom persistence by validating IDs, defending file-path resolution, and avoiding unsafe origin construction
  • persist generation resume data in IndexedDB, handle resume failures safely, and mark stale queued jobs instead of leaving them hanging forever
  • sanitize rich HTML rendering, remove same-origin iframe privileges for interactive scenes, and complete editor clipboard/create/link flows

Test plan

  • checked edited files with lint diagnostics
  • ran bunx tsc --noEmit and verified the touched files do not introduce new TypeScript errors
  • manually reviewed the classroom resume error-handling flow and LinkDialog state sync behavior
  • full repository type-check passes

Notes

The full repository bunx tsc --noEmit run still reports pre-existing dependency/type issues in unrelated files. This PR does not add new TypeScript failures in the files it changes.

Made with Cursor

Validate classroom storage inputs, persist resume generation data, sanitize rich HTML rendering, tighten interactive iframe isolation, and complete the editor creation and clipboard flows so the classroom experience is safer and more reliable.
Copy link
Contributor

@wyuc wyuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! The scope here is quite broad for a single PR (19 files across security hardening, IndexedDB persistence, and editor flows). This makes it hard to review confidently and increases merge conflict risk.

Could you split this into 2-3 focused PRs? For example:

  1. Security hardening: classroom ID validation, iframe sandbox, HTML sanitization, buildRequestOrigin
  2. Generation params persistence: sessionStorage to IndexedDB migration, stale job handling
  3. Editor flows: clipboard, link dialog, drag-drop, canvas operations

A few other things:

  • CI hasn't run on this branch yet. Once you push a smaller PR, we can approve the workflow run and verify lint + typecheck pass.
  • The project uses pnpm, so please verify with pnpm check && pnpm lint && npx tsc --noEmit rather than bunx.

Happy to review each focused PR once they're up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants