Description
When calling Wazuh_SIEM.Wazuh_SIEM/ListAgents through OctoBus without specifying
username or password, the request fails even though the instance contains valid
secret credentials.
Observed error:
INVALID_ARGUMENT: username and password are required for Wazuh JWT authentication
Root Cause
In services/wazuh__siem/src/wazuh-siem.js, requestWithDefaults does:
const username = firstDefined(req?.username, bindings.username);
const password = firstDefined(req?.password, bindings.password);
Because the proto fields are plain proto3 string fields, omitted fields decode to
empty strings "", not undefined. As a result, an empty request value incorrectly
takes priority over the instance secret.
Expected Behavior
- Explicit non-empty request credentials should override the secret.
- Omitted or empty request credentials should fall back to the instance secret.
Actual Behavior
Empty username and password are sent to the Wazuh Manager API, causing the
manager to reject the request as missing credentials.
Reproduction Steps
- Create a
siem instance with valid secret.username and secret.password.
- Bind it to a capset.
- Call
ListAgents with an empty JSON body:
curl -X POST \
http://127.0.0.1:9000/capsets/dev/connect/wazuh-jxq/Wazuh_SIEM.Wazuh_SIEM/ListAgents \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <redacted-token>' \
-d '{}'
- Observe the missing-credentials error.
Suggested Fix
Treat empty strings as absent when merging request credentials:
const requestCredential = (value) => (
value === undefined || value === null || value === '' ? undefined : value
);
const username = firstDefined(requestCredential(req?.username), bindings.username);
const password = firstDefined(requestCredential(req?.password), bindings.password);
Environment
- Repository:
chaitin/OctoBus
- Service:
services/wazuh__siem
- Upstream commit:
43f0aca70cef817f69a7d90c220c699a99af7aca
- OctoBus image:
ghcr.io/chaitin/octobus:latest
- Wazuh API:
4.10.0
Additional Context
ListAlerts, GetAlertSummary, ListVulnerabilities, and
GetVulnerabilitySummary may be affected anywhere Manager JWT credentials are
loaded through the same requestWithDefaults path.
Description
When calling
Wazuh_SIEM.Wazuh_SIEM/ListAgentsthrough OctoBus without specifyingusernameorpassword, the request fails even though the instance contains validsecret credentials.
Observed error:
Root Cause
In
services/wazuh__siem/src/wazuh-siem.js,requestWithDefaultsdoes:Because the proto fields are plain proto3
stringfields, omitted fields decode toempty strings
"", notundefined. As a result, an empty request value incorrectlytakes priority over the instance secret.
Expected Behavior
Actual Behavior
Empty
usernameandpasswordare sent to the Wazuh Manager API, causing themanager to reject the request as missing credentials.
Reproduction Steps
sieminstance with validsecret.usernameandsecret.password.ListAgentswith an empty JSON body:Suggested Fix
Treat empty strings as absent when merging request credentials:
Environment
chaitin/OctoBusservices/wazuh__siem43f0aca70cef817f69a7d90c220c699a99af7acaghcr.io/chaitin/octobus:latest4.10.0Additional Context
ListAlerts,GetAlertSummary,ListVulnerabilities, andGetVulnerabilitySummarymay be affected anywhere Manager JWT credentials areloaded through the same
requestWithDefaultspath.