Skip to content

Add integrity filtering notice to workflow footer#21749

Merged
pelikhan merged 10 commits intomainfrom
copilot/update-footer-for-tip-alert
Mar 19, 2026
Merged

Add integrity filtering notice to workflow footer#21749
pelikhan merged 10 commits intomainfrom
copilot/update-footer-for-tip-alert

Conversation

Copy link
Contributor

Copilot AI commented Mar 19, 2026

When integrity filtering (DIFC) filters tool calls during workflow execution, there's no indication of this in the created item's footer. This adds a [!NOTE] alert—matching the style of the existing firewall blocked-domains notice—that surfaces filtered items with GitHub references and an explanation. Duplicate filtered events (the same item filtered multiple times) are collapsed into a single entry. The notice is placed before the attribution footer line, alongside the firewall notice.

Changes

  • gateway_difc_filtered.cjs (new) — standalone module mirroring firewall_blocked_domains.cjs:

    • parseDifcFilteredEvents — extracts DIFC_FILTERED entries from JSONL content
    • getDifcFilteredEvents — reads gateway.jsonl (falls back to rpc-messages.jsonl)
    • generateDifcFilteredSection — renders a [!NOTE] alert with collapsed <details> listing linked GitHub references (#number or full URL) and the filter reason; deduplicates events by composite key before rendering; limits the rendered list to the first 16 unique items, appending ... and N more item(s) for any remainder
  • messages_footer.cjs — calls getDifcFilteredEvents / generateDifcFilteredSection in generateFooterWithMessages; the notice is placed before the attribution footer line (alongside the firewall notice), wrapped in try/catch to ensure the rest of the footer is always preserved

  • actions/setup/setup.sh — adds gateway_difc_filtered.cjs to SAFE_OUTPUTS_FILES so it is deployed at runtime

  • gateway_difc_filtered.test.cjs (new) — 25 tests covering parsing, file-read fallback, section rendering edge cases, deduplication, and item truncation

Example output

> [!NOTE]
> <details>
> <summary>🔒 Integrity filtering filtered 20 items</summary>
>
> Integrity filtering activated and filtered the following items during workflow execution.
> This happens when a tool call accesses a resource that does not meet the required integrity or secrecy level of the workflow.
>
> - [#42](https://github.com/org/repo/issues/42) (`list_issues`: Integrity check failed, missingTags=[...])
> - [#99](https://github.com/org/repo/issues/99) (`get_issue`: Secrecy check failed)
> - ... (14 more items)
> - ... and 4 more items
>
> </details>
Original prompt

Update the JavaScript code that generates the footer for the body of a created item such that it mentions if the github guard activated and reported DIFC_FILTERED items.

If filtered items are found in the gateway, create a tip alert with a collapsed details section with GitHub references to the items and an explanation on why this happened.

This is similar to the firewall notice added to the footer. Use the same style.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.



✨ PR Review Safe Output Test - Run 23294171163

💥 [THE END] — Illustrated by Smoke Claude ·

Tip

🔒 GitHub Guard filtered 4 items

The GitHub Guard activated and filtered the following items during workflow execution.
This happens when a tool call accesses a resource that does not meet the required integrity or secrecy level of the workflow.



✨ PR Review Safe Output Test - Run 23295134401

💥 [THE END] — Illustrated by Smoke Claude ·

Note

🔒 GitHub Guard filtered 2 items

The GitHub Guard activated and filtered the following items during workflow execution.
This happens when a tool call accesses a resource that does not meet the required integrity or secrecy level of the workflow.



✨ PR Review Safe Output Test - Run 23295336186

💥 [THE END] — Illustrated by Smoke Claude ·



✨ PR Review Safe Output Test - Run 23296588401

💥 [THE END] — Illustrated by Smoke Claude ·

Note

🔒 GitHub Guard filtered 1 item

The GitHub Guard activated and filtered the following item during workflow execution.
This happens when a tool call accesses a resource that does not meet the required integrity or secrecy level of the workflow.

Create gateway_difc_filtered.cjs module that reads DIFC_FILTERED events
from MCP gateway logs (gateway.jsonl / rpc-messages.jsonl) and generates
a GitHub tip alert section for inclusion in workflow footers.

Update messages_footer.cjs to call getDifcFilteredEvents() /
generateDifcFilteredSection() inside generateFooterWithMessages(),
following the same style as the existing firewall blocked domains notice.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update footer to include GitHub guard notices Add GitHub Guard DIFC filtered items notice to workflow footer Mar 19, 2026
Copilot AI requested a review from pelikhan March 19, 2026 06:28
@pelikhan pelikhan marked this pull request as ready for review March 19, 2026 06:39
Copilot AI review requested due to automatic review settings March 19, 2026 06:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new footer notice that surfaces when GitHub Guard (DIFC) filtered tool-call items during workflow execution, mirroring the existing firewall blocked-domains footer style.

Changes:

  • Introduces a new gateway_difc_filtered.cjs module to parse DIFC_FILTERED events from MCP gateway JSONL logs and render a [!TIP] alert section.
  • Updates messages_footer.cjs to append the DIFC filtered-items section after the firewall section when events are present.
  • Adds a dedicated Vitest suite covering parsing, file fallback behavior, and rendering edge cases.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
actions/setup/js/messages_footer.cjs Appends the new DIFC filtered-items footer section during footer generation.
actions/setup/js/gateway_difc_filtered.cjs Implements JSONL parsing + log reading fallback + markdown rendering for the new notice.
actions/setup/js/gateway_difc_filtered.test.cjs Adds unit tests for parsing, reading behavior, and rendered output formatting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +21 to +36
function parseDifcFilteredEvents(jsonlContent) {
const filteredEvents = [];
const lines = jsonlContent.split("\n");
for (const line of lines) {
const trimmed = line.trim();
if (!trimmed || !trimmed.includes("DIFC_FILTERED")) continue;
try {
const entry = JSON.parse(trimmed);
if (entry.type === "DIFC_FILTERED") {
filteredEvents.push(entry);
}
} catch {
// skip malformed lines
}
}
return filteredEvents;
Comment on lines +305 to +310
// Add GitHub Guard DIFC filtered section if any items were filtered
const difcFilteredEvents = getDifcFilteredEvents();
const difcFilteredSection = generateDifcFilteredSection(difcFilteredEvents);
if (difcFilteredSection) {
footer += difcFilteredSection;
}
Comment on lines +96 to +106
for (const event of filteredEvents) {
let reference;
if (event.html_url) {
const label = event.number ? `#${event.number}` : event.html_url;
reference = `[${label}](${event.html_url})`;
} else {
reference = event.description || (event.tool_name ? `\`${event.tool_name}\`` : "-");
}
const tool = event.tool_name ? `\`${event.tool_name}\`` : "-";
const reason = (event.reason || "-").replace(/\n/g, " ");
section += `> - ${reference} (${tool}: ${reason})\n`;
@pelikhan
Copy link
Contributor

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 19, 2026

@copilot fix https://github.com/github/gh-aw/actions/runs/23282776656/job/67700523227

Fixed in 0e98394. gateway_difc_filtered.cjs was a new transitive dependency of safe-outputs-mcp-server.cjs (via messages_footer.cjs) but was missing from SAFE_OUTPUTS_FILES in setup.sh. Added it there.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 19, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions
Copy link
Contributor

github-actions bot commented Mar 19, 2026

✅ All tools validated successfully! Agent Container Smoke Test confirms agent container is ready.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 19, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions github-actions bot removed the smoke label Mar 19, 2026
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

Smoke Test Results — Run §23294171211

Test
GitHub MCP
MCP Scripts GH CLI
Serena MCP
Playwright
Web Fetch
File Writing
Bash Tool
Discussion Interaction
Build gh-aw
Discussion Creation
Workflow Dispatch
PR Review

Overall: ⚠️ PARTIAL PASS (Serena MCP not available)
PR Author: @pelikhan · Assignees: @pelikhan, @Copilot

📰 BREAKING: Report filed by Smoke Copilot ·

Tip

🔒 GitHub Guard filtered 5 items

The GitHub Guard activated and filtered the following items during workflow execution.
This happens when a tool call accesses a resource that does not meet the required integrity or secrecy level of the workflow.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed gateway DIFC filtered events implementation. Clean, well-tested module with good separation of concerns. Left 2 minor suggestions around performance optimization and explicit path passing. No blocking issues.

📰 BREAKING: Report filed by Smoke Copilot

Tip

🔒 GitHub Guard filtered 5 items

The GitHub Guard activated and filtered the following items during workflow execution.
This happens when a tool call accesses a resource that does not meet the required integrity or secrecy level of the workflow.

  • pr:#21749 (pull_request_read: Resource 'pr:#21749' has lower integrity than agent requires. Agent would need to drop integrity tags [unapproved:all approved:all] to trust this resource.)
  • pr:#21749 (pull_request_read: Resource 'pr:#21749' has lower integrity than agent requires. Agent would need to drop integrity tags [unapproved:all approved:all] to trust this resource.)
  • pr:#21749 (pull_request_read: Resource 'pr:#21749' has lower integrity than agent requires. Agent would need to drop integrity tags [unapproved:all approved:all] to trust this resource.)
  • pr:#21749 (pull_request_read: Resource 'pr:#21749' has lower integrity than agent requires. Agent would need to drop integrity tags [unapproved:all approved:all] to trust this resource.)
  • pr:#21749 (pull_request_read: Resource 'pr:#21749' has lower integrity than agent requires. Agent would need to drop integrity tags [unapproved:all approved:all] to trust this resource.)

// Add GitHub Guard DIFC filtered section if any items were filtered
const difcFilteredEvents = getDifcFilteredEvents();
const difcFilteredSection = generateDifcFilteredSection(difcFilteredEvents);
if (difcFilteredSection) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This calls getDifcFilteredEvents() with no arguments, relying on the default paths. Consider passing the paths explicitly (or deriving them from the workflow context) to make it easier to test and to support custom log locations in the future.

try {
const entry = JSON.parse(trimmed);
if (entry.type === "DIFC_FILTERED") {
filteredEvents.push(entry);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The early-exit check !trimmed.includes("DIFC_FILTERED") is a nice optimization to skip JSON parsing on irrelevant lines. Consider also checking for the opening brace trimmed.startsWith("{") to skip non-JSON lines even faster before the includes check.

@github-actions github-actions bot removed the smoke label Mar 19, 2026
@github-actions
Copy link
Contributor

Agent Container Tool Check

Tool Status Version
bash 5.2.21
sh available
git 2.53.0
jq 1.7
yq 4.52.4
curl 8.5.0
gh 2.87.3
node 20.20.1
python3 3.12.3
go 1.24.13
java 21.0.10
dotnet 10.0.102

Result: 12/12 tools available ✅

Overall Status: PASS

🔧 Tool validation by Agent Container Smoke Test ·

@github-actions
Copy link
Contributor

🤖 Smoke Test: Copilot - 23296588438\n\n| Test | Status |\n|------|--------|\n| GitHub MCP | ✅ |\n| MCP Scripts GH CLI | ✅ |\n| Serena MCP | ❌ |\n| Playwright | ✅ |\n| Web Fetch | ✅ |\n| File Writing | ✅ |\n| Bash Tool | ✅ |\n| Discussion Interaction | ✅ |\n| Build gh-aw | ✅ |\n| Discussion Creation | ✅ |\n| Workflow Dispatch | ✅ |\n| PR Review | ✅ |\n\nOverall: ⚠️ PARTIAL PASS (11/12 — Serena MCP unavailable)\n\nPR by @app/copilot-swe-agent · Assignees: @pelikhan, @Copilot

📰 BREAKING: Report filed by Smoke Copilot ·

Note

🔒 GitHub Guard filtered 1 item

The GitHub Guard activated and filtered the following item during workflow execution.
This happens when a tool call accesses a resource that does not meet the required integrity or secrecy level of the workflow.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the DIFC filtered items footer feature. Code is clean and well-tested. Two minor suggestions: safer deduplication key separator and debug logging in the silent catch. Overall looks good! 🔒

📰 BREAKING: Report filed by Smoke Copilot

Note

🔒 GitHub Guard filtered 1 item

The GitHub Guard activated and filtered the following item during workflow execution.
This happens when a tool call accesses a resource that does not meet the required integrity or secrecy level of the workflow.

  • pr:#21749 (pull_request_read: Resource 'pr:#21749' has lower integrity than agent requires. Agent would need to drop integrity tags [unapproved:all approved:all] to trust this resource.)

// Deduplicate events by their significant fields
const seen = new Set();
const uniqueEvents = filteredEvents.filter(event => {
const key = [event.html_url || "", event.tool_name || "", event.description || "", event.reason || ""].join("|");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deduplication key includes all four fields joined by |. If any of these fields contain a | character, it could cause false negatives (different events treated as duplicates). Consider using a safer separator like \0 (null byte) or JSON serialization for the key.

if (difcFilteredSection) {
footer += difcFilteredSection;
}
} catch {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The silent catch {} here prevents DIFC errors from surfacing. Consider adding at least core.debug() logging so errors are visible in Actions debug output without breaking the footer generation.

@github-actions
Copy link
Contributor

Smoke test (Codex engine)
PR titles:

  • Move reaction step after generate_aw_info for faster user feedback
  • Fix compiler step name inconsistencies: plural "Safe Outputs" and "Install Codex CLI"
    GitHub MCP: ✅
    Serena MCP: ✅
    Playwright: ✅
    Web-fetch: ✅
    File write + bash cat: ✅
    Build gh-aw: ✅
    Overall status: PASS

🔮 The oracle has spoken through Smoke Codex ·

Warning

⚠️ Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • ab.chatgpt.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "ab.chatgpt.com"

See Network Configuration for more information.

@github-actions
Copy link
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions
Copy link
Contributor

💥 Smoke Test Run 23296588401 — Claude engine results:

Core (#1-11) PR Review (#12-18)
✅✅✅✅✅✅✅✅✅✅✅ ✅✅✅✅⚠️✅✅⚠️

Overall: PARTIAL (tests #15 and #18 skipped — no threads/safe PRs)

💥 [THE END] — Illustrated by Smoke Claude ·

Note

🔒 GitHub Guard filtered 1 item

The GitHub Guard activated and filtered the following item during workflow execution.
This happens when a tool call accesses a resource that does not meet the required integrity or secrecy level of the workflow.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💥 Automated smoke test review - all systems nominal!

💥 [THE END] — Illustrated by Smoke Claude

Note

🔒 GitHub Guard filtered 1 item

The GitHub Guard activated and filtered the following item during workflow execution.
This happens when a tool call accesses a resource that does not meet the required integrity or secrecy level of the workflow.

  • pr:#21749 (pull_request_read: Resource 'pr:#21749' has lower integrity than agent requires. Agent would need to drop integrity tags [unapproved:all approved:all] to trust this resource.)


const fs = require("fs");

const GATEWAY_JSONL_PATH = "/tmp/gh-aw/mcp-logs/gateway.jsonl";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded path /tmp/gh-aw/mcp-logs/gateway.jsonl looks good for the CI environment. Consider making this configurable via an environment variable for flexibility in different deployment contexts.


// Add GitHub Guard DIFC filtered section if any items were filtered
try {
const difcFilteredEvents = getDifcFilteredEvents();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DIFC filtered events are retrieved and rendered here — wrapping this in a try/catch (as done in the parent function) is a good defensive pattern. The early return on empty difcFilteredSection keeps the output clean.

@pelikhan
Copy link
Contributor

@copilot the note should be inserted BEFORE the footer (near the firewall note)

…erateFooterWithMessages

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 19, 2026

@copilot the note should be inserted BEFORE the footer (near the firewall note)

Fixed in c7481a3. Both the firewall and DIFC guard notices are now collected first and prepended before the attribution footer line (getFooterMessage), so they appear before "Generated by..." / "Illustrated by..." in the rendered output. The new rendering order is:

  1. 🔒 Firewall blocked-domains notice (if any)
  2. 🔒 GitHub Guard DIFC filtered notice (if any)
  3. Attribution footer (> Generated by [workflow]...)
  4. Install instructions (if any)
  5. Missing-info sections (if any)
  6. XML traceability marker

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/github/gh-aw/contents/.github%2Fworkflows%2Faudit-workflows.md
    • Triggering command: /opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --conditions node --conditions development --experimental-import-meta-resolve --require /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/suppress-warnings.cjs /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/dist/workers/forks.js c1266852^ 64/bin/git git add . git it --reverse nch tions/setup/js/n--reverse git (http block)
  • invalid.example.invalid
    • Triggering command: /usr/lib/git-core/git-remote-https /usr/lib/git-core/git-remote-https origin https://invalid.example.invalid/nonexistent-repo.git e/git init�� de/node/bin/git git tions/setup/js/node_modules/.bin/git user.email test@example.comcheckout /git git bran�� -M main k/gh-aw/gh-aw/actions/setup/js/node_modules/.bin/git /tmp/bare-incremgit gin/feature-branadd cal/bin/git git (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@pelikhan
Copy link
Contributor

@copilot rename "github guard DIFC" to "Integrity filtering"

…xt and tests

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 19, 2026

@copilot rename "github guard DIFC" to "Integrity filtering"

Done in bfe900e. All user-facing references renamed:

  • Summary: 🔒 Integrity filtering filtered N item(s)
  • Body: Integrity filtering activated and filtered the following item(s) during workflow execution.
  • Code comment in messages_footer.cjs updated accordingly
  • Test assertions updated to match

Copilot AI changed the title Add GitHub Guard DIFC filtered items notice to workflow footer Add integrity filtering notice to workflow footer Mar 19, 2026
@pelikhan
Copy link
Contributor

@copilot only show the first 16 filtered items, and ellipse the rest.

… rest

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 19, 2026

@copilot only show the first 16 filtered items, and ellipse the rest.

Done in 1a17129. After deduplication, only the first 16 unique items are rendered. If more remain, a trailing line > - ... and N more item(s) is appended. The summary count still reflects the full total. Three new tests cover: >16 items truncated correctly, ≤16 items no ellipsis, and singular/plural form of the ellipsis line.

@pelikhan pelikhan merged commit c87436d into main Mar 19, 2026
47 of 48 checks passed
@pelikhan pelikhan deleted the copilot/update-footer-for-tip-alert branch March 19, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants