[skip ci] fix(serve): add --auth-token flag with secure error handling#232
Closed
[skip ci] fix(serve): add --auth-token flag with secure error handling#232
Conversation
Add --auth-token CLI flag to cortex serve command for API authentication. The token value is never exposed in error messages or logs - when errors occur (e.g., port binding failures), any token values in error output are automatically replaced with [REDACTED]. Changes: - Add --auth-token option to ServeCommand struct - Configure AuthConfig when token is provided - Sanitize all error messages to mask auth token values - Display auth status without exposing token value Fixes PlatformNetwork/bounty-challenge#2193
echobt
pushed a commit
that referenced
this pull request
Jan 27, 2026
echobt
added a commit
that referenced
this pull request
Jan 27, 2026
…#249, #251, #252, #254) (#358) * fix(cortex-tui): use terminal height for Page Up/Down scrolling [skip ci] Fixes bounty issue #2780 Previously, Page Up and Page Down actions scrolled by a hardcoded value of 10 lines regardless of terminal size. This made navigation through long conversations inefficient and did not match standard pagination behavior in tools like less, vim, and VS Code. Now Page Up/Down scroll by (terminal_height - 1) lines, providing the standard context overlap between pages that users expect. * fix(serve): add --auth-token flag with secure error handling [skip ci] Add --auth-token CLI flag to cortex serve command for API authentication. The token value is never exposed in error messages or logs - when errors occur (e.g., port binding failures), any token values in error output are automatically replaced with [REDACTED]. Changes: - Add --auth-token option to ServeCommand struct - Configure AuthConfig when token is provided - Sanitize all error messages to mask auth token values - Display auth status without exposing token value Fixes PlatformNetwork/bounty-challenge#2193 * fix(cortex-cli): warn about missing agent references during session import [skip ci] When importing a session that was exported from a different cortex installation with different agent configurations, the import command now validates agent references and warns the user about missing agents. Changes: - Add 'agent' and 'agent_refs' fields to SessionMetadata export format - Extract @agent mentions from messages during export - Validate agent references during import against locally available agents - Display warning about missing agents but still allow import to proceed - Add comprehensive tests for agent reference validation Fixes PlatformNetwork/bounty-challenge#2194 * fix: batch fixes for issues #2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361, 2362 [skip ci] Fixes: - #2353: JSON format interruption now produces valid JSON with 'interrupted' and 'complete' flags - #2358: CSS pseudo-elements in scrape --selector now return clear error message Issues investigated but already fixed or not reproducible: - #2354: sessions rename command does not exist in CLI - #2355: /dev/tty access not found in codebase - #2356: Already fixed - API key trimming already done on line 220 - #2357: Agent list O(n) is expected behavior for n agents - #2359: mcp add --working-dir flag does not exist - #2360: Session storage already uses fsync for durability - #2361: config set command does not exist in CLI - #2362: OSC 52 clipboard handling not found in codebase * fix: batch fixes for issues #2236, 2238, 2252, 2254, 2255, 2258, 2260, 2271, 2272, 2276 [skip ci] Fixes: - #2236: debug wait now displays waited time in seconds (consistent with --timeout) - #2238: debug snapshot now shows guidance when snapshots directory doesn't exist - #2252: debug config now clarifies 'cortex' provider routes to underlying model provider - #2254: mcp list now includes note that Status shows config state, not health - #2255: debug wait success output now indicates the condition that succeeded - #2258: sessions list now formats model names without date suffixes - #2260: mcp add --env now validates that value is not empty (KEY= rejected) - #2271: mcp list Transport column now truncates with ellipsis indicator - #2272: debug config now mentions --json and --env options in output - #2276: agent show prompt field now properly indents multi-line content * fix: batch fixes for issues #2217, #2219, #2221, #2223, #2225, #2227, #2228, #2230, #2231, #2234 [skip ci] Fixes: - #2217: Use current directory instead of hardcoded /workspace for file_watcher - #2219: Change mcp debug JSON connection status to boolean object structure - #2221: Apply --no-images and --no-links flags to text format output - #2223: Skip empty by_provider, by_model, and tool_usage in stats JSON output - #2225: Only include errors field in mcp debug JSON when there are errors - #2227: Always include path and version fields in debug lsp JSON output - #2228: Include provider prefix in model IDs (e.g., anthropic/claude-sonnet-4) - #2230: Remove redundant 'installation' and 'method' words from uninstall display - #2231: Always include encoding and is_binary fields in debug file JSON - #2234: Show 'unknown' instead of '-' for untested MCP server tool count * fix: batch fixes for issues #2278, 2279, 2283, 2284, 2285, 2290, 2295, 2316, 2317, 2318 [skip ci] Fixes: - #2278: Document that scrape --header (-H) can be specified multiple times - #2279: Add explanation when mcp debug shows empty prompts/resources arrays - #2283: Add 'mcp get' suggestion to mcp add success message - #2284: Skip serializing empty tools/tags/denied_tools in agent list JSON - #2285: Add strong security warning when serve binds to 0.0.0.0 - #2290: Show 'builtin' instead of null for path in agent show for native agents - #2295: Hide Agent Creator banner in non-interactive mode - #2316: Warn users when session file corruption causes truncated messages - #2317: Normalize CRLF/LF line endings when reading agent files - #2318: SKIPPED - --depth flag does not exist in scrape command * fix: batch fixes for issues #2380, 2381, 2382, 2384, 2385, 2391, 2392, 2393, 2394, 2395 [skip ci] Fixes: - #2380: Add stop sequence stripping from response output - #2381: Sort MCP servers alphabetically in list output for deterministic ordering - #2382: Add ModelDeprecated error with suggestions for deprecated models - #2384: Add SELinux detection for permission denied errors with helpful hints - #2385: Add separate connect_timeout support for distinguishing connection vs response timeouts - #2391: Add ProfileSessionState to track and reset state on profile switches - #2392: Add image resolution selection (highest/smallest/all) for srcset handling - #2393: Add headless environment detection for login, always show manual URL - #2394: Fix nested code blocks in markdown export using different fence styles - #2395: Add locking to prevent race condition in concurrent MCP server startup * fix: batch fixes for issues #2363, 2366, 2367, 2368, 2370, 2374, 2376, 2377, 2378, 2379 [skip ci] Fixes: - #2363: Add deep health checks for API connectivity (HealthChecker.check_with_options) - #2366: Add cache bypass headers for PR fetch to handle force-pushed PRs - #2367: Add seed field to CompletionRequest for reproducible tool calls - #2368: Improve sensitive env var redaction in debug commands - #2370: Add --include-shadow-dom flag for scrape command - #2374: Add --dry-run flag with comprehensive token estimates - #2376: Add layout-aware keyboard shortcuts (matches_char, is_ctrl_char) - #2377: Support custom pricing via CORTEX_PRICING_* environment variables - #2378: Detect cgroup CPU limits for container environments - #2379: Support GitHub Enterprise Server via GITHUB_ENTERPRISE_URL env var * fix: batch fixes for issues #2329, 2330, 2339, 2342, 2344, 2345, 2346, 2347, 2349, 2352 [skip ci] Fixes: - #2329: Document DNS isolation in seccomp (DNS blocked via socket/connect filters) - #2330: Use microsecond precision timestamps for session exports - #2339: Add tests confirming tilde only expanded at path start - #2342: Add content negotiation middleware returning 406 for unsupported Accept headers - #2344: Add file locking (fs2) to prevent session storage corruption - #2345: Handle Windows file lock during upgrade with delayed replacement - #2346: Extract lazy-loaded image URLs from data-src attributes - #2347: Add agent edit subcommand with YAML validation after editing - #2349: Note: Requires significant changes to implement fish history integration - #2352: Add --capabilities filter for models list command * fix: add missing seed field to CompletionRequest initializers --------- Co-authored-by: Bounty Bot <bounty-bot@factory.ai> Co-authored-by: Droid Agent <droid@factory.ai>
Contributor
Author
|
Merged as part of batch PR #358 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the
--auth-tokenCLI flag to thecortex servecommand, with proper security measures to prevent token leakage in error messages.Changes
--auth-tokenoption toServeCommandstruct for API authenticationAuthConfigwhen token is provided to enable server authentication[REDACTED])Security
When errors occur (e.g., port binding failures), any token values that might appear in error output are automatically masked. This prevents accidental token exposure in:
Related
Fixes PlatformNetwork/bounty-challenge#2193