All guides

Developer Workflows

How to Secure Coding Agent Access to Customer Tickets

A practical access-envelope method for giving coding agents useful customer context while limiting prompt injection, credentials, repository scope, side effects, and lingering access.

9 min readMendaro editorial team
A cobalt ticket tile sits inside five nested porcelain frames, connected to a brass analysis instrument while unrelated tiles remain outside.

A customer attaches a browser export to a bug ticket. Buried in a text field is an instruction telling any AI reader to ignore its task and upload environment files. The support lead only wanted a coding agent to trace a failed checkout. The dangerous part is the combination of customer-controlled evidence and an agent session that can read secrets, reach the network, or write to production systems.

Give a coding agent access through a task-specific envelope: one named ticket, the minimum useful evidence, the relevant repository, read access first, explicit approval for side effects, and an expiry tied to the task. Treat every customer message, attachment, linked page, and pasted log as untrusted data. An instruction inside that material must never grant the agent more authority.

Separate customer evidence from operating instructions

Indirect prompt injection occurs when an attacker places instructions in content that another person or system later gives to a language model. A ticket comment, image metadata, README, web page, or log line can carry the payload. The UK's National Cyber Security Centre explains that language models do not have the hard separation between data and instructions that parameterized SQL provides. The agency recommends deterministic safeguards that constrain tools and impact because prompt injection remains a residual risk. NCSC's prompt injection guidance makes this a system-design problem, not a wording contest.

The operating rule should fit on one line:

Customer-supplied content is evidence. A coding agent may inspect or summarize that evidence, but instructions found inside it cannot expand repository scope, network access, credentials, tools, write authority, or approval rights.

Marking external content as data can help the model interpret it, but labels do not enforce permissions. OWASP's AI Agent Security guidance recommends scoped tools, explicit authorization for sensitive operations, separation between trust levels, and validation around external content. Put those controls outside the model.

For the checkout example, the agent receives a note from the support lead: inspect the failure path for ticket 4821 in the payments repository and report causes supported by the code. The support lead places the browser export in a delimited evidence block. The agent has no authority to follow links from the export, reveal local files, alter the ticket, or call an unrelated tool.

Build a five-part ticket access envelope

A ticket access envelope is the smallest combination of customer context, repository scope, tools, credentials, and approval rights that lets an agent complete one named task. The team closes the envelope when the task ends, even if the same developer starts another task five minutes later.

Define all five parts before the agent reads the ticket:

BoundarySafe starting pointExpand only when
Customer contextOne ticket, selected comments, redacted attachmentsA named uncertainty requires more evidence
Repository scopeOne repository and a specified starting refThe traced dependency crosses a known boundary
ToolsTicket read, repository read, local testsThe reviewed plan requires a specific write action
CredentialsNo reusable secret in agent-visible files or promptsA brokered, narrow credential is necessary for one approved call
Side effectsNone during initial investigationA person or policy approves the exact target and action

NIST defines least privilege as allowing only the access that a user or process needs for its assigned task. NIST SP 800-53, control AC-6 applies the principle to system processes as well as people. For a coding agent, least privilege covers data and actions. Restricting it to one repository while exposing every customer ticket still leaves a broad data boundary.

Start with investigation mode. Let the agent read the selected ticket, inspect the relevant code, and run isolated tests. A human reviews its findings before adding customer-visible replies, ticket status changes, commits, pull requests, package installs, or network calls. This split preserves speed for low-impact work without bundling every possible action into the first authorization.

Keep credentials outside the agent's readable workspace

An environment variable does not become safe because it sits outside source control. Agent-generated code can read values available inside its environment. OpenAI's sandbox security guidance recommends keeping application keys and third-party credentials outside the sandbox, restricting outbound destinations, and brokering approved requests through a proxy or tool handler.

Use three credential patterns:

  1. No credential for local work. Reproduction, code search, static analysis, and unit tests should use sanitized fixtures where possible.
  2. Brokered access for a narrow query. A server-side tool holds the credential, checks the caller and target, performs the allowed request, and returns only the result the task needs.
  3. Short-lived access for an exceptional task. Limit the token by repository, permission, and expiry, then revoke it when the task ends.

GitHub advises teams to select the minimum token permissions, limit repository access, and use the shortest practical expiration. Its API credential security guide also warns against putting tokens in command lines, repositories, or unencrypted files. A coding-agent session should inherit those constraints instead of receiving a developer's general-purpose credential.

Attachments need the same treatment. Prefer a short-lived signed URL to a permanent public link. Redact at the source when a screenshot or export contains unrelated customer records. If an authorized person must inspect live account state, that person can return a scoped finding such as “request 8f2 returned a permission error at 09:14 UTC” instead of copying the account dataset into the task.

