Connecting an AI agent directly to your Git pull request pipeline sounds like an engineering leader's dream until your security team spots the OAuth request. Giving any third-party SaaS service blanket read access across every private repository is a non-starter for organizations handling proprietary IP, healthcare data, or fintech systems. Yet having senior developers spend forty minutes dissecting boilerplate typos and missing null checks is an expensive waste of human focus.
At 365Finds, our stance is clear: you should automate pull request reviews, but you should never rely on the "one-click cloud authorization" default when dealing with proprietary software.
Bito offers an automated AI Code Review Agent designed to run on GitHub, GitLab, and Bitbucket. To use Bito without exposing sensitive source code, database credentials, or proprietary core algorithms to unauthorized endpoints, you must shift from Bito Cloud's multi-tenant integration to an isolated CI pipeline deployment, enforce rigorous .bito.yaml exclusion rules, and configure least-privilege access tokens.
The Code Exposure Surface: How Bito Interacts with Your Code
To protect internal code, you must first understand what Bito actually touches during an automated review.
When a pull request triggers Bito, the system does not need your entire git history. It requires:
- The git diff (the changed lines between the source and target branch).
- Immediate context (imported interfaces, method signatures, and related types).
- Review instructions (formatting rules, architectural guidelines, or security checks).
Bito maintains SOC 2 Type II certification and enforces a contractual zero-data-retention policy with its upstream LLM providers (including OpenAI and Anthropic). That means raw prompt payloads sent to commercial model endpoints are not used to train public foundation models. However, in Bito's standard cloud-hosted setup, code diffs and contextual snippets still travel through Bito's hosted routing servers.
If your organization has strict compliance boundaries (such as ISO 27001, HIPAA, or strict internal IP isolation), passing code through an external vendor's cloud layer creates compliance friction. The solution is executing the review agent inside your own perimeter.
Architectural Comparison: Cloud App vs. Self-Hosted Runner
Before writing a single configuration line, decide on your execution topology. 365Finds strongly favors the self-hosted CI pipeline approach for any closed-source enterprise codebase.
| Deployment Model | Code Transmission Path | Security Perimeter | Maintenance Burden | 365Finds Verdict |
|---|---|---|---|---|
| Bito Cloud App | Repo cloned via cloud OAuth; diffs processed on Bito cloud | External SaaS multi-tenant infrastructure | Minimal (2-minute UI setup) | Acceptable only for open-source or non-sensitive internal tooling |
| GitHub Actions (Hosted Runners) | GitHub cloud runner checks out code; diff sent to Bito API | Ephemeral GitHub VM; API payload over encrypted HTTPS | Low (managed GitHub workflow) | Good balance for standard commercial teams with strict NDAs |
| Self-Hosted Runner in Private VPC | Internal runner checks out code; zero external disk storage; diff only to approved LLM | Internal corporate firewall / private VPC | Moderate (runner infrastructure management) | Recommended: Maximum isolation for core IP and regulated environments |
Step 1: Create a Dedicated Machine User with Least Privilege
Never use a personal developer's Personal Access Token (PAT) or an organization owner's account to run Bito. If that token leaks, the attacker inherits full administrative rights.
- Provision a Bot Account: Create a service account in GitHub or GitLab (e.g.,
bito-botorinternal-cr-agent). - Assign Granular Scope:
- For GitHub: Generate a Classic Personal Access Token with only
reposcope, or configure a fine-grained token withPull requests: Read and writeandContents: Read. Avoid administrative or organization-wide permissions. - For GitLab: Generate a Personal Access Token with
apiscope assigned strictly to the specific project group, marked with theDeveloperrole rather thanOwner.
- For GitHub: Generate a Classic Personal Access Token with only
- Store in Secrets Vault: Add the token to GitHub Repository Secrets under
GIT_ACCESS_TOKEN. Add your Bito API key asBITO_ACCESS_KEY. Never place these strings in plain-text workflow files.
Step 2: Establish Exclusion Firewalls with .bito.yaml
The most critical privacy safeguard is preventing sensitive files from ever reaching the LLM prompt buffer. Bito natively respects a .bito.yaml configuration file placed in the repository root.
Create .bito.yaml in your root directory and commit it to your default branch:
version: "1.0"
# Files and paths strictly excluded from Bito AI Code Review
exclude_files:
# Environment secrets and credentials
- "**/*.env*"
- "**/*.pem"
- "**/*.key"
- "**/secrets/**"
- "**/credentials.json"
# Database migrations, schemas, and seed files
- "db/schema.rb"
- "db/migrations/**"
- "**/prisma/schema.prisma"
# Generated bundles, build outputs, and vendor dependencies
- "vendor/**"
- "node_modules/**"
- "**/*.min.js"
- "**/*.map"
- "package-lock.json"
- "pnpm-lock.yaml"
- "yarn.lock"
# Proprietary algorithms or highly confidential modules
- "src/core/patented_algo/**"
- "internal/billing/crypto/**"
# Prevent reviews on sensitive or internal audit branches
exclude_branches:
- "release/**"
- "hotfix/security-*"
# Configuration controls
suggestion_mode: "comprehensive"
review_comments: 2 # 1 = single summary comment; 2 = inline line-by-line review
Crucial Setting: In your Bito Cloud Workspace Agent Settings, verify that "Allow config file settings" is toggled ON. Without this toggle, the cloud engine will ignore repository-level
.bito.yamlexclusion rules.
Step 3: Configure the GitHub Actions Workflow on an Isolated Runner
Instead of authorizing the Bito GitHub App globally, install Bito through GitHub Actions. By combining GitHub Actions with a self-hosted runner, the repository is cloned directly within your private network.
Create .github/workflows/bito-review.yml:
name: Bito AI Code Review Guard
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
- develop
jobs:
bito-review:
# Use 'self-hosted' for corporate VPC runners; use 'ubuntu-latest' for standard workflows
runs-on: self-hosted
# Strictly ignore draft PRs to avoid sending incomplete code and wasting review credits
if: github.event.pull_request.draft == false
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
# Bito requires fetch-depth 0 to resolve git commit diffs accurately
fetch-depth: 0
- name: Run Bito Code Review Agent
uses: gitbito/CodeReviewAgent@main
with:
bito-access-key: ${{ secrets.BITO_ACCESS_KEY }}
git-access-token: ${{ secrets.GIT_ACCESS_TOKEN }}
env:
# Enforce local static analysis before invoking LLM logic
STATIC_ANALYSIS_TOOL: "astral_ruff,mypy"
If your company prohibits outbound traffic to third-party action repositories, fork or mirror gitbito/CodeReviewAgent into an internal GitHub Enterprise organization (myorg/bito-codereview-agent) and pin the exact commit SHA instead of @main.
Step 4: Inject Context Boundaries via Local Guideline Files
Bito automatically parses local instruction files located inside the repository to guide its review behavior. This includes CLAUDE.md, AGENTS.md, and .cursor/rules/*.mdc.
Using repository-level rule files ensures your instructions stay under version control and never leak into third-party prompt registries.
Create a root file named AGENTS.md or .bito-instructions.md with explicit security and operational boundaries:
# Pull Request Review Guidelines for Bito
## Security & Privacy Constraints
- Never reproduce or restate entire proprietary source code blocks in review comments; quote only single modified lines where defects occur.
- Flag any hardcoded tokens, internal IP addresses, staging URLs, or database connection strings immediately as BLOCKING.
- If a diff contains files matching sensitive data structures, abort review on that file.
## Focus Areas
- Evaluate memory safety, concurrency locks, and potential SQL injection vectors.
- Suppress cosmetic nitpicks such as whitespace, import ordering, or bracket indentation.
Step 5: Advanced Isolation with Private Endpoints and BYOK
For defense-in-depth, top-tier engineering organizations should not rely on Bito's shared upstream API accounts. Bito supports enterprise deployments using Bring-Your-Own-Key (BYOK) or custom model endpoints through its Governor architecture.
When BYOK is enabled:
- API calls from the agent route directly to your own enterprise Azure OpenAI Service instance or AWS Bedrock endpoint.
- Your organization's direct Enterprise Agreement (EA) and Business Associate Agreement (BAA) govern all data handling.
- OpenAI or Microsoft cannot see or log data through consumer-grade telemetry pipes.
- Outbound egress from your runner can be restricted via VPC firewall rules strictly to your cloud provider's dedicated IP ranges.
Operational Verification: How to Confirm Code Is Not Leaking
Once your pipeline is live, do not assume it is secure—verify the boundaries:
- Test Exclusion Rules: Create a branch modifying an
.env.examplefile and a file in an excluded path (e.g.,vendor/dummy.js). Open a pull request. Inspect Bito's output to verify no inline comments or summaries reference the excluded directories. - Audit CI Output Logs: Open the GitHub Actions run details. Verify that the agent logs do not print proprietary file bodies, secret values, or unredacted diffs to the CI console.
- Trigger Manual Scans Only: If your team works on critical modules, you can disable automatic PR triggers and mandate on-demand invocation by typing
/reviewor/review securityonly after the author confirms the diff is sanitized.
Bito reports SOC 2 Type II compliance audits and enforces zero data retention agreements across its commercial model providers.