Repository navigation
fix(providers): bound credential endpoints and responses #5244
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
Merged
thymikee
merged 19 commits into
fix/daybreak-daemon-boundaries
from
fix/daybreak-provider-boundaries
Dec 1, 2026
+245
−21
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
24f9b1e
fix(providers): bound credential endpoints and responses
thymikee e9c71d0
fix(providers): require origin fences for authenticated downloads
thymikee f3378ac
fix(providers): bound Limrun control responses
thymikee 53eaadb
fix(providers): satisfy response boundary gates
thymikee e1cfdf3
fix(providers): share response failure vocabulary
thymikee 2c503f0
fix(providers): cancel stalled Limrun response reads
thymikee 930a769
docs: regenerate provider response reasons
thymikee edbfdc0
chore(gates): refresh contracts export snapshot
thymikee 7bd574a
test(providers): narrow stalled response observation
thymikee 1e8387f
fix(providers): preserve observed Limrun rejection status
thymikee 03aa325
test(providers): await client-observed rejection body
thymikee bd04eb3
test(providers): observe retry conflict body seam
thymikee 8b7110c
fix(providers): keep response reason in existing closure
thymikee ba2d7f4
fix: preserve anonymous Limrun release redirects and BOM decoding
thymikee a2fa5bb
fix(providers): close credential and response boundaries
thymikee 80f1279
fix(contracts): keep response reasons in remote facade
thymikee 6d63706
docs(contracts): summarize provider response reason
thymikee 3ed35d7
fix(providers): narrow response bounds to buffered bodies
thymikee 2955f2b
fix(revyl): report oversized responses with shared reason
thymikee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import { expect, test } from 'vitest'; | ||
| import { readLimrunControlJson } from './limrun-http-response.ts'; | ||
|
|
||
| test('stops an oversized Limrun control response before accepting its body', async () => { | ||
| const response = new Response('{}', { | ||
|
thymikee marked this conversation as resolved.
Resolved
|
||
| headers: { 'content-length': String(32 * 1024 * 1024 + 1) }, | ||
| }); | ||
|
|
||
| await expect(readLimrunControlJson(response)).rejects.toMatchObject({ | ||
| code: 'COMMAND_FAILED', | ||
| details: { reason: 'provider_response_too_large', limitBytes: 32 * 1024 * 1024 }, | ||
| }); | ||
| }); | ||
|
|
||
| test('stops a streaming Limrun control response without a declared length', async () => { | ||
| const response = new Response( | ||
| new ReadableStream({ | ||
| start(controller) { | ||
| controller.enqueue(new Uint8Array(32 * 1024 * 1024 + 1)); | ||
| }, | ||
| }), | ||
| ); | ||
|
|
||
| await expect(readLimrunControlJson(response)).rejects.toMatchObject({ | ||
| code: 'COMMAND_FAILED', | ||
| details: { reason: 'provider_response_too_large', limitBytes: 32 * 1024 * 1024 }, | ||
| }); | ||
| }); | ||
|
|
||
| test('parses a bounded Limrun control response with a UTF-8 byte-order mark', async () => { | ||
| const response = new Response('\ufeff{"synced":true}'); | ||
| await expect(readLimrunControlJson(response)).resolves.toEqual({ synced: true }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import { AppError } from '@agent-device/kernel/errors'; | ||
| import { PROVIDER_RESPONSE_REASONS } from '@agent-device/contracts/remote'; | ||
|
|
||
| const MAX_LIMRUN_CONTROL_RESPONSE_BYTES = 32 * 1024 * 1024; | ||
|
|
||
| export async function readLimrunControlText( | ||
| response: Response, | ||
| signal?: AbortSignal, | ||
| ): Promise<string> { | ||
| signal?.throwIfAborted(); | ||
| const declaredBytes = Number(response.headers.get('content-length')); | ||
| if (Number.isFinite(declaredBytes) && declaredBytes > MAX_LIMRUN_CONTROL_RESPONSE_BYTES) { | ||
| await response.body?.cancel().catch(() => {}); | ||
| throw responseTooLarge(); | ||
|
thymikee marked this conversation as resolved.
Resolved
|
||
| } | ||
| if (!response.body) return ''; | ||
| const reader = response.body.getReader(); | ||
| const cancel = () => void reader.cancel(signal?.reason).catch(() => {}); | ||
| signal?.addEventListener('abort', cancel, { once: true }); | ||
| const chunks: Uint8Array[] = []; | ||
| let bytes = 0; | ||
| try { | ||
| while (true) { | ||
| const { done, value } = await reader.read(); | ||
| signal?.throwIfAborted(); | ||
| if (done) return new TextDecoder().decode(Buffer.concat(chunks, bytes)); | ||
| bytes += value.byteLength; | ||
| if (bytes > MAX_LIMRUN_CONTROL_RESPONSE_BYTES) { | ||
| throw responseTooLarge(); | ||
| } | ||
| chunks.push(value); | ||
| } | ||
| } finally { | ||
| signal?.removeEventListener('abort', cancel); | ||
| void reader.cancel().catch(() => {}); | ||
| } | ||
| } | ||
|
|
||
| function responseTooLarge(): AppError { | ||
| return new AppError('COMMAND_FAILED', 'Limrun response exceeds the size limit.', { | ||
| reason: PROVIDER_RESPONSE_REASONS.tooLarge.reason, | ||
| limitBytes: MAX_LIMRUN_CONTROL_RESPONSE_BYTES, | ||
| }); | ||
| } | ||
|
|
||
| export async function readLimrunControlJson<T>(response: Response): Promise<T> { | ||
| return JSON.parse(await readLimrunControlText(response)) as T; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.