Repository navigation
fix(branch): keep database_password out of --json output - #303
Abhishek-B-R wants to merge 2 commits into
Conversation
branch reset, branch create and branch list printed the branch object straight from the API, including the plaintext database_password. Strip it before printing.
|
Thanks for the PR, @Abhishek-B-R! This links #235, but that issue isn't assigned to anyone yet. Our workflow is claim the issue first, then submit the PR. It'll still be reviewed — to keep ownership clear, comment on the issue that you'd like it assigned to you. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (7)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughBranch create, list, and reset commands now remove ChangesBranch JSON redaction
Priority: ⬆️ High Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: High Suggested reviewers: Merge Risk: ⚪ Minimal · up to Branch JSON output omits the database password, and no issue requiring a change before merge was identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit checks the branch JSON stream, Comment |
|
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
I'd like to take this one, could you assign it to me? I've already opened #303 with a fix (adds a |
|
@tonychang04 friendly bump: the needs-claim label is cleared and the cubic/greptile findings are addressed (greptile 5/5). The CI workflow is waiting on maintainer approval to run, and after that it only needs a review. Happy to adjust anything if the approach doesn't fit. |
Problem
branch reset <name> --jsonprints the branch object exactly as the API returns it, which includes the plaintextdatabase_password.branch create --jsonandbranch list --jsonprint branch objects the same way, so the same value can show up there too. Command output ends up in scrollback, CI logs and captured run artifacts, none of which treat it as secret.Fix
A small
redactBranchhelper insrc/commands/branch/redact.tsreturns a copy of the branch withoutdatabase_password, andbranch reset,branch createandbranch listrun their JSON output through it. The password is omitted rather than masked, following the first option in the issue: nothing in the CLI reads it from these responses, so there is no masked form anyone needs. The human readable output never printed the branch object, so it is unchanged.branch switchandbranch deleteonly print ids.This removes a field from the
--jsonoutput of those three commands. I checkedInsForge/agent-skillsand it doesn't mentiondatabase_password, so no skill update is needed.Tests
One new test each in
reset.test.ts,create.test.tsandlist.test.ts: the mocked API returns a branch with adatabase_password(two branches in the list test), and the test checks the JSON output still has the branch but not the password. All three fail on main.After rebasing on main (b9c28c3):
npx vitest run: 829 passed, 14 skipped (826 on main, plus the 3 new ones)npx eslint src/: cleannpm run build: succeedsnpx tsc --noEmit: the same 12 errors that exist on main, none newCloses #235
Summary by cubic
Stops
branch reset,branch create, andbranch listfrom leaking the branch's plaintextdatabase_passwordin--jsonoutput. The branch object is now passed through aredactBranchhelper that omits the field before printing, since command output ends up in CI logs and scrollback.Breaking changes
--jsonoutput of those three commands no longer includesdatabase_password; human-readable output is unchanged andbranch switch/branch deleteonly print ids.Written for commit 10bea78. Summary will update on new commits.
Summary by CodeRabbit