fix(coding-agent): harden git package install paths
This commit is contained in:
@@ -62,6 +62,19 @@ describe("Git URL Parsing", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("should reject unsafe git install path inputs", () => {
|
||||
for (const source of [
|
||||
"git:git@evil.example:../../victim/repo",
|
||||
"https://evil.example/..%2F..%2Fvictim/repo",
|
||||
"https://evil.example/..%2F..%2Fvictim/repo%",
|
||||
"git:git@evil.example:/absolute/repo",
|
||||
"git:git@evil.example:user\\repo/name",
|
||||
"git:git@evil.example:user/repo\0name",
|
||||
]) {
|
||||
expect(parseGitUrl(source)).toBeNull();
|
||||
}
|
||||
});
|
||||
|
||||
describe("unsupported without git: prefix", () => {
|
||||
it("should reject git@host:path without git: prefix", () => {
|
||||
expect(parseGitUrl("git@github.com:user/repo")).toBeNull();
|
||||
|
||||
Reference in New Issue
Block a user