Commit Graph
3 Commits
Author SHA1 Message Date
8c07613f66 Use the default branch's config on pull requests from authors without write access (#2088)
* Use the default branch's config on pull requests from authors without write access

When a pull request's author does not have write access and it targets a branch
other than the default one, the config that the action restores now comes from
the base_branch input or the default branch instead of the pull request's base.
The base is still fetched so that the two can be compared.

Fetch and check out the config branch by its full ref name, so that a tag of the
same name or a narrow refspec can't leave the session without config.

Document that pr-N holds a fork's commits and should stay out of CI that holds
secrets.

Co-authored-by: mhegazy <[email protected]>

* Keep the other branch's config out of commits and the base comparable

The commit wrapper leaves out files that the action took from a branch other than
the pull request's base. HEAD's history is fetched again if fetching the config
branch cut it, and a base branch that can't be fetched fails the run as before.
A bot's pull request into a pr-N branch no longer takes its config from it.

Co-authored-by: mhegazy <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
2026-11-17 12:45:54 -08:00
4d75e5f390 Make the git wrappers independent of the session's environment (#2018)
* Make the git wrappers independent of the session's environment

Tag mode's wrappers for git add, rm, commit and push now take their settings from
files the action writes, and always work on the repository the action checked out.
Git settings passed through the environment no longer reach them, so a workflow that
relies on one, such as GIT_SSH_COMMAND, needs its own allow rule.

Co-authored-by: mhegazy <[email protected]>

* Keep narrow deny rules and other folders covered with the git wrappers

A narrower deny rule such as git add -A now carries over to the wrapper. Global git
config refuses a repository found in a plain folder for the session, since the
settings no longer sit in the environment. The add wrapper also takes --chmod, and
the wrappers use the home directory the action recorded.

Co-authored-by: mhegazy <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
2026-11-12 15:13:42 -08:00
75b2776d96 Stop forced pushes and file reads through the git allow rules (#2006)
* Stop forced pushes and file reads through the git allow rules

Tag mode lets Claude run its push wrapper and git commit without asking, and both accepted more than a normal commit and push.

- The push wrapper rejects a ref starting with +, which git treats as a forced update.
- A new commit wrapper replaces the git commit allow rule. It accepts only a literal message and basic flags, so no flag can read a file into a commit.

Co-authored-by: mhegazy <[email protected]>

* Keep deny rules working with the git wrappers

Deny rules match command text, so denying git commit or git push no longer blocked the wrappers that run them. The commit wrapper also stops offering to rewrite a commit, because a pushed one could not be published again.

Co-authored-by: mhegazy <[email protected]>

* Read deny rules the same way the CLI receives them

Unquoted rules, the equals form and mid-word wildcards all reached the CLI but were missed when carrying deny rules over to the git wrappers, so those workflows could still commit and push.

Co-authored-by: mhegazy <[email protected]>

* Only let the push wrapper update the session's own branch (#2008)

* Only let the push wrapper update the session's own branch

The wrapper accepted any valid branch name, so a prompt-injected session could update main or another person's branch once it moved that branch locally. It now pushes only to the branch the run was set up on.

Co-authored-by: mhegazy <[email protected]>

* Repair the tag mode tests after merging

The merge left the test file's two new test groups interleaved, so it did not parse.

Co-authored-by: mhegazy <[email protected]>

---------

Co-authored-by: Claude <[email protected]>

* Note the pr-N branch for fork pull requests in the push docs

On a pull request from a fork, the session's branch is pr-N in the base
repository, not the pull request's own branch. A pull request opened from the
default branch can also update that branch, so branch protection still matters.

---------

Co-authored-by: Claude <[email protected]>
2026-11-12 17:49:56 +00:00