Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d35592b
merge dev into main for the v2.32.1 release
lidge-jun Aug 25, 2026
71c57ea
release: v2.32.1
lidge-jun Aug 25, 2026
d560ac6
merge dev into main for the v2.33.0 release
lidge-jun Aug 25, 2026
08ada6f
Merge pull request #2553 from lidge-jun/codex/promote-main-2330
lidge-jun Aug 25, 2026
ec51e42
release: v2.33.0
lidge-jun Aug 25, 2026
e25b653
merge dev into main for the v2.34.0 release
lidge-jun Aug 27, 2026
80fff9a
Merge pull request #2760 from lidge-jun/codex/promote-main-2340
lidge-jun Aug 27, 2026
fc4de77
Merge pull request #2826 from lidge-jun/codex/promote-main-2350
lidge-jun Aug 28, 2026
c7d8407
Merge pull request #3002 from lidge-jun/codex/promote-main-2360
lidge-jun Aug 30, 2026
54e2274
Merge pull request #3037 from lidge-jun/codex/promote-main-2370
lidge-jun Aug 31, 2026
2c4dca1
merge dev into the promotion branch for v2.38.0
lidge-jun Aug 31, 2026
a34e8b7
merge dev into the promotion branch for v2.38.0 (picks up the ReDoS fix)
lidge-jun Aug 31, 2026
ebb4d55
Merge pull request #3073 from lidge-jun/codex/promote-main-2380
lidge-jun Aug 31, 2026
682112e
Merge remote-tracking branch 'origin/dev' into codex/promote-main-2390
lidge-jun Sep 1, 2026
af6113a
merge dev into main for the v2.39.0 release
lidge-jun Sep 1, 2026
847f4f1
merge dev into main for the v2.40.0 release
Sep 2, 2026
ac78647
Merge pull request #3261 from lidge-jun/codex/promote-main-2400
lidge-jun Sep 2, 2026
aaa9eaf
fix(release): pass the bump job's permissions through the reusable-wo…
lidge-jun Sep 2, 2026
35ff3a4
Merge pull request #3263 from lidge-jun/codex/promote-main-2400-relfix
lidge-jun Sep 2, 2026
75867f0
fix(service): bind scheduler action principal to current user
luvs01 Sep 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ jobs:
bump-dev-version:
needs: publish
if: ${{ inputs.dry-run != true }}
# A reusable-workflow CALL cannot grant the callee more than the calling job holds,
# and GitHub refuses the whole run at startup when the called workflow's own job
# declares permissions the caller did not pass down ("startup_failure", runs
# 33615174183 / 33615177849 — the first dispatches since #3129 wired this call).
# The callee's job declares exactly these two; nothing else in this file gains them.
permissions:
contents: write
pull-requests: write
uses: ./.github/workflows/dev-version-bump.yml
with:
released-version: v${{ inputs.version }}
Expand Down
19 changes: 18 additions & 1 deletion src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1871,7 +1871,7 @@ export function buildWindowsTaskXml(
</Triggers>
<Principals>
<Principal id="Author">
<LogonType>InteractiveToken</LogonType>
${sessionTriggerUserId ? `<UserId>${taskXmlString(sessionTriggerUserId)}</UserId>\n ` : ""}<LogonType>InteractiveToken</LogonType>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
Expand Down Expand Up @@ -2136,6 +2136,18 @@ function windowsTaskTriggerScopeAcceptable(
return expectedValues.some(value => taskXmlDecodedValueEquals(element, "UserId", value));
}

/** The account whose interactive token executes the action must be the current account. */
function windowsTaskPrincipalScopeAcceptable(
principal: string,
expectedUserId: ExpectedWindowsTaskUserId | undefined,
): boolean {
if (taskXmlHasPrefixedTag(principal, "UserId")) return false;
if (taskXmlElementCount(principal, "UserId") !== 1) return false;
if (expectedUserId === undefined) return false;
const expectedValues = typeof expectedUserId === "string" ? [expectedUserId] : expectedUserId;
return expectedValues.some(value => taskXmlDecodedValueEquals(principal, "UserId", value));
}

/** Validate the stable OpenCodex action, principal, settings, and logon trigger. */
function windowsTaskRegistrationBaseHealthy(
xml: string,
Expand Down Expand Up @@ -2187,7 +2199,12 @@ export function windowsTaskRegistrationHealthy(
): boolean {
const scrubbed = taskXmlWithoutCommentsAndCdata(xml);
const triggers = taskXmlSection(scrubbed, "Triggers");
const principal = taskXmlSection(scrubbed, "Principal");
return windowsTaskRegistrationBaseHealthy(xml, wscript, launcher)
// The trigger scope says whose session event fires the task; Principal/UserId
// independently says whose interactive token executes its action. Both are
// identity boundaries and must match exactly, even when action paths are lossy.
&& windowsTaskPrincipalScopeAcceptable(principal, expectedUserId ?? undefined)
// Without these the task can only recover at the next logon, so a disconnected session
// leaves the proxy down indefinitely. Treating their absence as unhealthy is what lets
// an already-registered task from an older install get repaired instead of staying broken.
Expand Down
15 changes: 15 additions & 0 deletions tests/service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,21 @@ describe("Windows service task", () => {
expect(healthy("C:\\Users\\Admin\\.opencodex\\service-launcher.vbs")).toBe(false);
});

test("rejects a lossy foreign action even when its triggers name the current account", () => {
const victimSid = "S-1-5-21-111-222-333-1001";
const attackerSid = "S-1-5-21-111-222-333-1002";
const foreign = buildWindowsTaskXml(
"ignored.cmd",
"C:\\Users\\???\\.opencodex\\service-launcher.vbs",
undefined,
victimSid,
)
.replace(/<Command>.*?<\/Command>/, `<Command>${wscript}</Command>`)
.replace(`<UserId>${victimSid}</UserId>\n <LogonType>`, `<UserId>${attackerSid}</UserId>\n <LogonType>`);

expect(windowsTaskRegistrationHealthy(foreign, wscript, launcher, victimSid)).toBe(false);
});

test("rejects a path whose ASCII structure differs", () => {
expect(healthy("C:\\Users\\???\\.opencodex\\other-launcher.vbs")).toBe(false);
expect(healthy("D:\\Users\\???\\.opencodex\\service-launcher.vbs")).toBe(false);
Expand Down
Loading