Blackhount AI that runs your company while you sleep Saturday, November 14, 2026
Blackhount
Sealed Room guide

Least-privilege access to source code: one task, only the folders it needs

Least privilege means giving each person only the access their work needs, for only as long as they need it. It is the oldest rule in security, and the hardest to apply to source code, because Git hosts give access to a whole repository at once. Here is how to apply it one task at a time.

In short: Repository permissions cannot show someone one folder, so least privilege for code means moving the boundary. Grant access to a workspace for one task instead of to the repository, and limit four things: what code it holds, how long it lasts, where it can connect, and what is allowed to leave.

Why it matters more now

In the AI era, a repository holds the prompts, agent instructions, model settings, evaluation data and business rules that make a product valuable, next to the code itself. That is intellectual property worth protecting carefully, and every person or agent with repository access can read all of it. Least privilege is how you make sure each of them sees only their part.

Why repository permissions cannot get you there

  • Access is per repository. GitHub's repository roles (Read, Triage, Write, Maintain, Admin) all apply to the whole repository. There is no role that shows one folder.
  • History comes with it. Anyone who can read the repository can read every past version of every file.
  • Code owner rules control approvals, not reading. A CODEOWNERS file decides who must approve changes to a path. It does not stop anyone from reading it.
  • Splitting into many repositories is costly. Shared code, builds and tests get harder, and the pieces still reference each other.

The four limits of least privilege for code

LimitQuestion it answersPer-task answer
WhatWhich code can they see?Only the folders the task touches, from one exact version, with no history
How longWhen does access end?When the task ends, at a time set in advance
Where toWhat can they connect to?Only the sites the task needs, such as package sites for reading
What leavesHow does work reach the repository?Only as a reviewed pull request, after someone approves it

Most teams handle "what leaves" well with protected branches and reviews. The other three are where access quietly grows.

Putting it in place, step by step

  1. Map your code by sensitivity. Mark the folders that hold the most valuable or dangerous parts: billing, sign-in, prompts and model settings, anything touching customer data.
  2. Start everyone at no access. Outside developers, new hires on trial, and AI agents begin with nothing and get access per task.
  3. Grant per task, with an end time. Each task names its folders and its duration. When it ends, access ends without anyone having to remember.
  4. Keep keys out of reach. No real keys, passwords or .env files in what you share. If a task needs a service, use test credentials.
  5. Close the internet by default. Allow only the sites the work needs, and never your Git host from inside the workspace.
  6. Review everything that comes back. Pay extra attention to new libraries and files that run automatically.
  7. Keep a record you can show. Who had which folders, when, what they changed and what they connected to.

Common mistakes

  • "Read only, so it's safe." Read access is the access that lets code be copied.
  • Permanent access for temporary work. A three-week contract becomes a year of access because nobody removed it.
  • Organization-wide tokens for tools and agents. One token that can read every repository, handed to a script that needs one.
  • Keys committed to the repository. Everyone with the repository has them, including in history.
  • Trusting removal to undo access. Removing someone does not delete the copies they already made.

How the Sealed Room applies least privilege

  • What: each room holds only the folders you pick for the task, copied from one exact commit with no history. Hidden files and package folders never go in.
  • How long: you set the time when you open the room, up to 8 hours, and the room and everything in it are deleted when it ends.
  • Where to: only the sites you allow, package sites for reading by default. GitHub, GitLab and Bitbucket are never reachable.
  • What leaves: you review every changed line, files that could run automatically are flagged, and your approval opens a pull request.
  • The record: every change and every connection, in a record that cannot be edited.

See how the Sealed Room works.

Questions teams ask

Is this the same as zero trust?

Zero trust is the wider idea of trusting nothing by default and checking every request. Per-task access to code is one practical piece of it, applied to the asset most companies forget to include.

Does least privilege slow developers down?

It does when every request goes through a ticket. It does not when opening a room for a task takes a minute and the developer gets a full editor, a terminal and the packages they need.

What about our own employees?

The same pattern works for anyone who does not need the whole repository: new hires on trial, people moving between teams, and anyone working on a sensitive part of the code.

Give the task, keep the repository.

Open a room for one task with only the folders it needs. You review every change before it reaches your GitHub.

Request access