-
-
Notifications
You must be signed in to change notification settings - Fork 983
New Direct Terminal Tsunami SubBlock + TCP over PTY system to forward ports #3275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
de48830
1e14a37
868470f
3d442dc
507a988
bb8ba32
50ee4e3
6fb3ffc
003d073
6d7790c
b335043
4db2737
7945bd1
802f928
f61eb14
c7480fb
e96a78b
a947688
5aea889
17e636d
db626d0
5925b66
cd36896
14bd2d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,3 +44,4 @@ docsite/ | |
| .superpowers | ||
| docs/superpowers | ||
| .claude | ||
| CLAUDE.local.md | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -411,14 +411,14 @@ export async function handleOsc9009Command(data: string, blockId: string, loaded | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const oref = await RpcApi.CreateSubBlockCommand(TabRpcClient, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| parentblockid: blockId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| blockdef: { meta: { view: "tsunami", "tsunami:url": tsunamiUrl, "tsunami:termlisten": true, "tsunami:port": payload.port, "tsunami:parentblockid": blockId } }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| blockdef: { meta: { view: "tsunamidirect", "tsunami:url": tsunamiUrl, "tsunami:parentblockid": blockId } }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const [, newBlockId] = splitORef(oref); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setTimeout(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RpcApi.SetMetaCommand(TabRpcClient, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| oref: WOS.makeORef("block", blockId), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| meta: { "term:tsunamiblockid": newBlockId, "term:mode": "tsunami" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| meta: { "term:tsunamiblockid": newBlockId, "term:mode": "tsunami", "term:tsunamilocalport": payload.port }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, 50); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+405
to
+423
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only delete the current tsunami block after the replacement is committed.
Proposed fix const oldBlockId = globalStore.get(getBlockMetaKeyAtom(blockId, "term:tsunamiblockid"));
- if (oldBlockId) {
- setTimeout(() => {
- RpcApi.DeleteSubBlockCommand(TabRpcClient, { blockid: oldBlockId });
- }, 500);
- }
-
const oref = await RpcApi.CreateSubBlockCommand(TabRpcClient, {
parentblockid: blockId,
blockdef: { meta: { view: "tsunamidirect", "tsunami:url": tsunamiUrl, "tsunami:parentblockid": blockId } },
});
const [, newBlockId] = splitORef(oref);
-
- setTimeout(() => {
- RpcApi.SetMetaCommand(TabRpcClient, {
- oref: WOS.makeORef("block", blockId),
- meta: { "term:tsunamiblockid": newBlockId, "term:mode": "tsunami", "term:tsunamilocalport": payload.port },
- });
- }, 50);
+ await RpcApi.SetMetaCommand(TabRpcClient, {
+ oref: WOS.makeORef("block", blockId),
+ meta: { "term:tsunamiblockid": newBlockId, "term:mode": "tsunami", "term:tsunamilocalport": payload.port },
+ });
+ if (oldBlockId) {
+ setTimeout(() => {
+ RpcApi.DeleteSubBlockCommand(TabRpcClient, { blockid: oldBlockId });
+ }, 500);
+ }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verify the advertised port before opening a localhost block.
Any process that can write to this terminal can emit OSC 9009 with
{ "termlisten": true, "port": N }, and this handler will immediately create atsunamidirectblock tohttp://localhost:N. That crosses a trust boundary and lets terminal output target arbitrary local services. Validate thatportis an integer in range and belongs to an active termlisten registration before creating the sub-block.Proposed fix
try { payload = JSON.parse(jsonStr); } catch { return true; } if (!payload.port || !payload.termlisten) return true; + if (!Number.isInteger(payload.port) || payload.port < 1 || payload.port > 65535) return true; + const active = await RpcApi.TermListenCheckPortCommand(TabRpcClient, { port: payload.port }); + if (!active) return true; const tsunamiUrl = `http://localhost:${payload.port}`;🤖 Prompt for AI Agents