Skip to content

Commit b04390f

Browse files
committed
Merge remote-tracking branch 'github/main' into maria/takeover-pr-26077
2 parents a20577c + 8b74a69 commit b04390f

539 files changed

Lines changed: 18322 additions & 4372 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/triage/PLAYBOOK.md‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,16 @@ of `main` for that work, never the tag-pinned diagnosis clone.
125125
- Show the user the complete final issue text and get an explicit yes before
126126
posting. Never post without it.
127127
- Note at the end of the issue which model and agent produced it.
128-
- If `gh` is not authenticated, offer `gh auth login`, or build a prefilled
129-
https://github.com/pingdotgg/t3code/issues/new URL with title and body query
130-
parameters; print the URL, and open it in their browser only after they
131-
approve.
128+
- Post with `gh issue create --repo pingdotgg/t3code --label via-triage` only
129+
if `gh api repos/pingdotgg/t3code --jq .permissions.triage` prints `true`.
130+
- Otherwise, or if `gh` is not authenticated, build a prefilled
131+
https://github.com/pingdotgg/t3code/issues/new?template=via-triage.yml URL.
132+
The form applies the label whoever submits it. Add `title` plus one
133+
URL-encoded query parameter per form field id: `what-happened`, `diagnosis`,
134+
`steps`, `version`, `environment`, `evidence`, `related`, `workaround` and
135+
`agent`. Keep the full encoded URL below 6,000 characters by shortening any
136+
fields as needed. Give the user any omitted text to paste into the form before
137+
submitting. Print the URL, and open it in their browser only after they approve.
132138
- If the user pasted screenshots, remind them to drag the images into the issue
133139
after it is created; they cannot be attached from here.
134140

‎.github/workflows/mobile-eas-production.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ jobs:
215215
git config user.name "${APP_SLUG}[bot]"
216216
git config user.email "${user_id}+${APP_SLUG}[bot]@users.noreply.github.com"
217217
git add apps/mobile/app.config.ts
218-
git commit \
218+
git commit --no-verify \
219219
-m "chore(mobile): bump app version to $RELEASE_VERSION" \
220220
-m "Co-authored-by: codex <[email protected]>"
221221
git push origin "HEAD:refs/heads/${GITHUB_REF_NAME}"

‎.github/workflows/release.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,7 @@ jobs:
13881388
git config user.email "${{ steps.app_bot.outputs.email }}"
13891389
13901390
git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml
1391-
git commit -m "chore(release): prepare $RELEASE_TAG"
1391+
git commit --no-verify -m "chore(release): prepare $RELEASE_TAG"
13921392
git push origin HEAD:main
13931393
13941394
announce_discord:

‎apps/desktop/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@t3tools/desktop",
3-
"version": "0.1.5",
3+
"version": "0.1.6",
44
"private": true,
55
"type": "module",
66
"main": "dist-electron/boot.cjs",

‎apps/desktop/resources/installer.nsh‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
!include "StrFunc.nsh"
2+
!ifdef BUILD_UNINSTALLER
3+
${UnStrRep}
4+
!define T3StrRep '${UnStrRep}'
5+
!else
6+
${StrRep}
7+
!define T3StrRep '${StrRep}'
8+
!endif
9+
10+
!macro customAppRunningMessages
11+
Push $0
12+
Push $1
13+
${If} $IsPowerShellAvailable == 0
14+
System::Call 'kernel32::SetEnvironmentVariable(t "T3CODE_INSTALL_DIR", t "$INSTDIR")'
15+
nsExec::ExecToStack `"$PowerShellPath" -NoProfile -NonInteractive -C "Get-CimInstance -ClassName Win32_Process | Where-Object { $$_.ExecutablePath -and [IO.Path]::GetDirectoryName($$_.ExecutablePath) -eq $$env:T3CODE_INSTALL_DIR } | ForEach-Object { [IO.Path]::GetFileNameWithoutExtension($$_.ExecutablePath) } | Where-Object { $$_ -in 'T3 Code (Alpha)', 'T3 Code (Beta)', 'T3 Code (Nightly)' } | Select-Object -First 1 | ForEach-Object { [Console]::Write($$_) }"`
16+
Pop $0
17+
Pop $1
18+
System::Call 'kernel32::SetEnvironmentVariable(t "T3CODE_INSTALL_DIR", p 0)'
19+
${If} $0 == 0
20+
${If} $1 == "T3 Code (Alpha)"
21+
${OrIf} $1 == "T3 Code (Beta)"
22+
${OrIf} $1 == "T3 Code (Nightly)"
23+
${T3StrRep} $appRunningMessage $appRunningMessage "${PRODUCT_NAME}" $1
24+
${T3StrRep} $appClosingMessage $appClosingMessage "${PRODUCT_NAME}" $1
25+
${T3StrRep} $appCannotBeClosedMessage $appCannotBeClosedMessage "${PRODUCT_NAME}" $1
26+
${EndIf}
27+
${EndIf}
28+
${EndIf}
29+
Pop $1
30+
Pop $0
31+
!macroend
32+
133
!macro customInstall
234
!ifndef DO_NOT_CREATE_START_MENU_SHORTCUT
335
${IfNot} ${FileExists} "$newStartMenuLink"

