The Simplest Way to Make Json Rpc and Teamcity Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Pairing json rpc and teamcity lets build agents run remote tasks through simple web messages. This setup helps teams trigger tests, check build status, and update apps during a build. TeamCity runs your build steps on worker agents. Sometimes a build step must talk to an outside service that uses JSON-RPC. The agent sends a small JSON message with a method name and input values. The remote server runs that method and sends back a JSON reply. This pattern keeps build scripts light and fast. Ho

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.

Pairing json rpc and teamcity lets build agents run remote tasks through simple web messages. This setup helps teams trigger tests, check build status, and update apps during a build.

TeamCity runs your build steps on worker agents. Sometimes a build step must talk to an outside service that uses JSON-RPC. The agent sends a small JSON message with a method name and input values. The remote server runs that method and sends back a JSON reply. This pattern keeps build scripts light and fast.

How json rpc and teamcity pass keys and data

To make this work, the build agent needs a way to log in. Teams store secret keys or tokens inside TeamCity project settings. When a build starts, TeamCity passes the key to the agent. The agent puts that key into the message header and sends the request.

Permissions live on both sides of this call. TeamCity controls which users or branches can start a given build. The remote JSON-RPC server controls which methods a given key can run. Good setups link one project role to one strict set of remote methods.

Data flows in two ways during a build run. First, the agent sends build details like commit hashes or version tags. Second, the remote service sends back status codes, test results, or artifact paths. If the reply contains sensitive fields like emails or phone numbers, masking rewrites matched fields in results. That way, build logs stay clean when many people read them.

Common failure modes and how to scope roles

Many teams fall into the trap of using one shared service account. They put one master token at the root level in TeamCity. Every subproject and every build agent can then read and use that same token. If one test script leaks that token, an attacker can call any remote method.

Broad tokens create a second big problem for platform teams. A JSON-RPC endpoint often exposes both read methods and write methods on one path. A normal network firewall cannot tell a safe status check from a full deploy call. If the token has full rights, a pull request build might change production state.

JSON Web Tokens (JWT) + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Unlogged calls also hurt your security checks. Standard TeamCity logs show that a script step ran, not the exact JSON payload. When a remote service breaks, you cannot tell which build agent sent the bad call.

You can fix these issues with a few clear rules. Give each TeamCity project its own scoped key with minimum rights. Split read-only keys for pull request builds from write keys for release builds. Lock down network paths so only approved build agents can reach the remote server. Finally, log every method name, caller identity, and timestamp for each remote call.

Validating payloads and handling timeouts in build steps

Remote calls can hang if the target service gets too busy. A stuck call will tie up a TeamCity build agent for hours. Always set a clear time limit on every request the agent sends. If the server does not reply in time, fail the step fast.

Check the JSON reply structure before moving to the next build step. In JSON-RPC, a call can return a web success code but still hold an error object. Make sure your build script reads the error field and stops the build when needed. This simple check stops broken builds from moving forward.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Does TeamCity have a built-in JSON-RPC interface?

TeamCity uses a REST API for its own server controls. Teams use JSON-RPC when build steps must talk to external tools, blockchains, or custom microservices.

How should we store JSON-RPC tokens in TeamCity?

Store tokens as password parameters scoped to a single subproject. Never hardcode keys in build scripts or share one root token across all projects.

How can we stop pull request builds from running dangerous RPC methods?

Assign a read-only role to keys used by untrusted branches. Keep write keys restricted to protected release branches and dedicated build agents.

The query runs. The emails stay hidden.