Quick answer
It is safe to give an AI coding agent repo access when you control what reaches its machine. Keep production credentials out of the agent's default environment. On Nori, give each session a short-lived, installation-scoped GitHub token, scope every other secret to the org, one person or one custom agent, mark production keys admin-only, and use 15-minute OIDC tokens instead of stored cloud keys. Branch protection decides what merges. Anything extra the agent needs, it requests per conversation, and a person approves it.
Where AI coding agents leak credentials
An agent can only leak or misuse what reaches its environment. Most incidents trace back to one of these setups.
- The agent runs on a laptop full of keys. A local agent inherits the engineer's shell: cloud profiles,
.envfiles, database URLs and a GitHub token that can reach every repository. - One shared secret file for everyone. Every agent run gets production keys because one task once needed them.
- Long-lived cloud keys. A key copied into an agent's environment works until someone remembers to rotate it.
- Secrets pasted into chat. An engineer pastes an API key into a Slack thread so the agent can use it. It now sits in Slack and in the agent's transcript.
- A team agent acting with one person's access. A shared bot runs with whoever set it up, so a teammate's request runs with that person's credentials.
- No gate before merge. The agent can push to
mainor run a deploy because the token allows it.
The fix is the same in every case: decide per task which credentials the agent needs, deliver only those, and make every exception visible.
How Nori limits the blast radius
Nori is a cloud coding agent platform for engineering teams. Agents such as Claude Code, Codex or Jiro run from Slack, Discord, the web or a schedule, each on its own machine. Access is granted through organization configuration, not inferred from a prompt.
One machine per session
One machine serves one active session. It starts with the organization's repositories, setup script and skillset, and is wiped when the session is released. Nothing from one engineer's laptop, or from another session, is on it.
Short-lived GitHub tokens
Sessions reach GitHub through the Nori GitHub App with a short-lived token scoped to the repositories the installation can see. A GitHub organization owner picks those repositories on GitHub. Administering repositories and the organization is off by default even for admin sessions. Code write access also allows merges, so keep branch protection that requires a review on main.
Secrets scoped to the org, one person or one custom agent
| Scope | Who sets it | Which sessions get it |
|---|---|---|
| Org | Admins and owners | Every session in the organization |
| Org, admin only | Admins and owners | Only sessions an admin started |
| Personal | The person it belongs to | Only sessions that person starts |
| Custom agent | Admins and owners | Only sessions running that agent, including its automations |
Scopes cover MCP, CLI and token integrations, custom environment variables, Google Workspace connections, and Claude and Codex accounts. When a name exists in several scopes, the most specific wins: agent, then personal, then org. A custom agent with an integration list gets nothing that is not on it, and an empty list gives it no tools, accounts or secrets. Shared automations get no one's personal credentials, because no person started them. A personal automation runs with its author's.
Cloud access without stored keys
On hosted Nori, a session can request a 15-minute OIDC token signed by your organization's Nori issuer and exchange it through workload identity federation on AWS or Google Cloud, or with HashiCorp Vault or JFrog. Nori sets the claims from its own record of the session, so a cloud role can require trigger == 'automation' and one automation_id. No cloud secret is stored in Nori.
Approvals for anything extra
When credentials are scoped per conversation, an agent asks for a named credential it does not hold. A person approves or declines it on the Credential request page. The grant stays with that conversation until the org's grant lifetime ends or someone ends it, and the Credentials tab shows who gave it.
Slack and teammates
Inbound access decides who may drive the bot: Guarded, the default for new organizations, admits org members and listed exceptions, and Restricted admits only admins, owners and exceptions. Channel reach defaults to the channel that summoned the agent. Personal credentials reach only sessions their owner starts. A teammate who wants work done mentions the agent in a new thread and gets a session with their own credentials. In a thread someone else started, the starter's GitHub identity acts for everyone, so keep shared work in its own thread or on a custom agent with its own credentials.
How to scope an AI agent's credentials, step by step
- List what each kind of task needs. Feature work needs repos and a staging database. A release task needs a deploy role. Most tasks need no production access at all.
- Install the GitHub App on only the repositories agents should touch, and require a pull request review on protected branches.
- Move shared secrets into Nori custom environment variables with the narrowest scope: org for harmless settings, admin only for production keys, personal for individual tokens.
- Create a custom agent for each sensitive job, such as
@staging-devor@release, give it only the integrations on its list, and restrict who can use it. - Replace stored cloud keys with session OIDC tokens and trust conditions that name the automation.
- Keep Slack inbound access on Guarded or Restricted and channel reach on the originating channel.
- Tell people never to paste secrets into chat. Point them to custom environment variables or the agent's secure upload form instead.
Worked example: staging database access without production credentials
A 25-engineer SaaS team wants agents to run migrations against staging while production stays out of reach. Names and values are illustrative.
# Staging database URL, only for the staging-dev custom agent
nori-sessions integrations set-custom --key STAGING_DATABASE_URL \
--value-file ./staging-url.txt --scope agent --agent staging-dev
# Production read replica, only for sessions an admin starts
nori-sessions integrations set-custom --key PROD_READONLY_URL \
--value-file ./prod-ro-url.txt
nori-sessions integrations update-custom --key PROD_READONLY_URL --admin-only true
# One engineer's own token, only in sessions she starts
nori-sessions integrations set-custom --key MY_LINEAR_TOKEN \
--value-file ./linear.txt --scope personal
# Only the platform team may use @staging-dev
nori-sessions access restrict --agent staging-dev
nori-sessions access grants add --agent staging-dev \
--subject user:lena@example.com
An engineer on the platform team writes in Slack: @staging-dev add a nullable billing_region column to accounts, run the migration on staging, run the API tests and open a PR. The session gets STAGING_DATABASE_URL and the GitHub token. It never receives PROD_READONLY_URL, because a member started it. The pull request waits for review under branch protection.
| Session | Staging URL | Production read replica | Personal tokens |
|---|---|---|---|
| Member mentions @staging-dev | Yes | No | That member's own |
| Member mentions the default agent | No | No | That member's own |
| Admin starts a session | No, unless it runs @staging-dev | Yes | The admin's own |
| Nightly shared automation on @staging-dev | Yes | No | None |
What if someone pastes an API key into Slack?
Nori's guidance is direct: do not paste secrets into chat, because chat messages are stored in the transcript. If a key does land in a Slack thread, treat it as exposed and rotate it with the service that issued it.
There are two safe ways to hand a secret over. To keep it, add it as a custom environment variable with the right scope; values are masked in the dashboard and CLI. For one session only, ask the agent for a secure upload form. The agent serves a one-time form on the session machine, behind the session login, and the secret stays on that machine.
For risky commands, the strongest limit is what the agent holds. An agent without a production deploy role cannot deploy to production, whatever it is asked. For tasks that should not act before a person agrees, write the prompt in two phases: investigate and post a plan, then act only after someone replies "approved" in the thread. See the audit log page for how each approval is recorded.
Frequently asked questions
Is it safe to give an AI coding agent access to our GitHub repos and production credentials?
Give it the repos, not the production credentials by default. On Nori, each session gets a short-lived GitHub token for the repositories the app can see, and production keys can be admin-only, scoped to one custom agent or replaced by short-lived OIDC tokens.
How do I scope a secret to one person or one custom coding agent?
Add it as a custom environment variable and pick Personal or Agent under Who gets it, or use nori-sessions integrations set-custom with --scope personal or --scope agent --agent with the agent's handle. Personal values reach only sessions that person starts. Agent values reach only sessions running that agent.
How do I stop a team AI agent from acting with my credentials when a teammate asks?
Keep shared work off your personal credentials. Personal credentials reach only sessions you start and your own personal automations. Shared automations never get them. Ask teammates to mention the agent in their own thread, and give team agents agent-scoped credentials instead.
What happens if someone pastes an API key into a Slack thread with an AI agent?
The key is now in Slack and in the conversation transcript, so rotate it. Nori's docs say not to paste secrets into chat. Use a custom environment variable, or ask the agent for its one-time secure upload form.
Can an agent get staging database access without production credentials?
Yes. Scope the staging database URL to a custom agent and keep production values admin-only or unset. Sessions running that agent get staging, and members' sessions never receive production.
Do agents need long-lived cloud keys?
No. On hosted Nori, a session can get a 15-minute OIDC token from your organization's Nori issuer and exchange it through your cloud's workload identity federation, with trust conditions that name one automation.
Sources
Read on December 4, 2026.
- Nori docs: Security and credential boundaries
- Nori docs: Environment variables and secrets
- Nori docs: Custom agents
- Nori docs: Cloud access with session OIDC tokens
- Nori docs: Use GitHub with Nori sessions
- Nori docs: Team members, roles and access
- Nori docs: Run coding agents from Slack
- Nori docs: Trigger a coding agent from a webhook with an approval step
- GitHub docs: About protected branches