Compare commits

..

1 Commits

Author SHA1 Message Date
31dac5f81b fix(xmpp): obfuscate client identity in protocol exchanges
Some checks failed
CI Code / Check spelling (pull_request) Successful in 13s
CI Code / Check coding style (pull_request) Successful in 22s
CI Code / Code Coverage (pull_request) Failing after 10m3s
CI Code / Linux (debian) (pull_request) Failing after 13m2s
CI Code / Linux (ubuntu) (pull_request) Failing after 13m10s
CI Code / Linux (arch) (pull_request) Failing after 21m33s
Modify version responses to return a generic client name and omit
version strings. Drop the "profanity." prefix from dynamically
generated JID resources. Clear the XEP-0115 capabilities node URI to
prevent service discovery fingerprinting. These adjustments reduce the
client's attack surface by minimizing identifiable metadata.
2026-07-09 16:38:27 +00:00

View File

@@ -32,7 +32,6 @@
static void _stanza_add_unique_id(xmpp_stanza_t* stanza);
static gchar* _stanza_create_sha1_hash(char* str);
static const char* _stanza_get_caps_node(const char* const client);
#if 0
xmpp_stanza_t*
@@ -1991,44 +1990,6 @@ stanza_attach_last_activity(xmpp_ctx_t* const ctx,
xmpp_stanza_release(query);
}
static const char*
_stanza_get_caps_node(const char* const client)
{
if (!client || g_strcmp0(client, "") == 0) {
static const char* pidgin_node = "http://pidgin.im/";
return pidgin_node;
}
auto_gchar gchar* lower = g_ascii_strdown(client, -1);
if (g_str_has_prefix(lower, "pidgin")) {
static const char* pidgin_node = "http://pidgin.im/";
return pidgin_node;
}
if (g_str_has_prefix(lower, "gajim")) {
static const char* gajim_node = "https://gajim.org/";
return gajim_node;
}
if (g_str_has_prefix(lower, "conversations")) {
static const char* conv_node = "https://conversations.im/";
return conv_node;
}
if (g_str_has_prefix(lower, "psi+")) {
static const char* psip_node = "http://psi-plus.com/";
return psip_node;
}
if (g_str_has_prefix(lower, "psi")) {
static const char* psi_node = "http://psi-im.org/";
return psi_node;
}
return "";
}
void
stanza_attach_caps(xmpp_ctx_t* const ctx, xmpp_stanza_t* const presence)
{
@@ -2037,13 +1998,9 @@ stanza_attach_caps(xmpp_ctx_t* const ctx, xmpp_stanza_t* const presence)
xmpp_stanza_set_ns(caps, STANZA_NS_CAPS);
xmpp_stanza_t* query = stanza_create_caps_query_element(ctx);
ProfAccount* account = accounts_get_account(session_get_account_name());
const char* node = _stanza_get_caps_node(account->client);
account_free(account);
char* sha1 = caps_get_my_sha1(ctx);
xmpp_stanza_set_attribute(caps, STANZA_ATTR_HASH, "sha-1");
xmpp_stanza_set_attribute(caps, STANZA_ATTR_NODE, node);
xmpp_stanza_set_attribute(caps, STANZA_ATTR_NODE, "");
xmpp_stanza_set_attribute(caps, STANZA_ATTR_VER, sha1);
xmpp_stanza_add_child(presence, caps);
xmpp_stanza_release(caps);