mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-20 03:12:28 +08:00
fix: content trust boundary markers in browse output
Wrap page-content commands (text, html, links, forms, accessibility, console, dialog, snapshot) with --- BEGIN/END UNTRUSTED EXTERNAL CONTENT --- markers. Covers direct commands (server.ts), chain sub-commands, and snapshot output (meta-commands.ts). Adds PAGE_CONTENT_COMMANDS set and wrapUntrustedContent() helper in commands.ts (single source of truth, DRY). Expands the SKILL.md trust warning with explicit processing rules for agents. Clears Snyk W011 (third-party content exposure). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -649,6 +649,13 @@ describe('Chain', () => {
|
||||
expect(result).toContain('[css]');
|
||||
});
|
||||
|
||||
test('chain wraps page-content sub-commands with trust markers', async () => {
|
||||
await handleWriteCommand('goto', [baseUrl + '/basic.html'], bm);
|
||||
const result = await handleMetaCommand('chain', ['text'], bm, async () => {});
|
||||
expect(result).toContain('BEGIN UNTRUSTED EXTERNAL CONTENT');
|
||||
expect(result).toContain('END UNTRUSTED EXTERNAL CONTENT');
|
||||
});
|
||||
|
||||
test('chain reports real error when write command fails', async () => {
|
||||
const commands = JSON.stringify([
|
||||
['goto', 'http://localhost:1/unreachable'],
|
||||
|
||||
Reference in New Issue
Block a user