Conversation
e8caa86 to
dba2ea5
Compare
Add support for managing Bitwarden entries using raw JSON or YAML structures.
This enables advanced workflows like batch importing, editing complex entries
(e.g., cards, identities, SSH keys) with custom fields, and managing password
history directly from the command line or via automation scripts.
Key changes:
- Add `--raw` (JSON) and `--yaml` (YAML) options to `rbw add` and `rbw edit`.
- Add `--yaml` option to `rbw get`.
- Implement strict validation for raw structures:
- Prevent unrecognized fields using `deny_unknown_fields` on all decrypted structs.
- Enforce mandatory fields (Field Name, Field Value, and Field Type) in `DecryptedField`
by refactoring them to non-Option types, ensuring compile-time and runtime strictness.
- Automatically generate a rich JSON Schema at runtime in YAML mode:
- Write it to `schema.json` in the temp editing directory.
- Inject the `# yaml-language-server: $schema=./schema.json` comment at the
top of the YAML buffer to enable autocompletion and tooltips in editors.
- Add descriptive titles and detailed tooltips to all schema fields.
- Format all multi-line strings (such as notes and SSH private keys) using
YAML block literals (`|`) automatically.
- Ensure `--raw` and `--yaml` flags are mutually exclusive across all commands.
- Expand library layer (`Client::add`, `rbw::actions::add`) to support custom
fields, history, organization IDs, and different entry types when adding.
- Clean up display logic in `commands.rs` by introducing `display_custom_field`
helper, eliminating over 50 lines of duplicate boilerplate loops.
- Add robust unit tests `test_raw_yaml_serde` and `test_strict_validation` to
verify serialization, block literals, schema generation, and strict validation failures.
- Update deny.toml to allow multiple versions of indexmap and hashbrown to coexist (due to schemars depending on v1 and petgraph/serde_yaml depending on v2).
- Upgrade rustls-webpki (to v0.103.13), bytes (to v1.11.1), and rand (to v0.8.6 and v0.9.4) to patched versions in Cargo.lock to resolve cargo-deny security advisories, and update deny.toml to skip the new rand versions.
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.
Add support for managing Bitwarden entries using raw JSON or YAML structures.
This enables advanced workflows like batch importing, editing complex entries
(e.g., cards, identities, SSH keys) with custom fields, and managing password
history directly from the command line or via automation scripts.
Key changes:
--raw(JSON) and--yaml(YAML) options torbw addandrbw edit.--yamloption torbw get.deny_unknown_fieldson all decrypted structs.DecryptedFieldby refactoring them to non-Option types, ensuring compile-time and runtime strictness.
schema.jsonin the temp editing directory.# yaml-language-server: $schema=./schema.jsoncomment at thetop of the YAML buffer to enable autocompletion and tooltips in editors.
YAML block literals (
|) automatically.--rawand--yamlflags are mutually exclusive across all commands.Client::add,rbw::actions::add) to support customfields, history, organization IDs, and different entry types when adding.
commands.rsby introducingdisplay_custom_fieldhelper, eliminating over 50 lines of duplicate boilerplate loops.
test_raw_yaml_serdeandtest_strict_validationtoverify serialization, block literals, schema generation, and strict validation failures.