CVE-2026-144938: add-and-commit commits a nested git repository as a gitlink chosen by an outside contributor
Improper Check for Unusual or Exceptional Conditions (CWE-754) in add-and-commit, in src/main.ts, from 5.0.0 before 11.0.0. A contributor who controls a directory under the add pathspec can commit a gitlink of their choosing. The add input takes the arguments for git add, and the default value is .. git add records a directory that has its own nested .git directory as a gitlink. The index entry has mode 160000 and names the commit at the nested repository's HEAD. git stores none of the files inside that directory, writes a warning and the remediation hints to stderr, and exits 0. add() in src/main.ts, at lines 220 to 258 in 10.0.0, calls simple-git's add() with a callback that reaches log(). simple-git builds that task with straightThroughStringTask, whose parser takes one argument, so callTaskParser passes stdout and stderr and the parser returns stdout alone. isTaskError is exitCode && stdErr.length, so a zero exit code raises no error, whatever stderr contains. log() in src/util.ts prints the data and reports the error, and both arguments are empty, so the job log shows no warning. add() never reads the staged entries back, so the commit keeps the gitlink, whose path and commit name the contributor sets. The value reaches the action in a workflow that checks out pull request content and then runs the action over a pathspec that covers that content.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
add-and-committo a version that resolves this vulnerability.Fixed in 11.0.0 - Compensating control
On affected versions, before the action runs, delete every nested .git directory from the working tree, or narrow the add pathspec to the paths the workflow writes.
Event History
Frequently Asked Questions
Which releases are affected?
Versions from 5.0.0 up to, but not including, 11.0.0 are affected. Version 11.0.0 is identified by the referenced release and fix commit.
Is the default configuration exposed?
Yes. The default add input is "..", so a contributor-controlled directory beneath that path can be included if it contains its own nested .git directory.
What access does an attacker need?
The attacker must be able to control a directory under the path supplied to the add input. They can use a nested repository whose HEAD points to the commit they want recorded as a gitlink.
How can I check whether a repository was affected?
Inspect staged entries or commits for entries with Git mode 160000, which identifies a gitlink rather than ordinary tracked files. The affected action may not show Git's warning in job logs because it exits successfully and the stderr warning is discarded.
What should be done if upgrading cannot happen immediately?
Avoid using broad add pathspecs that include contributor-controlled directories, including the default ".." value. Review staged content for mode-160000 gitlink entries before committing.