Skip to content

feat(engine): loginBasicAuth flag for LOGIN_TOKEN logins - #1460

Merged
helpcodeai merged 4 commits into
HelpCode-ai:mainfrom
GallaGit:engine/login-basic-auth
Nov 3, 2026
Merged

helpcodeai merged 4 commits into
HelpCode-ai:mainfrom
GallaGit:engine/login-basic-auth

Conversation

@GallaGit

@GallaGit GallaGit commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Adds an opt-in loginBasicAuth: true flag to the LOGIN_TOKEN login config, as agreed in #982. When set, the engine sends Authorization: Basic base64(username:password) on the login request only. The credentials never go through templates (${password} resolves empty), and no body is sent unless loginBody is defined.

Validation (engine, validate-adapters rule login-basic-auth, catalog.spec)

  • An explicit Authorization in loginHeaders together with the flag is rejected before any request, so there's never doubt about which credentials the provider gets.
  • Also rejected: a non-boolean flag value, combining it with signedJwt or bcrypt passwordHashing, a username containing :, a missing username/password param, and ${password} in loginBody.

Secrets handling: on login failure the error is sanitised (message, config and response headers, request._header) and keeps the status. Debug logs mask the credentials.

Docs: docs/tool-definition.md and docs/connectors/login-token-auth.md.

Tests

  • login-token.service.spec: 71/71, 7 new tests.
  • Engine, catalog and adapters specs: 44 suites, 15,609 tests passing.
  • validate-adapters.test.mjs: 32/32.
  • tsc and eslint: clean.

Known gap (out of scope): the connector edit page (connectors/[id]/page.tsx) rebuilds authConfig without advanced fields, so editing would drop loginBasicAuth, the same way it already drops loginHeaders. Happy to fix that in a follow-up.

The Wazuh adapter (#982) will follow on top of this.

… login request (HelpCode-ai#982)

LOGIN_TOKEN logins that take Basic credentials (Wazuh POST /security/user/authenticate) set loginBasicAuth: true. The engine builds Authorization: Basic base64(username:password) for the login call only; the password is not offered to body templates and no body is sent without loginBody. An Authorization in loginHeaders is refused (as are signedJwt, bcrypt passwordHashing and a username with ':') rather than silently overridden. Failed login errors are scrubbed of the header and the encoded credentials. validate-adapters (rule login-basic-auth) and catalog.spec check the same.

@helpcodeai helpcodeai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @GallaGit, this is what we agreed in #982, and the code reads well. The engine builds the header itself, the conflicting configurations are refused before any request, and outbound-http.ts already drops Authorization on a cross-origin redirect.

One CI failure, and it comes from the docs change: docs/tool-definition.md and docs/connectors/login-token-auth.md feed llms-full.txt, so the backend job stops at node scripts/generate-llms-txt.mjs --check with "llms-full.txt is stale". Lint, typecheck and Jest have not run in CI yet because of that.

The branch is also behind main. Please merge main, then run:

node scripts/generate-llms-txt.mjs

and commit the regenerated llms-full.txt. Once the checks are green I'll merge it.

A follow-up PR for the connector edit page, so it keeps loginBasicAuth and loginHeaders, is welcome. After that, the Wazuh adapter.

@GallaGit

GallaGit commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

FYI: the Wazuh adapter that uses this flag is up as a draft in #1461, stacked on this branch. I'll rebase it onto main and mark it ready once this one merges.

@helpcodeai helpcodeai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good. The Basic header is built only from the username and password, it never goes through templates, conflicting settings are refused, and the error is cleaned before it travels on.

One thing blocks the merge: the backend CI fails at "Verify generated AI documentation is up to date", because docs/tool-definition.md changed. Please run node scripts/generate-llms-txt.mjs from the repository root, commit the regenerated files, and merge the latest main into the branch. Then I'll merge it.

The edit page dropping loginBasicAuth is fine as a follow-up.

@helpcodeai

Copy link
Copy Markdown
Contributor

I merged the latest main into your branch and committed the regenerated llms-full.txt myself, so you don't need to push anything for this. I'll merge once CI is green.

@helpcodeai helpcodeai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @GallaGit. Checked again after the regenerated docs: the Basic header is built only from the username and password, conflicting settings are refused before any request, and the credentials are scrubbed from errors. CI is green, merging.

@helpcodeai
helpcodeai merged commit f73fe38 into HelpCode-ai:main Nov 3, 2026
14 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 3, 2026
@helpcodeai

Copy link
Copy Markdown
Contributor

Merged, thanks @GallaGit. You can rebase the Wazuh adapter in #1461 onto main now and mark it ready when CI is green.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants