issue-6: sandbox content generated#63
Conversation
📝 WalkthroughWalkthroughServer- and client-side HTML sanitization were added: a Go HTMLSanitizer using bluemonday sanitizes RO-Crate metadata on the server, and client-side sanitization plus sandboxed iframes render HTML previews in the browser. Changes
Sequence Diagram(s)sequenceDiagram
participant User as User (Browser)
participant Client as Client JS
participant Server as Server (Go)
participant Sanitizer as HTMLSanitizer
participant IFrame as Sandboxed IFrame
User->>Server: Request RO-Crate JSON
Server->>Sanitizer: SanitizeRoCrateMetadata(metadata)
Sanitizer->>Sanitizer: Walk `@graph`, locate encodingFormat="text/html"
Sanitizer->>Sanitizer: Sanitize HTML fields (text/description/content)
Sanitizer-->>Server: Return sanitized metadata
Server-->>Client: Send sanitized RO-Crate
Client->>Client: Extract HTML content
Client->>Client: sanitizeHTML() (client-side)
Client->>IFrame: Insert sanitized document via srcdoc into sandboxed iframe
IFrame-->>User: Render isolated, sanitized content
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Free 📒 Files selected for processing (2)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
| } | ||
|
|
||
| // Check if this entity has HTML content | ||
| encodingFormat, _ := entity["encodingFormat"].(string) |
There was a problem hiding this comment.
I suggest always sanitize, don't rely on user defined encodingFormat value.
Closes #6
Summary by CodeRabbit
New Features
Style
✏️ Tip: You can customize this high-level summary in your review settings.