The Simplest Way to Make Nats and Phabricator Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Running nats and phabricator together lets your team route code review events to build apps fast. Phabricator sends task updates while Nats moves those messages to your workers in real time. Many dev teams struggle when they link an older code review tool to a fast queue. Webhooks can drop when traffic spikes during big releases. Workers also need safe API keys to write build results back to tasks. A clean setup keeps messages flowing and locks down who can read or write data. How data and ke

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Running nats and phabricator together lets your team route code review events to build apps fast. Phabricator sends task updates while Nats moves those messages to your workers in real time.

Many dev teams struggle when they link an older code review tool to a fast queue. Webhooks can drop when traffic spikes during big releases. Workers also need safe API keys to write build results back to tasks. A clean setup keeps messages flowing and locks down who can read or write data.

How data and keys flow in nats and phabricator

Phabricator tracks code diffs, tasks, and repo commits for your team. When an engineer updates a diff, the tool fires an event hook out. That small bridge app takes the hook and publishes a message onto a Nats subject.

Nats then routes that message to the right worker apps right away. One worker might run tests while another checks security rules on the code. Each worker listens only to the subject names it needs for its job.

When a worker finishes a job, it reports the result back to the review page. To do this, the worker logs in to the Phabricator API with a token. You must tie each token to a bot account with narrow rights.

Nats also checks keys before any app can send or read messages on a subject. You can set up separate accounts or keys for each worker service. This step stops a test runner from reading messages meant for your deploy tool.

Common failure modes and how to scope roles

The biggest risk in this setup is a shared admin token across all workers. Teams often create one bot user in Phabricator and share its key everywhere. If one worker gets compromised, an attacker can read all your private code repos. They could also approve diffs or change task rules without anyone noticing.

End-to-End Encryption + NATS Security: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Broad subject permissions in Nats cause similar pain for engineering teams. If any app can publish to any subject, a bad script can trigger fake builds. Unlogged API calls also make it hard to trace who changed a task state.

Fix this by scoping roles down to the smallest set of rights needed. Give each worker its own bot user and lock it to specific project spaces. In Nats, write rules so the hook bridge can only publish to review subjects. Set your test workers so they can only read from those exact subjects.

You should also keep private data out of your message payloads whenever you can. Send only the task ID or diff number over the message bus. Let the worker fetch details over a safe path that logs every read action. If logs or results hold emails or phone numbers, masking rewrites matched fields in results.

Keeping network paths and logs clean

Network sprawl is another trap when linking your message bus and code review host. Do not open your code server or message bus to the public web. Keep both tools inside a private network and limit which hosts can talk.

Make sure every API call and message publish leaves a clear audit trail. Record which service account ran the action, what time it happened, and the result. Good logs help you spot broken hooks or bad keys in minutes instead of hours. Rotate your bot keys on a set schedule so old credentials cannot hurt you.

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 Phabricator send events to Nats?

Phabricator fires outbound webhooks when engineers create or update tasks and code diffs. A small listener service catches those hooks and publishes them to specific Nats subjects.

How should we scope tokens between these two tools?

Create a separate bot user for each worker app that talks to Phabricator. In Nats, restrict each client key to read or write only the subjects it needs.

What data should we put inside Nats messages?

Keep messages small by sending only the object ID and the event type. Workers can then fetch the full diff or task details through a logged API call.

The query runs. The emails stay hidden.