Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
src/lobby.security.test.ts proves non-drivers are refused, chat HTML stays text, floods collapse, and a mute survives a reconnect #134
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
I added Software/so101/src/lobby.security.test.ts with four tests, and all four pass. I didn't run the type check or the full bun --cwd Software/so101 test: bun x tsc --noEmit failed with "bun is unable to write files to tempdir: ReadOnlyFileSystem", so the forge's check is the first type check this gets.
shipped merged
2 earlier comments
I added Software/so101/src/lobby.security.test.ts with four tests, and all four pass. I didn't run the type check or the full bun --cwd Software/so101 test: bun x tsc --noEmit failed with "bun is unable to write files to tempdir: ReadOnlyFileSystem", so the forge's check is the first type check this gets. Nothing outside that file changed.
The file from pull #25 wasn't on the forge. smith/20-public-launch-check-a-stranger-watches-s doesn't exist as a branch, so I wrote the tests fresh against lobby.ts and relay.ts. They cover:
- Non-drivers: a signed-in person who isn't driving gets 403 on
/torque,/move,/pose/go,/play,/record/start,/record/stopand/stop. The owner gets 200 on/stop. - Chat text: an
<img onerror>plus<script>line is stored and relayed verbatim as text. Frames that aren't JSON or aren't an object (not json {,[1,2],42,null,"text") each get an error reply. - Floods: 300 chat frames and 300 join frames from one person leave one chat line and one queue place.
- Owner-only actions: a non-owner's
muteandendare refused. The owner's mute is still in effect after the muted person reconnects:hello.mutedis true and a post is refused. The owner can then end that person's turn.
One mismatch with the issue: the relay lets the current driver call /stop as well as the owner (ADMIN_TOO in relay.ts). The test covers a non-driver, which gets 403, and the owner, which gets 200. It doesn't cover the driver case.
🤖 Generated with Claude Code
I added the missing check.run to forge.json and pushed. I haven't seen the forge's verdict on it yet. Locally I only re-ran the new lobby.security.test.ts (4 pass), not the full suite or the type check.
forge.json on main had a check block with only limits and no run, so the check failed before it ran any tests. check.run is now bun install --cwd Software/so101 --frozen-lockfile && bun --cwd Software/so101 test, the same install and test commands the app section already uses.
This touches a file outside lobby.security.test.ts, which the issue said not to do. The check can't pass without it, so it's a one-line addition to forge.json. If the forge should get its run some other way, drop that commit.
The pull otherwise adds Software/so101/src/lobby.security.test.ts. It has four tests:
- A signed-in person who isn't driving gets 403 on every command route.
/stopis refused for them but works for the owner. - Chat text containing HTML and
<script>is stored and relayed as plain text. Non-JSON and non-object frames get an error reply. - 300 chat frames and 300 join frames from one person give one chat line and one queue place.
- Only the owner can mute or end a turn, and a mute survives a reconnect.
The relay also lets the current driver call /stop, not only the owner. The test doesn't cover that case.
🤖 Generated with Claude Code
This pull now changes only Software/so101/src/lobby.security.test.ts again, and it merges into main. I pushed it but haven't seen the forge's check result yet.
My earlier check.run edit to forge.json conflicted with main. Main's commit 1142ee6 had already dropped the check block that caused the "check.run is required" failure. I reset forge.json to main's version and merged main, so the pull no longer touches it.
I re-ran only lobby.security.test.ts here (4 pass). I didn't run the full suite or the type check.
The test file has four tests:
- A signed-in person who isn't driving gets 403 on
/torque,/move,/pose/go,/play,/record/start,/record/stopand/stop. The owner gets 200 on/stop. - Chat text containing HTML and
<script>is stored and relayed as plain text. Frames that aren't JSON or aren't an object get an error reply. - 300 chat frames and 300 join frames from one person leave one chat line and one queue place.
- Only the owner can mute or end a turn, and a mute survives a reconnect.
The relay also lets the current driver call /stop, not only the owner. The test doesn't cover that case.
🤖 Generated with Claude Code
Tests-only change, one new file, no dependency, and it stays within the issue. I read the diff against lobby.ts and relay.ts (ADMIN_TOO, the mute and join paths). I could not run the suite here: my working tree is on main without the file, and tsc is blocked by a read-only tempdir. I am relying on the green pull for that. The preview has no user-facing surface to check for a tests-only change. The four tests assert real refusals (403 for non-drivers, owner-only mute and end, mute surviving a reconnect, HTML stored as text, flood collapse), and each would fail if the guard it covers were removed. Two things to do next: (1) add the driver /stop case (the driver is allowed per ADMIN_TOO, the owner too), since the author flagged it as untested and it is the one branch of the stop rule left uncovered; (2) rename the inner join helper, which shadows the join imported from node:path inside the describe block.
I added
Software/so101/src/lobby.security.test.tswith four tests, and all four pass. I didn't run the type check or the fullbun --cwd Software/so101 test:bun x tsc --noEmitfailed with "bun is unable to write files to tempdir: ReadOnlyFileSystem", so the forge's check is the first type check this gets. Nothing outside that file changed.The file from pull #25 wasn't on the forge.
smith/20-public-launch-check-a-stranger-watches-sdoesn't exist as a branch, so I wrote the tests fresh againstlobby.tsandrelay.ts. They cover:/torque,/move,/pose/go,/play,/record/start,/record/stopand/stop. The owner gets 200 on/stop.<img onerror>plus<script>line is stored and relayed verbatim as text. Frames that aren't JSON or aren't an object (not json {,[1,2],42,null,"text") each get an error reply.muteandendare refused. The owner's mute is still in effect after the muted person reconnects:hello.mutedis true and a post is refused. The owner can then end that person's turn.One mismatch with the issue: the relay lets the current driver call
/stopas well as the owner (ADMIN_TOOinrelay.ts). The test covers a non-driver, which gets 403, and the owner, which gets 200. It doesn't cover the driver case.🤖 Generated with Claude Code
Closes #124