Skip to content

fix: platform API compliance, UI/input bugs, and security hardening (25 confirmed findings) - #8

Merged
jpalanco merged 3 commits into
mainfrom
claude/platform-api-compliance-c15dfc
Jul 31, 2026
Merged

jpalanco merged 3 commits into
mainfrom
claude/platform-api-compliance-c15dfc

Conversation

@jpalanco

Copy link
Copy Markdown
Contributor

Summary

Result of a full compliance + quality pass on the TUI: verified against the live Platform API backend (Gitea source + a running FastAPI pod, not just the docs site, which had gaps), live-tested the built binary against staging across every screen, ran a multi-agent codebase analysis (144 agents across 6 dimensions), and put the findings through a consensus-critic pass (3 skeptical reviewers per finding) to discard false positives before fixing anything. 25 findings confirmed and fixed.

  • API compliance — sort query param now actually reaches the backend (was computed client-side and silently dropped); CVSS filter bounds no longer floored to integers; nullable nickname/uri/title/date/repo_id no longer crash response parsing; getScmRepos null-guards per-provider mappings and fixes a pagination bug where the null-filtered count (instead of the raw page size) was used to decide whether to fetch another page.
  • UI/input handling — StatusModal's Escape now respects inputMode instead of firing unconditionally; the SCM repo-picker's search box no longer races its own j/k/space navigation handler (two independent useInput hooks were both consuming the same keystrokes); gg/G jump shortcuts are wired up; the filter modal's status list was missing ready; DiffModal uses the theme accent instead of a hardcoded yellow; removed a redundant any-key dismiss handler and some dead state (activePanel/Panel/helpOpen) that just mirrored inputMode.
  • Security — warn when --token is passed on argv (CWE-214, visible via ps/procfs) and point at PLEXICUS_TOKEN; made the login-redirect CSRF nonce single-use. WS-auth-token-in-URL and language/category filter casing were investigated and documented as backend-only constraints (confirmed via the platform repo's source) rather than faked with a client-side fix that wouldn't actually be correct.
  • Consistency — friendlyError() is now applied at all 16 user-facing error sites (was 1); extracted createApiClient()/useFindingActions() to remove API-client-construction and suppress/false-positive duplication across 8+ call sites.
  • Tests — added 27 new tests covering fetch()'s error handling, buildFilterQuery()'s query serialization, getRemediations()'s response-shape normalization, the 2FA login branch, and getScmRepos' field mapping — none of this had coverage before (the existing suite only exercised MOCK_PLEXICUS=1 fixture paths).

Test plan

  • bun run typecheck — clean
  • bun test — 80/80 passing (27 new)
  • Built the binary and smoke-tested against staging: repo list load, findings sort (end-to-end priority ordering across pages), filter modal (ready status visible), help open/dismiss, gg/G navigation, finding detail drill-in — all confirmed working against real data
  • Suppress/false-positive/remediation actions were intentionally not exercised live (they write real state to shared staging data); covered instead by the new unit tests around the underlying API methods

jpalanco added 3 commits July 31, 2026 22:59
Delete unused command modules (login/repos/filter/theme), an unused
ThemedBox component, and an unused useFuzzy hook, found via automated
dead-code analysis and cross-verified by hand. Un-export types/consts
that are only used within their own module and drop the now-unused
figures/ink-text-input/react-dom deps.
…, UI, and security

25 findings confirmed by a consensus-critic pass (3 skeptical reviewers
per finding) over a prior deep multi-agent analysis, all fixed:

API compliance:
- Send the sort query param to the backend (Zalando-style +/-field,
  mapped to real Mongo field names) — sort_by/sort_dir were computed
  client-side but never reached the API.
- Stop flooring CVSS filter bounds to integers.
- Tolerate null nickname/uri/title/date/repo_id in API responses
  instead of throwing on parse.
- Null-guard getScmRepos' per-provider response mapping and fix its
  pagination to check the raw (not null-filtered) page size.
- Document why WS auth token and language/category filter casing
  can't be fixed client-side (backend-only query-param support /
  no stable casing convention across scanner tools).

UI/input handling:
- Gate StatusModal's Escape handler by inputMode, matching the
  isActive pattern used elsewhere (it was firing unconditionally).
- Stop SCMConnectFlow's repo-search textbox from racing with its own
  j/k/space navigation handler; add scroll windowing past 12 repos.
- Wire up the gg/G jump-to-top/bottom shortcuts in the repo and
  findings lists (handlers existed in useKeymap but nothing called them).
- Add the missing "ready" status to the filter modal's checklist.
- Fix Tab not submitting SmartTextInput fields.
- Use the theme accent color in DiffModal instead of a hardcoded yellow.
- Remove KeybindingsHelp's redundant any-key dismiss handler now that
  App's inputMode==='help' gate already owns it.
- Remove dead activePanel/Panel/helpOpen state that mirrored inputMode.

Security:
- Warn when --token is passed on argv (CWE-214: visible via ps/procfs)
  and point users at PLEXICUS_TOKEN instead.
- Make the login-redirect CSRF nonce single-use.

Consistency/maintainability:
- Apply friendlyError() at all 16 user-facing error sites instead of 1.
- Extract createApiClient()/useFindingActions() to remove the
  loadConfig+PlexicusApi construction and suppress/false-positive
  logic duplicated across 8+ call sites.
… remediation-shape normalization

The existing plexicusApi.test.ts only exercises MOCK_PLEXICUS=1
fixture paths, so fetch()'s error handling, buildFilterQuery()'s
query-param construction, and getRemediations()'s several response-
shape normalizations had zero coverage. Mock global fetch directly
(bypassing MOCK_MODE via a cache-busting dynamic import) to test the
real code paths: 401/error/network-failure handling, severity/status/
CVSS/sort query serialization, remediation envelope normalization,
the 2FA login branch, getScmRepos' per-provider field mapping and
null-guarding, and the new nullable-field schema fallbacks.
@jpalanco
jpalanco merged commit 6f50b41 into main Jul 31, 2026
1 check passed
@vinyex
vinyex deleted the claude/platform-api-compliance-c15dfc branch August 1, 2026 11:39
jpalanco pushed a commit that referenced this pull request Oct 24, 2026
… flow, keychain storage, revoking logout' (#8) from auth-v1-login into main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant