Skip to content

fix: harden kit login, honor set-per-page, add Dependabot - #35

Merged
imjohnbo merged 3 commits into
mainfrom
bug-fixes
Sep 21, 2026
Merged

imjohnbo merged 3 commits into
mainfrom
bug-fixes

Conversation

@imjohnbo

Copy link
Copy Markdown
Owner

Summary

Six bug fixes from an audit of the repo. Each fix landed with a failing test first.

  • kit config set-per-page had no effect. addPaginationOptions() hardcoded the --per-page default to 50. List commands now default to the configured value.
  • The OAuth callback never checked state. login() sent it, but the callback server accepted any request that carried a code. A wrong or missing state now gets a 400 and rejects the login.
  • The callback server listened on every interface. It now binds to 127.0.0.1. docs/callback.html redirects to 127.0.0.1 to match.
  • A successful kit login kept the process alive for 5 minutes. The login timer was never cleared. It is cleared as soon as the callback lands.
  • kit login never opened a browser on Windows. execFile('start', ...) fails with ENOENT because start is a cmd.exe builtin, and execFile swallowed the error. Windows now launches through rundll32 url.dll,FileProtocolHandler <url>, with no shell in the path. When a launch fails on any platform, the CLI prints the URL to open by hand.
  • No Dependabot config. release.yml and docs/RELEASING.md rely on Dependabot to move the SHA-pinned actions, but no dependabot.yml existed. Added for github-actions and npm, weekly.

waitForCallback, browserCommand, and openBrowser are now exported with injectable port, host, timeoutMs, and run, so the tests drive a real callback server on an ephemeral port.

Not changed here: spec/cli-surface.json is stale in key order only, since it predates the help-group reordering in c1173f0. The suite compares with deepEqual, so it stays green. npm run surface would re-sort it.

Test plan

  • npm test: 35 files, 813 tests, 812 pass, 1 skipped by design on macOS
  • Each new test watched failing before the fix
  • npm audit: 0 vulnerabilities
  • Manual: kit login on macOS completes and the process exits right away
  • Manual: kit login on Windows opens the default browser
  • Manual: kit config set-per-page 25 then kit tags list --format json returns 25 rows
  • Dependabot opens its first PRs after this merges

The command stored the value, but addPaginationOptions() hardcoded the
--per-page default to 50 and nothing read getPerPage(). List commands now
default to the configured value.
The callback server accepted any request that carried a code. It never
compared the returned state with the one login() sent, and it listened on
every interface, so a request from another host on the network could
complete a login. It now binds to 127.0.0.1 and rejects a callback whose
state is missing or wrong.

The 5-minute login timer was never cleared, so a successful kit login kept
the process alive for the rest of those 5 minutes. The timer is cleared as
soon as the callback lands.

On Windows, openBrowser() ran execFile('start', ...). start is a cmd.exe
builtin, not a program, so the spawn failed with ENOENT and execFile
swallowed the error. Login then waited 5 minutes for a browser that never
opened. Windows now launches through rundll32, which takes the URL as a
plain argument with no shell escaping. When a launch fails on any platform,
the CLI prints the URL so the user can open it by hand.

docs/callback.html redirects to 127.0.0.1 to match the bind address.
release.yml and docs/RELEASING.md pin every action to a commit SHA and say
Dependabot moves the pins. No dependabot.yml existed, so the pins never
moved. A test holds the config to the two ecosystems the repo uses.
@imjohnbo
imjohnbo merged commit ef8df99 into main Sep 21, 2026
2 checks passed
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