Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions .changeset/patch-mention-filtering-refactor.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

547 changes: 485 additions & 62 deletions .github/workflows/ai-moderator.lock.yml

Large diffs are not rendered by default.

684 changes: 550 additions & 134 deletions .github/workflows/archie.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/artifacts-summary.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/audit-workflows.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/blog-auditor.lock.yml

Large diffs are not rendered by default.

684 changes: 550 additions & 134 deletions .github/workflows/brave.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/breaking-change-checker.lock.yml

Large diffs are not rendered by default.

684 changes: 550 additions & 134 deletions .github/workflows/changeset.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/ci-coach.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/ci-doctor.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/cli-consistency-checker.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/cli-version-checker.lock.yml

Large diffs are not rendered by default.

684 changes: 550 additions & 134 deletions .github/workflows/cloclo.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/close-old-discussions.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/commit-changes-analyzer.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/copilot-agent-analysis.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/copilot-pr-merged-report.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/copilot-pr-nlp-analysis.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/copilot-pr-prompt-analysis.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/copilot-session-insights.lock.yml

Large diffs are not rendered by default.

684 changes: 550 additions & 134 deletions .github/workflows/craft.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/daily-assign-issue-to-user.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/daily-code-metrics.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/daily-copilot-token-report.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/daily-doc-updater.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/daily-fact.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/daily-file-diet.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/daily-firewall-report.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/daily-issues-report.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/daily-malicious-code-scan.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/daily-multi-device-docs-tester.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/daily-news.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/daily-performance-summary.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/daily-repo-chronicle.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/daily-team-status.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/daily-workflow-updater.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/deep-report.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/dependabot-go-checker.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/dev-hawk.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/dev.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/developer-docs-consolidator.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/dictation-prompt.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/docs-noob-tester.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/duplicate-code-detector.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/example-workflow-analyzer.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/github-mcp-structural-analysis.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/github-mcp-tools-report.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/glossary-maintainer.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/go-fan.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/go-file-size-reduction.campaign.g.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/go-logger.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/go-pattern-detector.lock.yml

Large diffs are not rendered by default.

684 changes: 550 additions & 134 deletions .github/workflows/grumpy-reviewer.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/hourly-ci-cleaner.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/human-ai-collaboration.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/incident-response.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/instructions-janitor.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/intelligence.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/issue-arborist.lock.yml

Large diffs are not rendered by default.

684 changes: 550 additions & 134 deletions .github/workflows/issue-classifier.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/issue-monster.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/issue-triage-agent.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/layout-spec-maintainer.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/lockfile-stats.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/mcp-inspector.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/mergefest.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/notion-issue-summary.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/org-health-report.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/org-wide-rollout.lock.yml

Large diffs are not rendered by default.

684 changes: 550 additions & 134 deletions .github/workflows/pdf-summary.lock.yml

Large diffs are not rendered by default.

684 changes: 550 additions & 134 deletions .github/workflows/plan.lock.yml

Large diffs are not rendered by default.

684 changes: 550 additions & 134 deletions .github/workflows/poem-bot.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/portfolio-analyst.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/pr-nitpick-reviewer.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/prompt-clustering-analysis.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/python-data-charts.lock.yml

Large diffs are not rendered by default.

684 changes: 550 additions & 134 deletions .github/workflows/q.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/release.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/repo-tree-map.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/repository-quality-improver.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/research.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/safe-output-health.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/schema-consistency-checker.lock.yml

Large diffs are not rendered by default.

684 changes: 550 additions & 134 deletions .github/workflows/scout.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/security-compliance.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/security-fix-pr.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/semantic-function-refactor.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/smoke-claude.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/smoke-codex.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/smoke-copilot-no-firewall.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/smoke-copilot-playwright.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/smoke-copilot-safe-inputs.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/smoke-copilot.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/smoke-detector.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/smoke-srt.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/spec-kit-execute.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/spec-kit-executor.lock.yml

Large diffs are not rendered by default.

684 changes: 550 additions & 134 deletions .github/workflows/speckit-dispatcher.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/stale-repo-identifier.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/static-analysis-report.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/super-linter.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/technical-doc-writer.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/test-discussion-expires.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/test-hide-older-comments.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/test-python-safe-input.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/tidy.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/typist.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/unbloat-docs.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/video-analyzer.lock.yml

Large diffs are not rendered by default.

547 changes: 485 additions & 62 deletions .github/workflows/weekly-issue-summary.lock.yml

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions pkg/workflow/js.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,15 @@ var safeOutputsToolsLoaderScript string
//go:embed js/safe_outputs_bootstrap.cjs
var safeOutputsBootstrapScript string

//go:embed js/resolve_mentions_from_payload.cjs
var resolveMentionsFromPayloadScript string

//go:embed js/sanitize_incoming_text.cjs
var sanitizeIncomingTextScript string

//go:embed js/sanitize_content_core.cjs
var sanitizeContentCoreScript string

