bitwarden / cli

The command line vault (Windows, macOS, & Linux).
https://bitwarden.com
GNU General Public License v3.0
1.62k stars 174 forks source link

Serve command fixes #492

Closed kspearrin closed 2 years ago

kspearrin commented 2 years ago

Type of change

Objective

Resolve open Asana issues related to new serve command.

Code changes

Issues related to commands handing were mostly related to asynchronous recursive loops that were fixed with https://github.com/bitwarden/jslib/commit/fc0638a7d95e9e678cc125d5186c1dcd8fdad7e6 .

This change also transitions from express.js to koa (made by the same developers as express) for the web server for better async/await support.

The decision was made to do away with the Session header option since serve commands are not completely stateless (things are cached within the process memory, for example).

Finally, I added some checks to make sure errors around certain conditions are handled more gracefully. Namely, checking to make sure the vault is in an unlocked state before trying to execute dependent commands, such as list.

Testing requirements

Test all commands and options related to the HTTP server exposed by the serve command.

Before you submit