KGB-PROTOCOL(7p)
π NAME π
okay bestie, listen up β this is KGB_protocol, the whole entire spec for how the client and the server talk to each other π (yes that's a 7p page, a whole perl manual page, we love that for us).
πΈ DESCRIPTION πΈ
So the protocol that the KGB collaboration service runs on? It's built on JSON-RPC (http://json-rpc.org/). That's the whole vibe fr fr.
And what does KGB actually do? It helps people collaborate by relaying notifications about commits in a version control system over to IRC β¨. It's two pieces working together:
- a client, hooked into the version control system, which sends info about changes to the server π¦
- a server, which sits there listening for the client's notifications and relays them onto the configured IRC channels π
Two halves, one iconique friendship. periodt.
π AUTHENTICATION π
Message content gets authenticated using two HTTP headers. Not one. Two. She's thorough π
- The
X-KGB-Projectheader must contain the project ID, exactly as it's defined in the server's configuration. - The
X-KGB-Authheader must contain a SHA1 hash β written out in hexadecimal notation β calculated over the shared secret, the project ID, and the JSON-encoded message.
Then when the HTTP request lands, the server does its little math: it calculates the hash using the project ID that was supplied, the server's own copy of the shared secret for that project, and the content of the HTTP request. If that hash matches the one in the X-KGB-Auth header, auth succeeds and the request gets processed π. If it doesn't match? Error. That's it, that's the vibe check.
π οΈ METHODS π οΈ
π commit_v4 arguments
This method takes info about a single commit and relays it straight to IRC. The arguments is a map with the members listed below π. Any extra members you toss in? Ignored. Not even looked at. π
commit_idstring β a string identifying the commit in the version control system. Git (short) hash, Subversion revision number, that kind of thing β¨.rev_prefixstring β a string to prepend to the commit ID when it's displayed on IRC."r"is particularly useful for Subversion repositories.authorstring β a string representing the commit author π«Ά.branchstring β a string representing the commit branch πΏ.modulestring β a string representing the commit module or sub-project.commit_logstring β the commit message π.changeslist of strings β the list of changed files/directories in the commit. Each string is a path, and it can optionally be prepended with:(A)for added paths(M)for modified paths(D)for deleted paths
If you don't give any prefix, modification is assumed. And there's an extra plus sign that flags property changes (that's the Subversion-specific term, iykyk), like "(M+)".
extramap β a map with additional parameters. Currently the supported members are:web_linkβ a URL with commit details (like gitweb or viewvc π).use_irc_noticesβ a flag for whether to use IRC notices instead of regular messages.use_colorβ a flag for whether to use colors when sending commit notifications. Defaults to1π.
π¨ relay_message message
This method takes exactly one string argument, and that string is the message to relay to IRC. No restrictions, no requirements on the content β it gets relayed verbatim to the project's IRC channels. Say whatever, it's going through π .
π ERRORS π
Errors reported on HTTP level
- Authentication errors use HTTP code
401. - Every other error β bad or missing headers, and problems with the JSON data β uses HTTP code
400.
The error text lives in the reason phrase of the HTTP status line π (see RFC 2616, section 6.1).
Errors reported on JSON-RPC level
Once authentication has succeeded and the JSON request has been decoded, all the errors get reported exactly as the JSON-RPC specification mandates. No custom drama.
bestie not me having to break the bad news about401and400π but that's just how she works.
π AUTHOR π
Damyan Ivanov dmn@debian.org
π COPYRIGHT & LICENSE π
Copyright (C) 2012 Damyan Ivanov
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
and that's the whole page bestie π this one's from perl v5.40.1, dated 2026-07-10, and yeah β it's literally KGB-PROTOCOL(7p). go off, you understood all of it, so proud πβ¨π¦
π¦ where this page comes from
- ubuntu stonking: kgb-bot 1.62-4 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms