October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

How to Keep Untrusted Repository Content from Overriding Your Instructions

Repository files can inform an AI coding agent, but they should not redefine its task or authority. Use explicit scope, restricted access, and layered review.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Treat repository content as information to evaluate, not as authority to change the task. A pull request can carry prompt injection in source files, documentation, commit messages, screenshots, and even agent instruction files such as AGENTS.md. Keep the instruction hierarchy explicit, narrow the agent’s permissions, and review consequential changes. These controls reduce risk; they do not guarantee that prompt injection can be eliminated.

Can an AGENTS.md file override your instructions?

No. An AGENTS.md file can provide operational guidance for work in the part of a repository where it applies, but it does not outrank direct system, developer, or user instructions. OpenAI’s Codex repository prompt documentation describes the file’s scope as the directory tree rooted where it appears; deeper instruction files take precedence for their own subtrees. Direct system, developer, and user instructions take precedence over repository guidance.

As an Amazon Associate I earn from qualifying purchases.

That distinction matters: an instruction file may be relevant to how an agent edits a project without being trusted to redefine the task, request unrelated actions, or grant itself access. In pull-request workflows, the file may be controlled by the contributor whose changes the agent is reviewing. OpenAI’s Codex Action security guidance therefore treats PR-controlled AGENTS.md, AGENTS.override.md, and configured fallback project documentation as part of the untrusted input surface.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Where can a repository prompt injection appear?

Do not limit inspection to source code. Instructions intended to manipulate an agent can appear anywhere repository or pull-request content enters its context. OpenAI’s Codex Action guidance identifies pull-request bodies, commit messages, repository instruction files, and screenshots as possible carriers, alongside code and project documentation.

#1 Best Overall

The Codex Security threat model makes the boundary broader still: repository contents, filenames, symlinks, model output, patches, service responses, and imported artifacts are data. Their presence does not authorize the agent to change targets, expand scope, use a different credential, perform unrelated reads or writes, contact an unapproved network destination, bypass a restriction, or accept incomplete coverage. See the Codex Security policy.

How to safely run an AI coding agent on untrusted code

1. Restrict who can start an agent run

Decide which contributors and bot identities can trigger workflows that give an agent repository access. Apply the repository platform’s access controls to the workflow trigger, rather than assuming that a later human review will neutralize anything the agent encounters. OpenAI’s Codex Action guidance recommends restricting triggers and trusted bot identities.

2. Define the task and its boundaries directly

Tell the agent what to do, which files or components are in scope, and what actions are out of scope. Treat instructions found in the pull request, commit history, repository files, or imported materials as content to assess—not as authorization to redirect the task. If repository guidance is useful, the agent can follow it only within the boundaries set by its higher-priority instructions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Give the agent only the permissions it needs

Limit credentials, write access, tools, and network access to what the task requires. Repository content must not be able to authorize use of another credential, a different target, an unrelated write, or an unapproved network destination. Where a task can be completed without a permission or secret, do not expose it to the workflow.

4. Review changes and consequential actions

Inspect generated patches and review consequential actions before they are accepted or executed. Approval provides oversight, but it is only one layer: the Codex Action guidance cautions that manual approval does not remove other risks from untrusted inputs. Combine review with restricted triggers, explicit scope, and limited permissions.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What these safeguards can—and cannot—do

These practices reduce the opportunities for malicious repository content to influence an agent and limit the damage if it does. They are not a proof of perfect prevention. OpenAI describes prompt injection as “an evolving security challenge” in its prompt-injection guidance, which also warns that broad delegation can make hidden malicious content more likely to mislead an agent.

The official guidance is qualitative: it does not establish a prevalence rate, a success rate, or a numeric ranking of these controls. Choose safeguards based on the workflow’s exposed inputs and potential impact, and use multiple layers rather than relying on a single approval step.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.