‎apps/desktop/src/permissions/MacSettingsWindow.test.ts‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as NodeEvents from "node:events";
2+
import * as NodeVM from "node:vm";
23
import { beforeEach, expect, it, vi } from "vite-plus/test";
34
import { watchMacSettingsWindow } from "./MacSettingsWindow.ts";
45

@@ -42,3 +43,29 @@ it("distinguishes unavailable tracking from a valid absent window", () => {
4243
expect(unavailable).toHaveBeenCalledTimes(2);
4344
stop();
4445
});
46+
it("polls while its parent lives and stops after reparenting to launchd", () => {
47+
watchMacSettingsWindow(vi.fn(), vi.fn())();
48+
const script = mocks.spawn.mock.lastCall?.[1][3];
49+
const imports = new Set<string>();
50+
const writeData = vi.fn();
51+
const poll = vi.fn(() => ({ count: 0 }));
52+
const sleep = vi.fn(() => {
53+
if (sleep.mock.calls.length > 2) throw new Error("tracker kept polling after parent exit");
54+
});
55+
const bridge = Object.assign((line: string) => ({ dataUsingEncoding: () => line }), {
56+
getppid: () => {
57+
if (!imports.has("unistd")) throw new Error("unistd bridge unavailable");
58+
return sleep.mock.calls.length < 2 ? 42 : 1;
59+
},
60+
NSRunningApplication: { runningApplicationsWithBundleIdentifier: poll },
61+
NSFileHandle: { fileHandleWithStandardOutput: { writeData } },
62+
NSThread: { sleepForTimeInterval: sleep },
63+
NSUTF8StringEncoding: 4,
64+
});
65+
NodeVM.runInNewContext(script + "\nrun();", {
66+
ObjC: { import: (name: string) => imports.add(name) },
67+
$: bridge,
68+
});
69+
expect(poll).toHaveBeenCalledTimes(2);
70+
expect(writeData.mock.calls).toEqual([["null\n"]]);
71+
});