// GetJavaScriptSources returns a map of all embedded JavaScript sources
// The keys are the relative paths from the js directory
func GetJavaScriptSources() map[string]string {
Expand Down Expand Up @@ -344,6 +353,9 @@ func GetJavaScriptSources() map[string]string {
"safe_outputs_tools.json": safeOutputsToolsJSON,
"safe_outputs_bootstrap.cjs": safeOutputsBootstrapScript,
"safe_outputs_mcp_server.cjs": safeOutputsMCPServerScriptSource,
"resolve_mentions_from_payload.cjs": resolveMentionsFromPayloadScript,
"sanitize_incoming_text.cjs": sanitizeIncomingTextScript,
"sanitize_content_core.cjs": sanitizeContentCoreScript,
"add_copilot_reviewer.cjs": addCopilotReviewerScriptSource,
"add_reaction_and_edit_comment.cjs": addReactionAndEditCommentScriptSource,
"assign_issue.cjs": assignIssueScriptSource,
Expand Down
13 changes: 9 additions & 4 deletions pkg/workflow/js/collect_ndjson_output.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ async function main() {
MAX_BODY_LENGTH: maxBodyLength,
resetValidationConfigCache,
} = require("./safe_output_type_validator.cjs");
const { resolveAllowedMentionsFromPayload } = require("./resolve_mentions_from_payload.cjs");

// Resolve allowed mentions for the output collector
// This determines which @mentions are allowed in the agent output
const allowedMentions = await resolveAllowedMentionsFromPayload(context, github, core);

// Load validation config from file and set it in environment for the validator to read
const validationConfigPath = process.env.GH_AW_VALIDATION_CONFIG_PATH || "/tmp/gh-aw/safeoutputs/validation.json";
Expand Down Expand Up @@ -87,7 +92,7 @@ async function main() {
error: `Line ${lineNum}: ${fieldName} must be a string`,
};
}
normalizedValue = sanitizeContent(value);
normalizedValue = sanitizeContent(value, { allowedAliases: allowedMentions });
break;
case "boolean":
if (typeof value !== "boolean") {
Expand Down Expand Up @@ -118,11 +123,11 @@ async function main() {
error: `Line ${lineNum}: ${fieldName} must be one of: ${inputSchema.options.join(", ")}`,
};
}
normalizedValue = sanitizeContent(value);
normalizedValue = sanitizeContent(value, { allowedAliases: allowedMentions });
break;
default:
if (typeof value === "string") {
normalizedValue = sanitizeContent(value);
normalizedValue = sanitizeContent(value, { allowedAliases: allowedMentions });
}
break;
}
Expand Down Expand Up @@ -263,7 +268,7 @@ async function main() {

// Use the validation engine to validate the item
if (hasValidationConfig(itemType)) {
const validationResult = validateItem(item, itemType, i + 1);
const validationResult = validateItem(item, itemType, i + 1, { allowedAliases: allowedMentions });
if (!validationResult.isValid) {
if (validationResult.error) {
errors.push(validationResult.error);
Expand Down
22 changes: 22 additions & 0 deletions pkg/workflow/js/collect_ndjson_output.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,28 @@ describe("collect_ndjson_output.cjs", () => {
};
global.core = mockCore;

// Mock context and github for the helper function
global.context = {
eventName: "issues",
actor: "test-actor",
repo: {
owner: "test-owner",
repo: "test-repo",
},
payload: {},
};

global.github = {
rest: {
repos: {
listCollaborators: vi.fn().mockResolvedValue({ data: [] }),
},
users: {
getByUsername: vi.fn(),
},
},
};

// Read the script file
const scriptPath = path.join(__dirname, "collect_ndjson_output.cjs");
collectScript = fs.readFileSync(scriptPath, "utf8");
Expand Down
25 changes: 6 additions & 19 deletions pkg/workflow/js/compute_text.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* @param {string} content - The content to sanitize
* @returns {string} The sanitized content
*/
const { sanitizeContent, writeRedactedDomainsLog } = require("./sanitize_content.cjs");
const { isPayloadUserBot, resolveMentionsLazily } = require("./resolve_mentions.cjs");
const { sanitizeIncomingText, writeRedactedDomainsLog } = require("./sanitize_incoming_text.cjs");
const { isPayloadUserBot } = require("./resolve_mentions.cjs");

async function main() {
let text = "";
Expand Down Expand Up @@ -267,23 +267,10 @@ async function main() {
break;
}

// Resolve mentions lazily using the new helper
const mentionResult = await resolveMentionsLazily(text, knownAuthors, owner, repo, github, core);

// Log known authors for debugging
if (knownAuthors.length > 0) {
core.info(`Known authors (from payload): ${knownAuthors.join(", ")}`);
}

// Log allowed mentions for documentation
if (mentionResult.allowedMentions.length > 0) {
core.info(`Allowed mentions (will not be escaped): ${mentionResult.allowedMentions.join(", ")}`);
} else {
core.info("No allowed mentions configured - all mentions will be escaped");
}

// Sanitize the text before output, passing the known authors
const sanitizedText = sanitizeContent(text, { allowedAliases: mentionResult.allowedMentions });
// Sanitize the text before output using slimmed-down sanitizer
// Note: Mention filtering is NOT applied here - all mentions are escaped
// Mention filtering will be applied by the agent output collector
const sanitizedText = sanitizeIncomingText(text);

// Display sanitized text in logs
core.info(`text: ${sanitizedText}`);
Expand Down
Loading