Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

fix(plugin): request fields when reading back GitHub issues (#2048)

Michael D'Angeloa4107f2eee5e
diff --git a/plugins/codex-security/skills/track-findings/SKILL.md b/plugins/codex-security/skills/track-findings/SKILL.md
index 1cd134dca..5d65fd9be 100644
--- a/plugins/codex-security/skills/track-findings/SKILL.md
+++ b/plugins/codex-security/skills/track-findings/SKILL.md
@@ -89,7 +89,7 @@ A successful provider response establishes an accepted write. Immediately call `
After recording an accepted write, read the returned object through the same transport when possible to check identity and changed fields, allowing provider formatting that preserves meaning and links. Record the same receipt again with `readback: {status: "verified"}` or `{status: "failed", error}`; omit readback when no read was attempted. A current read confirming reuse can be recorded as verified immediately. Keep accepted writes and read failures distinct. An unreadable issue does not authorize another create.
-For CLI issue writes, put the approved body in a mode-`0600` temporary file outside the repository and scan bundle, arrange cleanup on every exit, and pass it to one `gh issue create` or `gh issue edit`. Never print the file. Capture the issue identity and read it with `gh issue view --json`. Use the advisory reference for JSON file creation and required readback.
+For CLI issue writes, put the approved body in a mode-`0600` temporary file outside the repository and scan bundle, arrange cleanup on every exit, and pass it to one `gh issue create` or `gh issue edit`. Never print the file. Capture the returned issue URL as `issue_url` and read it with `gh issue view "$issue_url" --json number,url,title,body`. Append the JSON fields for any other metadata in the approved write, such as `labels` or `assignees`. Use the advisory reference for JSON file creation and required readback.
If a mutation fails or times out and may have succeeded, reconcile through exact reads or binding searches before any retry. Stop if the result remains uncertain. After an interrupted batch, reconcile receipts and current reads for completed items, then validate and check duplicates for the remaining items. Keep approval when the remaining writes and destination are unchanged.
diff --git a/plugins/codex-security/tests/test_track_findings_skill.py b/plugins/codex-security/tests/test_track_findings_skill.py
index ae473fb23..1e6e8d63f 100644
--- a/plugins/codex-security/tests/test_track_findings_skill.py
+++ b/plugins/codex-security/tests/test_track_findings_skill.py
@@ -2,6 +2,7 @@ from __future__ import annotations
import json
import re
+import shlex
import unittest
from pathlib import Path
@@ -23,6 +24,19 @@ class TrackFindingsSkillTest(unittest.TestCase):
plugin = json.loads(PLUGIN_MANIFEST.read_text(encoding="utf-8"))
self.assertEqual(plugin["apps"], "./.app.json")
+ def test_github_cli_readback_uses_the_returned_issue_and_reviewed_content(self) -> None:
+ skill = (PLUGIN_ROOT / "skills/track-findings/SKILL.md").read_text(encoding="utf-8")
+ writes = next(
+ paragraph for paragraph in skill.split("\n\n") if "`gh issue edit`" in paragraph
+ )
+ match = re.search(r"`(gh issue view [^`]+)`", writes)
+ self.assertIsNotNone(match, "expected a readback command for CLI issue writes")
+ args = shlex.split(match[1])
+ field_args = args[args.index("--json") + 1 :]
+ self.assertTrue(field_args, "gh issue view --json requires a field list")
+ self.assertLessEqual({"number", "url", "title", "body"}, set(field_args[0].split(",")))
+ self.assertIn("$issue_url", args)
+
def test_skill_app_links_resolve_to_declared_connectors(self) -> None:
apps = json.loads(APP_MANIFEST.read_text(encoding="utf-8"))["apps"]
declared_ids = {app["id"] for app in apps.values()}