‎apps/desktop/src/permissions/MacSettingsWindow.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ const decodeSettingsWindow = Schema.decodeUnknownSync(Schema.fromJsonString(Sett
2020
const SETTINGS_WINDOW_SCRIPT = `
2121
ObjC.import("CoreGraphics");
2222
ObjC.import("AppKit");
23+
ObjC.import("unistd");
2324
function run() {
2425
let previous = "";
25-
while (true) {
26+
while ($.getppid() !== 1) {
2627
const apps = $.NSRunningApplication.runningApplicationsWithBundleIdentifier("com.apple.systempreferences");
2728
let result = null;
2829
if (apps.count > 0) {

‎apps/desktop/src/preview/BrowserSession.test.ts‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ describe("BrowserSession", () => {
145145
}).pipe(Effect.provide(layer)),
146146
);
147147

148-
it.effect("grants clipboard-sanitized-write through both the request and check handlers", () =>
148+
it.effect("grants preview permissions through both the request and check handlers", () =>
149149
Effect.gen(function* () {
150150
const browserSessions = yield* BrowserSession.BrowserSession;
151151
const partition = yield* browserSessions.getPartition("scope-a");
@@ -168,7 +168,12 @@ describe("BrowserSession", () => {
168168
return granted;
169169
};
170170

171-
for (const permission of ["clipboard-sanitized-write", "geolocation", "fullscreen"]) {
171+
for (const permission of [
172+
"clipboard-sanitized-write",
173+
"geolocation",
174+
"fullscreen",
175+
"loopback-network",
176+
]) {
172177
assert.isTrue(requestAllows(permission), `request handler should allow ${permission}`);
173178
assert.isTrue(
174179
checkHandler(null, permission) as boolean,
@@ -179,7 +184,13 @@ describe("BrowserSession", () => {
179184
// `clipboard-write` is not a real Electron permission — the async write API
180185
// uses `clipboard-sanitized-write` — so the stale name must not be granted,
181186
// and unrelated permissions stay denied.
182-
for (const permission of ["clipboard-write", "notifications", "midi"]) {
187+
for (const permission of [
188+
"clipboard-write",
189+
"notifications",
190+
"midi",
191+
"local-network",
192+
"local-network-access",
193+
]) {
183194
assert.isFalse(requestAllows(permission), `request handler should deny ${permission}`);
184195
assert.isFalse(
185196
checkHandler(null, permission) as boolean,

‎apps/desktop/src/preview/BrowserSession.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ const ALLOWED_PREVIEW_PERMISSIONS: ReadonlySet<string> = new Set([
2424
"geolocation",
2525
// DesktopWindow confines HTML fullscreen to the guest's webview.
2626
"fullscreen",
27+
// Loopback requests already succeed in Electron 44; permission-aware sign-in widgets query first.
28+
"loopback-network",
2729
// Deny local-fonts to untrusted previews: it exposes installed-font fingerprints and file bytes.
2830
// Deny notifications: pages could impersonate T3 Code; app notifications use the default session.
2931
]);

‎apps/desktop/src/preview/Manager.test.ts‎

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ describe("previewWindowOpenAction", () => {
8686
).toBe("popup");
8787
});
8888

89+
it("opens HTTP links in preview tabs", () => {
90+
for (const disposition of ["foreground-tab", "background-tab"] as const) {
91+
expect(PreviewManager.previewWindowOpenAction(details({ disposition }))).toBe("new-tab");
92+
}
93+
});
94+
8995
it("keeps a form POST with a body on the in-place path", () => {
9096
const postBody = { data: [], contentType: "application/x-www-form-urlencoded" };
9197
expect(
@@ -98,15 +104,32 @@ describe("previewWindowOpenAction", () => {
98104

99105
it("does not hand a window to schemes that cannot be hardened", () => {
100106
for (const url of [
101-
"javascript:alert(1)",
102-
"file:///etc/passwd",
103107
"vscode://vscode-remote/ssh-remote+box/tmp",
104-
"not a url",
108+
"blob:https://example.com/0b6c6a5e-55d4-4b4c-9d47-8f1b0c1d2e3f",
105109
]) {
106110
expect(PreviewManager.previewWindowOpenAction(details({ url }))).toBe("navigate");
107111
}
108112
});
109113

114+
it("denies local and inline schemes that no page could open in place itself", () => {
115+
for (const url of [
116+
"data:text/html,<h1>hi</h1>",
117+
"DaTa:text/html,<h1>hi</h1>",
118+
"file:///etc/passwd",
119+
"javascript:alert(1)",
120+
"view-source:https://example.com",
121+
"chrome://gpu",
122+
"about:srcdoc",
123+
"devtools://devtools/bundled/inspector.html",
124+
"filesystem:https://example.com/temporary/page.html",
125+
"not a url",
126+
]) {
127+
for (const disposition of ["new-window", "foreground-tab", "background-tab"] as const) {
128+
expect(PreviewManager.previewWindowOpenAction(details({ url, disposition }))).toBe("deny");
129+
}
130+
}
131+
});
132+
110133
it("denies a blank window instead of blanking the opener", () => {
111134
for (const url of ["about:blank", ""]) {
112135
for (const disposition of ["new-window", "foreground-tab"] as const) {

0 commit comments

Comments
 (0)