Unauthenticated admin commands exit 0

Open Beginner friendly
#2,669 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
cli

Research direction

Start with src/commands/admin.ts, where requireAuth() handles unauthenticated admin commands, then check the command entry point and existing tests to see how subprocess exit codes are asserted. Add a test that spawns an admin command without credentials and verifies a non-zero exit code; done when the test passes and unauthenticated admin commands return failure.

Written by the indexing model from the issue text.

Description

requireAuth() in src/commands/admin.ts (~line 334) prints "Error: Not authenticated" and returns false, and its 64 call sites do if (!requireAuth()) return;, so an unauthenticated admin command exits 0. A script or CI step cannot tell "not signed in" from success.

Expected: an unauthenticated admin command exits non-zero (set process.exitCode = 1 in the helper, or throw a typed error the top-level handler maps to 1), with a test that spawns one admin command without credentials and asserts the exit code.

Found during the review of #2667 (pre-existing; shared by every admin command).

Dominant language
TypeScript
Stars
0
Forks
1
Avg merge
4h 48m
Merged PRs (30d)
468

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nemarOrg/nemar-cli

All issues in nemarOrg/nemar-cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.