Skip to content

Refactor createDependentPR to use http.extraHeader for auth#1412

Open
issuetopr-dev[bot] wants to merge 2 commits intomainfrom
feature/refactor-git-auth-extraheader
Open

Refactor createDependentPR to use http.extraHeader for auth#1412
issuetopr-dev[bot] wants to merge 2 commits intomainfrom
feature/refactor-git-auth-extraheader

Conversation

@issuetopr-dev
Copy link
Copy Markdown

@issuetopr-dev issuetopr-dev Bot commented Dec 15, 2025

Summary

  • Refactor the createDependentPR workflow to avoid embedding tokens in the remote URL. Keep origin as a normal https URL and pass authentication via an ephemeral HTTP Authorization header.
  • Update SyncBranchTool (both app and shared) to use per-command Authorization header for git push in container environments and rely on the refactored pushBranch for host environments.
  • Update pushBranch helpers (app and shared) to use git -c http.https://github.com/.extraHeader="Authorization: bearer <token>" push ... so credentials are never persisted in .git/config.

Details

  • Removed git remote set-url origin "https://x-access-token:<token>@github.com/..." usage.
  • When networked git operations are required (fetch/pull/push), inject auth with:
    • git -c http.https://github.com/.extraHeader="Authorization: bearer <token>" <command>
  • Ensured origin stays set to the clean URL: https://github.com/<owner>/<repo>.git.
  • The command string is executed inside the container via Dockerode without logging the full command, keeping tokens out of logs.

Files changed

  • lib/workflows/createDependentPR.ts
  • lib/tools/SyncBranchTool.ts
  • shared/src/lib/tools/SyncBranchTool.ts
  • lib/git.ts
  • shared/src/lib/git.ts

Rationale

  • Safer: tokens are not written to .git/config, not left in remotes, and not echoed in URLs.
  • Least persistent: uses per-command -c options so nothing is persisted.

Notes

  • I kept the changes scoped to the areas performing pushes and fetches for the dependent PR workflow and the branch sync tool, which are the main spots that previously embedded credentials.
  • ESLint passes via pnpm run lint. Prettier and full type checks are not part of the normal CI workflow here, and running them locally flags pre-existing issues unrelated to this change.

Closes #1410

… in remote URLs\n\n- In createDependentPR workflow, stop setting tokenized remote URLs. Keep origin as a clean https URL and inject Authorization header per git command using for fetch, pull, and push.\n- Update SyncBranchTool (both app and shared) to push with ephemeral Authorization header instead of mutating the remote URL.\n- Update pushBranch helper (both app and shared) to use per-command header and avoid persisting credentials.\n\nThis hardens auth handling so tokens are not written to .git/config or logged in remote URLs.
@issuetopr-dev issuetopr-dev Bot added the AI generated AI-generated Pull Requests label Dec 15, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 15, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Note

Free review on us!

CodeRabbit is offering free reviews until Wed Dec 17 2025 to showcase some of the refinements we've made.

Comment @coderabbitai help to get the list of available commands and usage tips.

@vercel vercel Bot temporarily deployed to Preview – issue-to-pr-realtime December 16, 2025 02:11 Inactive
@vercel vercel Bot temporarily deployed to Preview – issue-to-pr-storybook December 16, 2025 02:11 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI generated AI-generated Pull Requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor createDependentPR to use http.extraHeader for auth

1 participant