ifw-api: omit password from curl command in check result

Icinga (DB) Web has a special permission to show the check command line.
Well-written plugins receive passwords via env vars which don't appear even there.
Now ifw-api also hides the password using curl -u USER, not USER:PASS.
The new command is still working, it just prompts for the password.
This commit is contained in:
Alexander Aleksandrovič Klimov 2026-06-01 10:51:39 +02:00 committed by GitHub
parent f63bbec4ab
commit 70f724abde
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -428,11 +428,9 @@ void IfwApiCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
}
if (!username.IsEmpty() && !password.IsEmpty()) {
auto authn (username + ":" + password);
req->set(field::authorization, "Basic " + Base64::Encode(authn));
req->set(field::authorization, "Basic " + Base64::Encode(username + ":" + password));
cmdLine->Add("--user");
cmdLine->Add(authn);
cmdLine->Add(username);
}
auto& io (IoEngine::Get().GetIoContext());