Conversation
MrCloudSec
left a comment
There was a problem hiding this comment.
Hey @RajChowdhury240, nice work on this! The per-user card layout is really solid for IR triage.
Found a few things while testing that are worth cleaning up:
-
--verboseswapping the output format: typically--verbosejust means more logging, not a different report. I'd keep the standard table as the output and only use verbose to toggle the[INFO]/[CRED]/[POLICY]log lines. If we want the detailed view in the CLI, we could add a--detailedflag later. -
bks --verbose scandoesn't work: the scan command only checks its own localverboseparam, so the group-level flag gets ignored. Usingctx.obj.verbosefor the check fixes this. -
The
ctx.obj._scanner = Nonereset: this isn't needed sinceverbosegets set onctx.objbefore the scanner is lazily created. Removing it also avoids creating a duplicate AWS session. -
Spinner and log lines stepping on each other: the
[INFO]lines go throughclick.echo()while the spinner writes to stderr, so you get⠼ Scanning[INFO] Found phantom user.... The spinner needs to clear/redraw around log output. Alsocheck_credentialshas one strayclick.echo()that should go throughoutput.warning(). -
Small stuff:
"1 access keys"should be"1 access key", and the summary block is duplicated between both report methods (easy to extract into a shared helper).
Happy to help if you have questions on any of these!
|
pushed the changes , can you test it out once and lmk what you think! Thanks |
MrCloudSec
left a comment
There was a problem hiding this comment.
Hey @RajChowdhury240, this is looking solid now. Two small things left:
-
The spinner clears before log output but never redraws after, so it vanishes until the next tick. Just add a redraw after the
click.echoin the log helpers. -
_spinner_active = Falsein thefinallyblock should be inside awith _spinner_lock:to avoid a race with the log helpers.
Both minor, but worth cleaning up since this is what users see first. Rest looks good!
|
Both fixes applied:
Added _redraw_spinner() helper that writes the spinner frame + label back to stderr. Called after every click.echo in info, success, warning, error, and high_risk (lines 34, 41, 48, 55, 62). This prevents the spinner from vanishing between log output and the next spin tick.
|
MrCloudSec
left a comment
There was a problem hiding this comment.
LGTM, thanks @RajChowdhury240 !
The Problem
initially i noticed the readme talks about --verbose mode in scan but it wasnt in place and didnt work properly
Fix Summary
with status, IAM access key IDs, and policy breakdown (managed vs inline)
Motivation
Running bks scan --verbose previously failed with Error: No such option: --verbose. The --verbose flag only
existed at the group level (bks --verbose scan), but users expect it on the subcommand too. The default scan
output is a compact summary table — there was no way to get detailed per-user information without switching to
--json.
Changes
bedrock_keys_security/commands/scan.py
bedrock_keys_security/core/scanner.py
- Added generate_verbose_table_report() method that renders a detailed per-user block including:
- User ID, ARN, full creation timestamp, IAM path
- Bedrock API credential IDs with status and creation date
- IAM access key IDs (red-highlighted for AT RISK users)
- Attached managed and inline policies listed individually
- Color-coded status and summary section
Test plan
Test results after the fix