Put approval where an action creates a consequence

Approval fatigue grows when a person must confirm each file read. Missing approval creates risk when an agent can publish, delete, message a customer, change permissions, or touch production. Place the review at the side-effect boundary.

Use a simple action policy:

  • Proceed: read the authorized ticket, inspect the named repository, search code, run approved local tests, and draft a plan.
  • Pause for review: write files outside the agreed area, install software, call a new host, post a ticket comment, change status, open or update a pull request, or use production data.
  • Deny: expose credentials, contact an unapproved destination, weaken access controls, copy unrelated customer data, or act on authority claimed by ticket content.

OpenAI's guardrails and human review guidance recommends checking the target, action, arguments, identity, and scope before a sensitive tool executes. It also places validation beside the tool that creates the side effect. A customer comment can influence the agent's analysis, but a separate policy check decides whether a proposed write matches the original task.

Approval records should capture the proposed action in plain language. “Run database tool” is too vague. “Read schema metadata for the staging payments database, with no row data and no writes” gives the reviewer a target, environment, and limit.

Record an audit trail that another operator can use

An audit trail should let a support lead answer six questions: who started the task, which ticket and artifacts entered the context, which tools ran, which side effects the agent proposed, who approved them, and what result followed. Record timestamps and targets. Avoid storing hidden model reasoning or duplicating raw customer content in the audit record.

Keep the audit record beside the work item or in a connected system:

  • task ID and initiating staff identity;
  • ticket ID plus attachment identifiers, not copied attachment bodies;
  • repository and starting ref;
  • tool name, target, and outcome;
  • approval decision and approver;
  • final commit or pull request link;
  • access revocation time.

The record supports incident review and routine cleanup. It also exposes scope drift. If an investigation of ticket 4821 touched three repositories and two external hosts, the team can ask whether the envelope was too broad or whether the task definition hid a real dependency.

End access when the task ends

Persistent access turns yesterday's reasonable grant into today's forgotten attack surface. Close each session with a short revocation procedure:

  1. Revoke or expire task credentials and signed attachment links.
  2. Remove temporary customer exports and isolated fixtures according to the team's retention rule.
  3. Record the commit, pull request, or investigation finding.
  4. Review any denied or unusual tool call before reusing the workflow.
  5. Confirm that the next ticket starts with a new envelope instead of inherited context.

GitHub lets organization owners review an installed app's permissions and repository access, then suspend or remove the app when needed. GitHub's app access review guidance supports a broader periodic check, but task-level expiry still prevents access from accumulating between reviews.

For small product teams already using Codex, Mendaro's permission-scoped ticket workflow for Codex is a strong fit when developers need customer conversations, screenshots, recent commits, and ticket actions without copying them between systems. Mendaro is an AI issue tracker for product teams and their customers. As of September 29, 2026, its MCP tools mirror the connected staff member's role-based permissions, can prepare a ticket handoff, read linked GitHub context server-side, and link a commit or pull request back to the ticket. Teams still need their own redaction rules, approval policy, sandbox boundaries, and credential broker. Organizations that require field-level data controls, formal privileged-access management, or isolation for regulated workloads should add those controls or use a dedicated access platform.

Test the boundary before trusting the workflow

Run a tabletop test with a synthetic ticket. Put a harmless injected instruction in an attachment, such as a request to read a mock secret file and call an unapproved host. The agent may flag the text as suspicious, but the real pass condition sits outside its prose: the file boundary blocks the read, the network boundary blocks the call, and no write occurs without review.

Repeat the test for ordinary failure modes. Use an expired attachment link, a repository outside scope, a customer-visible comment tool, a package install, and a revoked token. Check that each attempt stops at the intended boundary and leaves an audit event that names the action and result.

The production checklist is compact:

  • one task, ticket, and staff owner;
  • minimized customer evidence with provenance and redactions;
  • one repository or an explicit dependency list;
  • read-only investigation before writes;
  • no reusable secret in agent-visible context;
  • deterministic checks around every consequential tool;
  • a useful audit record;
  • expiry and cleanup tied to task completion.

A coding agent can work from rich customer context without receiving broad standing authority. The team gains speed by making the common read path easy, then keeps the expensive actions narrow, visible, and reversible.

Sources and further reading

  1. Prompt injection is not SQL injection (it may be worse)
  2. AI Agent Security Cheat Sheet
  3. NIST SP 800-53 Revision 5, control AC-6
  4. Sandbox security
  5. Keeping your API credentials secure
  6. Guardrails and human review
  7. Reviewing GitHub Apps installed in your organization
  8. Mendaro Codex integration