Day 6 of 1060 minShell WalkerHands-on lab
Day 6: Agent Permissions and Blast Radius
Taught by Mr Elite Updated
By the end of today you can
- List the files, shell commands, network routes and credentials a coding agent can reach
- Choose between allow lists and ask-every-time for different actions
- Run an agent in a throwaway directory or container with limited access
- Write a blast-radius note with three concrete restrictions
Warm-up
Answer from memory first, then tap to check. Recalling yesterday is what makes it stick.
Why is a package name a trust boundary when an AI suggests it?
Installing it runs someone else's code, and models can invent names that an attacker may have registered.
Which npm setting stops install scripts running automatically?
ignore-scripts, for example npm install --ignore-scripts.
Yesterday we assumed trust could fail: a package name looked fine and was not. Today we ask a harder question. If trust fails and the thing you trusted is your coding agent, what can it actually do?
Picture an agent asked to fix a failing test. The issue it reads contains a hidden line telling it to print your environment variables to a web address. If the agent can run any shell command, read your home directory and reach the internet, that line works. If it cannot, the line is just text. The difference is permissions, and you control them.
Blast radius: the idea
Blast radius means how much damage follows when something goes wrong. We cannot promise an agent will never be tricked. Models follow instructions in text, and they cannot reliably tell yours from an attacker's. So we design for the day it is tricked and ask what it could reach.
Least privilege is the standard answer. Give the agent only what the current task needs, and nothing more. A test-fixing task needs to read the repo, edit a few files and run the test command. It does not need your SSH keys or your cloud credentials.
- Blast radius
- Everything that could be damaged or exposed if a component is compromised.
- Least privilege
- Giving a user or tool the minimum access needed for the task.
- Allow list
- A list of actions permitted in advance. Anything not on it is refused or asked about.
- Sandbox
- An isolated environment where mistakes cannot reach the rest of your machine.
Quick check
Why do we plan for a tricked agent instead of relying on the model to spot bad instructions?
Because the model treats all text as input, limits on what it can do are the dependable defence.
The four things an agent can touch
When I audit an agent setup I walk through four areas. Each one is a route an attacker would use through a hijacked agent.
Allow lists versus ask-every-time
Most agents offer two permission styles. Ask-every-time shows a prompt before each action. An allow list pre-approves chosen actions so the agent does not stop.
Ask-every-time sounds safest, but people get prompt fatigue. After forty prompts you click yes without reading. Broad allow lists fail the other way, because one wildcard can quietly approve everything.
My rule: allow narrow, read-only or easily reversed actions, such as reading files in the project or running your test command. Always ask for anything that sends data out, deletes, installs, or changes git history. Deny outright anything the task never needs.
Quick check
Which action should stay on ask-every-time?
Pushing sends changes outside your machine and is hard to undo quietly, so a human should approve it.
Watch me do it: a throwaway sandbox
Now I will show you how to build a sandbox. Everything runs on your own machine. We use a throwaway folder first, then a container if you have Docker. Check your container tool is installed with docker --version. If it is not, skip steps 4 and 5 and do the folder version only.
mkdir -p ~/agent-sandbox/project && cd ~/agent-sandbox/project
echo 'FAKE_API_KEY=not-a-real-key-123' > ~/decoy.env
cat ../../decoy.envdocker run --rm -it --network none
-v "$PWD":/work -w /work
node:20 bashls /root ; cat ~/decoy.env ; curl -m 3 https://example.comWhat just happened: the container sees only /work and has no route out. A hijacked agent in there has nothing to steal and nowhere to send it. Real tasks need some network, such as a package registry. Add access deliberately, not by default.
Lab: Coding Agent Blast Radius
Time to apply this in the SecurityElites lab ai-dev-agent-permissions-1. It runs in your browser against a practice setup, so you never touch anything real.
The scenario: an agent is about to fix a failing test in a payments service. The issue it works from contains a hidden instruction, and its permissions currently allow everything. You play the security engineer and tighten the configuration so the hidden instruction cannot do harm, while the legitimate fix still works.
Your own blast radius
The lab is a practice setup. The skill that matters is applying it to the agent you actually use. Open its settings and find where permissions, allowed commands, and approval modes live. Documentation search for your tool name plus permissions usually finds it.
env | grep -iE 'key|token|secret|pass' | cut -d= -f1
ls -a ~ | grep -E '^.(ssh|aws|npmrc|netrc|config)'Every name that appears is something a hijacked agent started from your shell could read. Do not paste the values anywhere. Note the names for your mission.
Your turn
Coding Agent Blast Radius
Today's lab puts you in the security engineer's seat. An agent has full permissions and a poisoned issue in front of it. This is exactly the failure we are planning for, so you practise limiting damage rather than hoping the model behaves.
What to try
What to notice
- Which single permission made the hidden instruction dangerous
- How much of the original allow-everything setup the task never needed
- Whether the legitimate fix still works after you tighten things
If it did not work
Allowing a shell or a wildcard command to stop the prompts
Allow exact commands such as npm test. Review the list for patterns that match more than you meant.
Running the agent from your home directory
Start it inside the project folder or a container so file access is limited from the outset.
Leaving cloud or registry tokens in the shell environment
Start the agent from a clean shell or give it a scoped, short-lived token for the task.
Approving prompts without reading them
Cut the number of prompts by allow-listing safe actions, so the ones left deserve attention.
Recap
- Plan for a tricked agent and limit what it can reach
- Check four areas: files, shell, network and credentials
- Data theft needs a readable secret and a route out, so remove either
- Allow narrow, reversible actions and ask for outbound, destructive or install actions
- Wildcards quietly undo an allow list
- A container or throwaway folder with no network cuts blast radius sharply
Cheat sheet
Least privilege- Only the access the current task needs
Allow list- Pre-approved exact actions
docker run --network none- Container with no network access
-v "$PWD":/work- Mount only the current folder into the container
env | grep -iE 'key|token|secret'- Find secret-looking variables the agent could inherit
Prompt fatigue- Approving without reading after too many prompts
Before the next day
Mission: Write your blast-radius note
Finish the lab, then turn today's method on your own setup. A short written note makes the risk concrete and gives you changes you can apply straight away.
About 40 min
You are done when: blast-radius.md covering the four areas with three named restrictions, one of them applied and verified
Want more? Run your agent inside a container with only the project mounted and note which tasks break and what minimal network access they need.
Quiz
4 questions. Your score is saved with your progress.
1. An agent can read ~/.aws and make any outbound request. What is the best single change to prevent data theft via an injected instruction?
Theft needs both a readable secret and a route out. Cutting either breaks the chain, and cutting both is stronger.
2. Which allow-list entry is the riskiest?
A wildcard shell entry approves any command, which defeats the purpose of an allow list.
3. Why can ask-every-time fail as a control?
Prompt fatigue turns approvals into habit. Fewer, meaningful prompts get more attention.
4. What does running with docker --network none and one mounted folder achieve?
Injection can still occur, but the agent has little to steal and no route out, so the blast radius is small.
Finish the day
Mark the day complete to save your progress.
Next: Day 7 looks at the attack that made today's limits necessary: poisoned issues and hostile input. You will see how text in an issue or document can hijack an agent, and which controls reduce the risk.
Your notes
Private to this device. Write what you want to remember from today.