Skip to content

Add -o --output parameters to DB seeder util for preset command#7495

Merged
theMickster merged 6 commits intomainfrom
add-output-flag-db-seeder-util
Apr 22, 2026
Merged

Add -o --output parameters to DB seeder util for preset command#7495
theMickster merged 6 commits intomainfrom
add-output-flag-db-seeder-util

Conversation

@mimartin12
Copy link
Copy Markdown
Contributor

@mimartin12 mimartin12 commented Apr 17, 2026

🎟️ Tracking

📔 Objective

When working with some automation and the DB seeder utility around the preset command, I found it was hard to get machine-readable output in the existing format while using the preset command. This adds a new parameter for output, used with -o, --output with a new args json, text (default).

Using if (!Console.IsOutputRedirected) in conjunction with a JSON output lets us pipe directly into tools like jq to grab what we need.

For example:

# Get all org presets
dotnet run preset --list -o json | jq -r '.organization[]'

# Get all individual presets
dotnet run preset --list -o json | jq -r '.individual[]'

📸 Screenshots

… readable output when piping into other tooling
@mimartin12 mimartin12 added the ai-review Request a Claude code review label Apr 17, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 17, 2026

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed the addition of -o/--output flag to the SeederUtility preset --list command, which supports text (default) and json output formats. Changes include a new OutputFormat enum, validation in PresetArgs, JSON serialization in PresetCommand.PrintAvailablePresets, and routing the startup banner to stderr so stdout stays clean for piping into tools like jq. Previous reviewer feedback on the enum file placement, the -o short option collision, and the IsOutputRedirected check has been addressed.

Code Review Details

No blocking findings. The change is small, self-contained, and limited to a dev utility. Validation and parsing are consistent (TryParse in Validate() guards the Enum.Parse in GetOutputFormat()), and the JSON output path writes only the serialized payload to stdout so downstream piping works as described in the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 17, 2026

Logo
Checkmarx One – Scan Summary & Detailsbbcfe674-952e-49c1-b9ff-e8e8ab2ccd28


New Issues (2) Checkmarx found the following issues in this Pull Request
# Severity Issue Source File / Package Checkmarx Insight
1 MEDIUM CSRF src/Api/AdminConsole/Controllers/GroupsController.cs: 289
detailsMethod at line 289 of /src/Api/AdminConsole/Controllers/GroupsController.cs gets a parameter from a user request from orgUserId. This parameter ...
Attack Vector
2 MEDIUM CSRF src/Api/Vault/Controllers/CiphersController.cs: 287
detailsMethod at line 287 of /src/Api/Vault/Controllers/CiphersController.cs gets a parameter from a user request from id. This parameter value flows t...
Attack Vector

Fixed Issues (2) Great job! The following issues were fixed in this Pull Request
Severity Issue Source File / Package
MEDIUM CSRF src/Api/AdminConsole/Controllers/GroupsController.cs: 275
MEDIUM CSRF src/Identity/Controllers/AccountsController.cs: 138

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.13%. Comparing base (e1c67a4) to head (75ae63b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7495   +/-   ##
=======================================
  Coverage   59.13%   59.13%           
=======================================
  Files        2077     2077           
  Lines       91848    91848           
  Branches     8175     8175           
=======================================
+ Hits        54315    54316    +1     
+ Misses      35601    35600    -1     
  Partials     1932     1932           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mimartin12 mimartin12 marked this pull request as ready for review April 17, 2026 17:38
@mimartin12 mimartin12 requested a review from theMickster April 17, 2026 18:33
Copy link
Copy Markdown
Contributor

@theMickster theMickster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple things to change and one point of discussion to clarify

Comment thread util/SeederUtility/Program.cs Outdated
Comment thread util/SeederUtility/Commands/PresetArgs.cs Outdated
Comment thread util/SeederUtility/Commands/PresetArgs.cs Outdated
@sonarqubecloud
Copy link
Copy Markdown

@mimartin12 mimartin12 requested a review from theMickster April 22, 2026 16:58
@theMickster theMickster merged commit c587d25 into main Apr 22, 2026
50 of 51 checks passed
@theMickster theMickster deleted the add-output-flag-db-seeder-util branch April 22, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants