Skip to content

Remove secret character counts from log output#9

Merged
shiftcontrol-dan merged 3 commits intomainfrom
fix/remove-secret-char-count-from-logs
Mar 17, 2026
Merged

Remove secret character counts from log output#9
shiftcontrol-dan merged 3 commits intomainfrom
fix/remove-secret-char-count-from-logs

Conversation

@shiftcontrol-dan
Copy link
Contributor

Summary

  • Remove character count from info! log when resolving secrets (e.g., resolved ANTHROPIC_API_KEY (108 chars)resolved ANTHROPIC_API_KEY)
  • Remove character count from debug! log when writing secrets via op item edit
  • Leaking secret length helps attackers identify credential types and narrow brute-force space

Test plan

  • cargo check passes
  • Deploy and verify log output no longer includes char counts

@amazon-inspector-singapore
Copy link

⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done

@amazon-inspector-singapore
Copy link

✅ I finished the code review, and didn't find any security or code quality issues.

Logging the character count of resolved secrets leaks information about
secret size, which can aid attackers in identifying or narrowing down
credential types. Strip the char count from both the info-level resolve
log and the debug-level write log.

Signed-off-by: Dan Gericke <dan@shiftcontrol.io>
op_write now detects "item not found" errors from `op item edit` and
falls back to `op item create --category=password`. This supports new
OAuth credentials that don't have a pre-existing 1Password item.

Also zeroizes the assignment string containing the secret value after
CLI invocation, and extracts the error detection marker to a constant.

Signed-off-by: Dan Gericke <dan@shiftcontrol.io>
@shiftcontrol-dan shiftcontrol-dan force-pushed the fix/remove-secret-char-count-from-logs branch from 629e14e to 1265f5e Compare March 17, 2026 12:08
Signed-off-by: Dan Gericke <dan@shiftcontrol.io>
@shiftcontrol-dan shiftcontrol-dan merged commit bf70a88 into main Mar 17, 2026
4 checks passed
@shiftcontrol-dan shiftcontrol-dan deleted the fix/remove-secret-char-count-from-logs branch March 17, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant