fix(cve): use base64 -w 0 to prevent newline-broken auth headers#106
fix(cve): use base64 -w 0 to prevent newline-broken auth headers#106angaduom wants to merge 0 commit intoambient-code:mainfrom
Conversation
|
Caution Review failedFailed to post review comments WalkthroughAdds a new interactive /onboard command; reworks Jira access checks to prefer an MCP-based workflow with a curl fallback; tightens cve.fix flow (mandatory step ordering, --automerge, fork/sync robustness, post-fix verification blocking PRs); updates startupPrompt and README guidance. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant OnboardCmd as /onboard
participant MCP as MCP Tool
participant Jira
participant GH as GitHub (gh)
participant Repo as ambient-code/workflows
User->>OnboardCmd: start onboarding
OnboardCmd->>MCP: refresh credentials / jira_search (optional)
alt MCP available
MCP->>OnboardCmd: jira component validation result
else MCP not available
OnboardCmd->>Jira: curl JQL /rest/api/3/myself (with Basic Auth fallback)
Jira-->>OnboardCmd: validation result
end
OnboardCmd->>User: collect repos, confirm branches
OnboardCmd->>GH: check push access / fork (gh repo fork || true)
GH-->>OnboardCmd: fork/remote/sync status
OnboardCmd->>Repo: create branch, update mappings file
OnboardCmd->>GH: push branch, create PR (gh pr create)
GH-->>User: PR created (await merge)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@workflows/cve-fixer/.claude/commands/cve.find.md`:
- Line 61: The AUTH generation uses GNU-specific base64 option `-w 0` which
breaks on macOS/BSD; replace that invocation so it works cross-platform by
removing `-w 0` and stripping the trailing newline instead (e.g., change the
line that sets AUTH to use `echo -n "${JIRA_EMAIL}:${JIRA_API_TOKEN}" | base64 |
tr -d '\n'` or use `printf "%s" "${JIRA_EMAIL}:${JIRA_API_TOKEN}" | base64`) so
the Authorization value remains a single-line base64 string.
In `@workflows/cve-fixer/.claude/commands/cve.fix.md`:
- Line 530: The line that sets the AUTH variable using base64 ("AUTH=$(echo -n
\"${JIRA_EMAIL}:${JIRA_API_TOKEN}\" | base64 -w 0)") uses the GNU-only -w flag
which breaks on macOS/BSD; replace the pipeline so it omits the -w option and
strips newlines portably (for example: remove "-w 0" from the base64 call and
pipe the output through tr -d '\n') so the AUTH assignment remains
cross-platform and still yields a single-line base64 token.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4ea0d50d-e678-4617-aea4-418b5dafd31f
📒 Files selected for processing (2)
workflows/cve-fixer/.claude/commands/cve.find.mdworkflows/cve-fixer/.claude/commands/cve.fix.md
Keep both the base64 | tr -d newline fix (from ambient-code#106) and the diagnostic echo lines (from ambient-code#104) — they are complementary. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
fde6297 to
d2ab1c9
Compare
base64 wraps output at 76 characters by default, which injects newlines into the Authorization header when credentials are long enough. This causes curl error 43 ("bad argument") and HTTP 000 responses.