fix(control): sanitize help content and stop runaway camera moves - #520
Conversation
- Remove the `safe` bypass from help rendering so Angular strips script handlers from markdown help content. - Move the camera "select a camera" overlay inside the controls body so it no longer covers the camera picker and dial view. - Send `stop` before each camera move in the tooltip, matching camera-controls, so a released axis does not keep moving. - Use pointer events with pointer capture for the joystick and zoom buttons. Cancel, capture loss and destroy now stop the camera. - Remove the duplicate `touchend` power-on from the splash screens and stop the changelog button from powering on the room.
|
Deployment failed for project frontend-templates with the following error: Learn More: https://vercel.com/placeos?upgradeToPro=build-rate-limit |
|
| const mod = getModule(this.id, camera.mod); | ||
| if (!mod) return; | ||
| // Stop first so an axis that returned to Stop does not keep moving | ||
| await mod.execute('stop', index ? [index] : []); |
There was a problem hiding this comment.
Not a bug. getModule() never returns null: in ts-client it is Qr(t).module(e, n), which always builds a module binding (typed PlaceModuleBinding, not nullable). A missing module makes execute reject; it does not throw on mod. The old if (!mod) return was dead code.
There was a problem hiding this comment.
You’re right — getModule() returns a PlaceModuleBinding created by system.module(...) and does not return null. The previous if (!mod) return was dead code, so removing it does not introduce the reported null dereference. A missing or unavailable engine module is handled through the promise returned by execute(), not by mod being absent. I’m withdrawing this finding.
| [innerHTML]=" | ||
| help().content | markdown | safe | ||
| " | ||
| [innerHTML]="help().content | markdown" |
There was a problem hiding this comment.
Removing safe also removes video and iframe embeds from help in both this tab and the help modal. The mock help includes a <video> tag. Help authors who use embedded media will lose those instructions. Keep sanitization, but decide which safe media embeds help needs and test that they render.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Known and intended for now: the PR description lists this under "Needs a decision". Help content is admin-editable and the panel holds a long-lived token, so it now goes through Angular's sanitizer. If help pages need embedded <video>, we will add a narrow allowlist in a follow-up rather than bypass sanitizing.
Help content from system settings was rendered with
bypassSecurityTrustHtml, so raw HTML in thehelpsetting (for example<img onerror=…>) ran script on the panel. The "select a camera" overlay covered the whole vidconf tab, so you could not pick a camera or dial. Cameras could keep moving: the tooltip sentstoponly when both axes stopped, and a cancelled touch never sentstop. One tap on the splash screen powered on the room twice, and the version link on the splash also powered it on.Changes
| safefrom the help tab and help modal, so Angular's sanitizer cleans the markdown output.bg-base-100/75).stopbefore each new direction. The joystick and zoom buttons use pointer events with pointer capture; release, cancel, lost capture and destroy all stop the camera.touch-action: nonestops drags from scrolling the tooltip.(touchend)power-on, and stop the changelog button click from reaching the splash.Testing
<img onerror>,<script>,javascript:links and iframes are stripped, normal markdown still renders; overlay hit-tests;stopafter drag, drag-out, touch cancel and tab change; onepower(true)per tap.fix/control-ux-fixes(bootstrap host visibility, app routing timing, and Escape not closing tooltips, which the last PR in the stack fixes). None of them reach this change. They were not run ondevelopitself.Help media
The sanitizer also strips
<video>and<iframe>from help content. This is intended.Merge order
1 of 5 in a stack. Based on
develop. Next:fix/control-state-bugs.Changes made by Claude Opus 5.5 (1M context) in Claude Code, running in T3 Code.
🤖 Generated with Claude Code