fix(hub): print direct local login link on startup#363
fix(hub): print direct local login link on startup#363Sun-sunshine06 wants to merge 1 commit intotiann:mainfrom
Conversation
There was a problem hiding this comment.
Findings
- [Major] Startup log now prints tokenized login URL every run;
CLI_API_TOKENends up in logs even when sourced from env/file. Evidencehub/src/index.ts:232
Suggested fix:if (config.cliApiTokenIsNew || process.env.HAPI_LOG_TOKENS === 'true') { console.log('[Web] Login: ' + localDirectAccessUrl) }
Summary
- Review mode: initial. 1 major issue: token logged each startup; gate behind opt-in or only on new token.
Testing
- Not run (automation)
| console.log('[Web] Hub listening on :' + config.listenPort) | ||
| console.log('[Web] Local: http://localhost:' + config.listenPort) | ||
| console.log('[Web] Local: ' + localUrl) | ||
| console.log('[Web] Login: ' + localDirectAccessUrl) |
There was a problem hiding this comment.
[MAJOR] Startup log prints tokenized login URL every run; CLI_API_TOKEN ends up in logs even when sourced from env/file. Evidence hub/src/index.ts:232.
Suggested fix:
if (config.cliApiTokenIsNew || process.env.HAPI_LOG_TOKENS === 'true') {
console.log('[Web] Login: ' + localDirectAccessUrl)
}|
Useful feature — the local login link is a nice DX improvement, and the code is well-structured (extracted utility + tests). One concern: the token is printed in plain text in the terminal log. ``` If the user shares terminal output (e.g. in a bug report, screenshot, or log aggregation), the token leaks. For a local-only scenario the risk is low, but worth considering:
This may be an acceptable tradeoff for the maintainer to decide — just flagging the risk. |
Summary
Print a direct local login link when HAPI Hub starts, and update CLI guidance to point users to that startup output.
Why
When HAPI Hub is opened remotely or through a browser on another device, it can be inconvenient to manually find the access token in local config files.
A startup login URL makes first-time access much easier.
Changes
Notes
Testing
cd hub && bun test src/utils/directAccess.test.tsbun typecheck