Fix finding

From openai/plugins · View interactive version

Fix finding is an AI agent skill from the GitHub repository openai/plugins. Use only when the user explicitly asks to fix and verify a validated or plausible security vulnerability. Do not use for ordinary bug fixes, correctness or design review findings, general validation, or full PR, commit, branch, patch, or repository scans.

How to use this skill

Skill file

Fix Finding

Before choosing paths or saving retained output, read ../../references/artifact-storage.md and follow its storage policy.

Objective

Turn a current security finding into a minimal, validated code change. If the code is already safe, prove that and report that no change was needed.

Classify the current state from evidence, close the broken security boundary, preserve legitimate behavior, and pass the checks required by the selected verification mode. Prefer the smallest repository-native change that meets those requirements.

Verification Mode

Use standard verification unless the caller explicitly selects verificationMode: static. The selected mode applies throughout this skill, including delegated reviews and workbench stages; pass it to every delegated agent.

In static mode, assess source and diff evidence only. Do not install dependencies or run builds, tests, reproducers, or the application, including when validation instructions request them. Repository-reading tools remain available. State that runtime checks were not performed; do not count them as passed or require them for this assessment. Missing runtime tooling alone is not a blocker, but a material gap in the source evidence still requires blocked.

Patch Contract

Before editing, inspect the affected implementation, its direct callers, nearby helpers, and relevant existing tests. Establish from repository evidence:

Treat the finding as a data-flow and boundary problem, not merely the named input example. Check equivalent encodings, parser forms, aliases, callers, sinks, and every representation or copy of security-sensitive state that could bypass the proposed change. Handle unsafe state explicitly; do not silently accept, truncate, or reinterpret it into another reachable form.

Implementation Workflow

  1. Trace the reported path and inspect only the context needed to identify the real shared boundary. Return no_change when repository evidence shows that the reported path is already safe; do not make a speculative change.
  2. In standard mode, when feasible, run the smallest high-signal reproduction through that boundary and one legitimate control through the same path.
  3. Implement the smallest repository-native fix at the shared boundary. Prefer nearby helpers and established APIs. Do not broaden into unrelated redesign, cleanup, or sibling findings.
  1. Before verification, challenge the patch rather than defending it: inspect every direct caller of each changed helper and both outcomes of each changed condition. Look for one sibling path, representation, or copy that still reaches the vulnerable sink and one ordinary or default input that the patch newly rejects or reinterprets; revise the implementation if either exists.
  2. In standard mode, verify the resulting change:

In static mode, use these verification gates instead: inspect the final diff; trace the original exploit path and relevant alternate inputs through the changed control; then inspect callers and existing tests as source to establish that legitimate behavior and compatibility remain intact. Cite the source evidence for each gate and identify anything it cannot establish.

Return blocked if the vulnerability may be real, but essential evidence, tooling, access, or a product or compatibility decision is missing, so a safe fix cannot be responsibly completed or verified.

Review the fix

Challenge the patch for surviving bypasses and regressions in legitimate behavior. Use independent investigation or review when the complexity, uncertainty, or security impact warrants it. Give a fresh read-only reviewer the finding, repository root, authorized scope, repository policy, verification mode, and candidate diff so they can assess it from source without the author's rationale or claimed test results. If delegation is unavailable, perform that review as a separate pass.

Confirm review concerns against source or, in standard mode, focused execution before changing the patch. Address only confirmed issues within the finding and compatibility boundary, then repeat the affected verification gates for the selected mode. Revisit the review when a revision changes the security boundary or introduces a new material risk. Ensure no temporary or unrelated changes remain.

Workbench Remediation Stages

When a Codex Security workbench request includes a scan ID, occurrence ID, remediation request ID, action token, and expected version, pass the supplied scanId, occurrenceId, requestId, and actionToken to get_codex_security_scan_context when loading or refreshing the assigned finding. Follow only the requested remediation stage. The stage boundary changes when code may be written, but it does not weaken the validation requirements above.

Before creating or entering any work copy, select Python and Git from a controlled empty directory outside all checkouts. Verify that each trusted tool's absolute invocation path, resolved parent directory, and resolved executable are outside the selected target, its enclosing checkout, and all capture and rehearsal workspaces. Use the host-selected Python (CODEX_SECURITY_PYTHON_COMMAND in SDK runs). If absent, use a trusted absolute PYTHON, a host-managed runtime, or a verified system interpreter. Invoke its quoted absolute path with -I to import helpers from the installed plugin's scripts directory. From the same directory call workbench_target.trusted_git_executable(target), which honors CODEX_SECURITY_GIT or discovers Git when that variable is absent. Pin the verified absolute invocation path it returns in the helper process's CODEX_SECURITY_GIT environment and pass it to child helpers. Stop if either tool cannot be verified. For workbench Generate and Apply Git commands, pass offline=True and the real target to workbench_target.git_command, use -C for the working directory, and set -c core.hooksPath=<empty private directory>.

Disable external Git filters for inline capture and any rehearsal in either verification mode. Identify drivers with a nonempty clean, smudge, or process command in the effective Git configuration of the real target and each private command's working directory. Write the overrides with git config --file <file> <key> <value> using separate arguments. Clear each driver's clean, smudge, and process commands. For staging and capture diffs, set filter.<driver>.required to true only if the driver was already required or had a clean or process command. For a rehearsal that writes files, use a separate override that also requires drivers with a smudge command. Pass -c include.path=<absolute private config> for the operation's overrides. Git will fail if it needs the driver, including after edits to .gitattributes. If capture requires external conversion, register an existing reviewed scan-local patch by path and digest when available, or record the failure.

In static mode the workbench setter's checkout snapshot and reverse check must also preserve source-only verification. Rule out executable filters in the applicable working-tree and index attributes, including any attribute changes in the reviewed patch, before requesting such an operation. Stop before the operation if that cannot be established.

If a stage fails, record failed with the failing step and error in summary. Include the setter's error when registration fails.

When a parent thread delegates a remediation stage, the worker owns that stage through its terminal workbench update. The parent remains an orchestrator and must not duplicate the worker's edits or treat a chat response as completion.

Outcome and Output Contract

Follow the caller's output schema when supplied. Otherwise, include in the final response:

If using a scan artifact directory, resolve it using ../../references/scan-artifacts.md, then write a visible report to the fix report path. If there is no existing scan directory, a final chat summary is sufficient unless the user asks for a file.

Hard Rules

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.