Repository navigation
temportal 0.5.1: the checkpoint stays in .claude's own repository, and the push check, notices and writes hold against a hostile project - #270
Merged
Conversation
…d the push check, notices and writes hold against a hostile project A project can come from anyone, and whoever sent it wrote its .claude/.git, its file names, its links and what its tools answer. - Git's own variables (GIT_DIR, GIT_WORK_TREE, GIT_INDEX_FILE and the like) are dropped when the script starts, and every call on .claude's repository names the git directory and the work tree, so no commit lands in a repository further up. Nothing is written unless git takes .claude/.git for the repository named to it. - temportal runs git in a .claude/.git only when it made that repository on this machine or the user adopted it. An id in .claude/.git/temportal/made and the same id in temportal/made under Claude Code's own directory say so, and no project can write the second. Any other .claude/.git is reported and left alone, as status says with claude=unadopted, until the user runs the new adopt command. A repository made by 0.5.0 is such a one, since nothing in it tells it from one that was shipped: it takes one adopt. - Its calls there run with the repository's hooks, a file system monitor and commit signing off. - The pre-push hook sets a merge against each parent, reads files git takes for binary, falls back to what the remote being pushed to is known to hold when this clone lacks the remote's commit, counts only that remote's branches, takes a named value on the line after its name, and refuses a push whose commits it cannot read. temportal says once when core.hooksPath or a hook of the user's keeps its hook from being installed, and replaces only a hook whose second line is its own. - A call's signature is shown in a note between << and >>, cut at 120 characters and with a ? for every character outside a small set, and the note says it is quoted text. The batch hook reads tool_name and tool_input only as members of the input and of each element of tool_calls, and the transcript reader reads no call from an entry in the role of the user. - Nothing is written through a symbolic link at settings.json, settings.local.json, memory or anything under .claude/temportal, and json_set writes to a file it creates itself. - json_set writes its value as JSON writes a string. - A nested repository whose name holds a space or a pattern's characters gets an exclude line that names it. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
…eft alone, and one that git init made is kept as it is Before temportal runs git in a .claude/.git it reads that repository's config itself, as a file, with one awk, and runs git there only when every key is on a list of keys that can name no program and bring in no other config: the keys git init writes and their like, user.name and user.email, commit.gpgsign when false, init.defaultBranch, a branch's remote, merge and rebase, a remote's url, pushurl and fetch, the gc settings that time packing and pruning, and the object format and ref storage git init can write. A config that is a link, a config.worktree or a commondir beside it, a line that cannot be read as git reads it, or any other key makes the state foreign: no git is run there, nothing is written and nothing is committed, session start tells the user which key it was, and status says the same on a line of its own. With the key out of the config the repository is kept. This takes the place of the list of repositories under Claude Code's own directory and of the command, the state and the files that went with it. Nothing is written outside the project, and a repository that git init made needs no step from its user. A repository inside .claude/ that the index holds as a link is taken out of the index before and after staging, and status is asked to pass such links by: git would otherwise run git inside that repository, with its own config. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes the seven findings of the security review of
temportal.shandpre-push.tmpl..claude/.gitwas broken orGIT_DIRwas in the hook's environment. Every call on.claude's repository names its git directory and work tree, theGIT_*variables are unset, and a write needs git to resolve to.claude/.git..claude/.gitthat arrived with a project had its config and hooks run. temportal reads.claude/.git/configitself before it runs git there, and runs git only when every key is on a list of keys that cannot name a program. Any other repository isforeignand left alone, and session start andstatusname the key that stopped it. temportal's own git calls turn off fsmonitor, hooks and signing.core.hooksPathwas set..claude/.settings.local.jsonunescaped..claude's index had git run inside it, with its own config, on status, add and commit. The checkpoint takes such links out of the index and excludes the nested repository.What a user sees
git initmade keeps working with no step, and nothing is written outside the project..claude/.git/configwith a key off the list (for examplecore.fsmonitor,filter.*,alias.*,include.path) stops temportal there until the key is taken out.Checked
vibe5/tests/temportal/temportal.test.sh: 507 passed in Git Bash, 511 under dash in WSL Ubuntu (gawk), 510 under dash with mawk in Debian with no network; 0 failed in each. The new script'sstatusreads this repository's own.claude/asrepository. Not run: a real Claude Code session,claude plugin validate, macOS.🤖 Generated with Claude Code