Skip to content

Commit 1d26b3b

Browse files
authored
Preserve full URLs in Squad research output (#1998)
* fix(gh-aw): preserve research source URLs Allow the public Microsoft Learn and Aspire documentation domains through safe-output URL sanitization while retaining credential and sensitive-query safeguards. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f3bb47aa-1b45-4302-8ec2-5e3dc868de42 * test(gh-aw): tighten research URL guards Assert the exact safe-output domain allowlist, tolerate prompt line wrapping, and exclude safe-output metadata from operation max validation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7abb1583-79f9-4355-882d-a9d099f6817f --------- Copilot-Session: f3bb47aa-1b45-4302-8ec2-5e3dc868de42 Copilot-Session: 7abb1583-79f9-4355-882d-a9d099f6817f
1 parent 26d8950 commit 1d26b3b

3 files changed

Lines changed: 30 additions & 2 deletions

File tree

‎test/gh-aw-quality.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ describe('gh-aw: safe-output configuration', () => {
326326

327327
it('each safe-output has a max value that is a positive integer ≤ 1000', () => {
328328
for (const [name, config] of Object.entries(safeOutputs)) {
329-
if (name === 'data' || name === 'messages' || name === 'jobs') continue;
329+
if (name === 'data' || name === 'messages' || name === 'jobs' || name === 'allowed-domains') continue;
330330
expect(config.max, `${name} should have a max field`).toBeDefined();
331331
const max = config.max as number;
332332
expect(max, `${name}.max should be > 0`).toBeGreaterThan(0);

‎test/gh-aw-research-online.test.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,28 @@ describe('gh-aw: /squad research online-documentation capability', () => {
117117
expect(researchSkill).toContain('masquerade as one that consulted a source');
118118
});
119119

120+
it('preserves full public documentation URLs without weakening general URL sanitization', () => {
121+
const safeOutputsMatch = frontmatter.match(
122+
/^safe-outputs:\n((?:[ \t].*\n?)*)/m
123+
);
124+
expect(safeOutputsMatch, 'safe-outputs: block should exist in frontmatter').not.toBeNull();
125+
const allowedDomainsMatch = safeOutputsMatch![1].match(
126+
/^ allowed-domains:\n((?: - .+\n?)*)/m
127+
);
128+
expect(allowedDomainsMatch, 'safe-outputs.allowed-domains should exist').not.toBeNull();
129+
const allowedDomains = allowedDomainsMatch![1]
130+
.split('\n')
131+
.map(line => line.trim())
132+
.filter(line => line.startsWith('- '))
133+
.map(line => line.slice(2));
134+
expect(allowedDomains).toEqual(['learn.microsoft.com', 'aspire.dev']);
135+
expect(researchSkill).toMatch(/Preserve\s+each public documentation URL in full/);
136+
expect(researchSkill).toMatch(/do not replace the\s+path with `\/redacted`/);
137+
expect(researchSkill).toMatch(
138+
/Never include URL userinfo, credentials, access tokens,[\s\S]*secret-bearing query parameters/
139+
);
140+
});
141+
120142
it('lists Online sources as a required labeled section of the artifact', () => {
121143
// The structural contract MUST-contain list includes Online sources. Bound
122144
// the match to the enumeration SENTENCE (up to its terminating period) so it

‎workflows/squad.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ pre-agent-steps:
169169
SQUAD_CAST_VALIDATOR_RUNNER
170170
chmod 500 "$validator_runner"
171171
safe-outputs:
172+
allowed-domains:
173+
- learn.microsoft.com
174+
- aspire.dev
172175
messages:
173176
append-only-comments: true
174177
run-success: "🤖 [{workflow_name}]({run_url}) finished processing. This completion message does not indicate Cast success. For Cast, only a linked Cast pull request indicates success."
@@ -1464,7 +1467,10 @@ section MUST state exactly one status so a later reader or test can assert on it
14641467
instead of trusting silence:
14651468
14661469
- `Online sources: consulted` — followed by the list of URLs actually fetched
1467-
this run (each URL also appears as a citation in the evidence table); or
1470+
this run (each URL also appears as a citation in the evidence table). Preserve
1471+
each public documentation URL in full, including its path; do not replace the
1472+
path with `/redacted`. Never include URL userinfo, credentials, access tokens,
1473+
or secret-bearing query parameters; omit those sensitive parts instead; or
14681474
- `Online sources: unavailable — <reason>` — when no external documentation was
14691475
fetched, e.g. the network policy disallowed it, no external source was needed,
14701476
or a requested source-of-truth site was unreachable.

0 commit comments

Comments
 (0)