Safeguard
Security Guides•

Who gets write access when repositories merge into a monorepo?

Merging repos tends to merge their permissions, so write access spreads. Map who needs what, use roles and CODEOWNERS, and review access after the move.

Safeguard Security Team
4 min read

When repositories merge, access tends to be the union of every team that had it. Each team gets write access to code that is not theirs. Decide access from ownership instead: grant the narrowest role, use CODEOWNERS and required reviews to control who approves what, and review the list after the move.

Why permissions spread

GitHub grants access to a repository, not a folder. Its documentation describes organization repository roles from Read through Triage, Write, Maintain and Admin. Write is described as for contributors who actively push to the project. Once a team has Write on the monorepo, it can push a branch that changes any directory.

The same documentation set for secure use of Actions notes that any user with write access to a repository has read access to all secrets configured in that repository. So a payments secret stored at repository level is readable by people who only ever worked on the marketing site.

A simple access map

  1. List every team and its old repositories.
  2. For each team, write down the directories it owns in the monorepo.
  3. Give each team Write only if it opens branches and pushes directly. Others can use Triage or Read and contribute from forks, if your policy allows it.
  4. Keep Maintain and Admin small. Admin can change settings, rules and secrets.
  5. Record the result in a table the team leads sign off on.
RoleFitsWatch for
ReadAuditors, adjacent teamsCan see all code and history
TriageSupport, productNo push access
WriteEngineers on owning teamsReads all repo secrets
MaintainTeam leadsManages repo, not destructive actions
AdminPlatform ownersSecurity and deletion settings

Use review rules to narrow the effect

You cannot hide directories, but you can control approvals. The CODEOWNERS documentation says code owners must have write permissions, and teams must have explicit write access. With "Require review from Code Owners" enabled, a pull request that changes owned code needs approval from an owner. That turns broad write access into narrow merge authority. The protected branches documentation also describes requiring that the most recent reviewable push be approved by someone other than the person who pushed it.

Remember the limits. Review rules do not stop a person with Write from reading secrets or from changing workflow files unless those files are owned too. See CODEOWNERS for workflows and release files.

When to keep a repo separate

If a directory needs a smaller audience, such as code under a contract or unusually sensitive logic, a separate repository is the cleaner control. Sparse checkout is a convenience, not access control, which we explain in sparse checkout is not access control. The tradeoffs are covered in monorepo or separate repos: a security decision guide.

Review after 30 days

Access drifts. Schedule a review a month after the move and compare who has Write against who actually pushed. Safeguard's compliance and evidence automation can help you keep a record of those reviews for audits.

Quick check

Can I give a team access to one folder only?

Not through repository roles. Access is per repository. Use code owner review to control approvals, or a separate repo for restricted code.

Do CODEOWNERS entries grant access?

No. Owners must already have write permission, otherwise they are not assigned.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.