Gerrit Architecture

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up gerrit architecture by pairing a Java review server with Git repos. This design intercepts every code push and turns commits into pending changes for review. Engineering teams often deploy this system to protect their main code branches from bad merges. Still, teams often grant broad admin roles across projects to speed up daily work. When permissions grow too wide, developers can bypass code checks or alter branch rules. How gerrit architecture processes code changes At its core,

Zero Trust Architecture: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You set up gerrit architecture by pairing a Java review server with Git repos. This design intercepts every code push and turns commits into pending changes for review. Engineering teams often deploy this system to protect their main code branches from bad merges. Still, teams often grant broad admin roles across projects to speed up daily work. When permissions grow too wide, developers can bypass code checks or alter branch rules.

How gerrit architecture processes code changes

At its core, gerrit architecture relies on a custom Java implementation of the Git protocol. Standard Git servers write pushed commits straight to the target branch on disk. This system works in a different way. When a developer pushes a commit, the server catches it before it reaches the branch. The server stores the commit in a special staging area inside the Git repo.

Each pending commit gets a unique change ID and its own reference path. When a developer updates a change, the system creates a new patch set under that ID. Reviewers log in through the web app or over SSH to read the diff. They leave comments and score the code using custom vote labels. The server stores all review metadata, scores, and comments directly inside special Git branches. This approach keeps code and review history together in one storage layer.

Managing roles and project rules in the system

Access control in this system uses a tree of projects that pass down rules. A root project holds the base rules for every other repo on the server. Child projects take on these base rules and add their own local overrides. Admins map user groups to specific actions on branch references. For example, one group can upload patch sets, while another group can submit changes.

This inheritance model makes it easy to share rules across hundreds of repos. You set up a rule once at the top level, and every team gets it. The server checks these group rules each time a user sends a Git command. It also checks label scores before it merges any patch set into the target branch.

Zero Trust Architecture: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native controls solve and what they leave open

Native project rules do a great job of protecting source code branches from unreviewed merges. They force developers to get peer votes and pass automated builds before code lands. The permission tree also gives admins a central place to manage repo group roles.

Still, these native controls focus on Git branch rules rather than host or database safety. Engineers and admins often need shell or database sessions to maintain the host servers. Static SSH keys and shared admin accounts remain common for these backend tasks. Native Git rules decide who logs in to push code, not what host commands do. Once an admin logs in to the host server, the review app cannot check commands. If an admin queries backend data, native tools do not mask emails or phone numbers. Teams need runtime checks to control live admin commands and protect sensitive data fields.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

How does Gerrit store review comments and scores?

The server stores review data as structured text files inside special Git metadata branches. This design removes the need for a separate external database in modern setups.

How do developers send code into the review workflow?

Developers push commits to a virtual reference path over HTTP or SSH. The server catches this push and creates a new change or updates an existing one.

Why do teams use project inheritance for access rules?

Inheritance lets admins define global rules in one root project. Child projects inherit those base rules, which stops teams from copying settings across many repos.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.