@teamclaws/teamclaw 2026.11.10 → 2026.11.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -13,9 +13,23 @@ export function teamAutoProjectDir(repoId) {
|
|
|
13
13
|
* Git operations for TeamAuto. Authentication uses the device-flow token
|
|
14
14
|
* inline in the remote URL (x-access-token basic auth) - proven to survive
|
|
15
15
|
* GitHub's smart-HTTP redirects where extraheader injection does not. The
|
|
16
|
-
* token never touches disk:
|
|
17
|
-
*
|
|
16
|
+
* token never touches disk: fetch/push rewrite the URL per invocation, and
|
|
17
|
+
* the one command that DOES store a URL (the initial clone) has its origin
|
|
18
|
+
* remote rewritten to the clean https URL right afterwards (ClawHub security
|
|
19
|
+
* review 2026.11.10). Every git error is redacted before it can reach a log,
|
|
20
|
+
* the store or a status response.
|
|
18
21
|
*/
|
|
22
|
+
/**
|
|
23
|
+
* Strip GitHub credentials from anything derived from git output: inline
|
|
24
|
+
* x-access-token userinfo and raw token shapes (gho_/ghp_..., github_pat_...).
|
|
25
|
+
* Exported for tests; applied by run() to every failure message.
|
|
26
|
+
*/
|
|
27
|
+
export function redactGitSecrets(text) {
|
|
28
|
+
return text
|
|
29
|
+
// Drop the whole userinfo so no "user:secret@" shape survives.
|
|
30
|
+
.replace(/x-access-token:[^@\s/]+@/gi, "[REDACTED]@")
|
|
31
|
+
.replace(/\b(?:gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,})\b/g, "[REDACTED]");
|
|
32
|
+
}
|
|
19
33
|
function gitEnv() {
|
|
20
34
|
return {
|
|
21
35
|
...process.env,
|
|
@@ -25,13 +39,28 @@ function gitEnv() {
|
|
|
25
39
|
};
|
|
26
40
|
}
|
|
27
41
|
async function run(args, cwd) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
42
|
+
try {
|
|
43
|
+
const { stdout } = await exec("git", args, {
|
|
44
|
+
cwd,
|
|
45
|
+
env: gitEnv(),
|
|
46
|
+
maxBuffer: 16 * 1024 * 1024,
|
|
47
|
+
timeout: 120_000,
|
|
48
|
+
});
|
|
49
|
+
return stdout;
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
// git echoes the failing URL on stderr (the inline token userinfo ends
|
|
53
|
+
// up in the message), and callers persist error messages into the store
|
|
54
|
+
// and status responses. Redact before the error leaves this module.
|
|
55
|
+
if (err instanceof Error) {
|
|
56
|
+
err.message = redactGitSecrets(err.message);
|
|
57
|
+
const withStderr = err;
|
|
58
|
+
if (typeof withStderr.stderr === "string") {
|
|
59
|
+
withStderr.stderr = redactGitSecrets(withStderr.stderr);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
throw err;
|
|
63
|
+
}
|
|
35
64
|
}
|
|
36
65
|
export function createRepoSync(auth, logger) {
|
|
37
66
|
async function tokenizedUrl(cloneUrl) {
|
|
@@ -39,6 +68,10 @@ export function createRepoSync(auth, logger) {
|
|
|
39
68
|
const clean = cloneUrl.replace(/^https:\/\//, "").replace(/\.git$/, "");
|
|
40
69
|
return `https://x-access-token:${token}@${clean}.git`;
|
|
41
70
|
}
|
|
71
|
+
/** The token-less https URL that is safe to persist in .git/config. */
|
|
72
|
+
function cleanUrl(cloneUrl) {
|
|
73
|
+
return `https://${cloneUrl.replace(/^https:\/\//, "").replace(/\.git$/, "")}.git`;
|
|
74
|
+
}
|
|
42
75
|
async function repoDir(repoId) {
|
|
43
76
|
const { reposRoot, legacyReposRoot } = resolveTeamAutoPaths();
|
|
44
77
|
await fs.mkdir(reposRoot, { recursive: true });
|
|
@@ -82,6 +115,9 @@ export function createRepoSync(auth, logger) {
|
|
|
82
115
|
if (!exists) {
|
|
83
116
|
const authed = await tokenizedUrl(cloneUrl);
|
|
84
117
|
await run(["clone", "--filter=blob:none", "--no-checkout", authed, dir]);
|
|
118
|
+
// `git clone <url>` persists <url> as the origin remote - rewrite it to
|
|
119
|
+
// the clean https URL so the token never lands in .git/config.
|
|
120
|
+
await run(["remote", "set-url", "origin", cleanUrl(cloneUrl)], dir);
|
|
85
121
|
await run(["checkout", defaultBranch], dir);
|
|
86
122
|
}
|
|
87
123
|
else {
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "teamclaw",
|
|
3
3
|
"name": "TeamClaw",
|
|
4
4
|
"description": "Virtual team collaboration - multiple OpenClaw instances form a virtual software company with role-based task routing.",
|
|
5
|
-
"version": "2026.11.
|
|
5
|
+
"version": "2026.11.11",
|
|
6
6
|
"activation": {
|
|
7
7
|
"onStartup": true
|
|
8
8
|
},
|
package/package.json
CHANGED
|
@@ -45,10 +45,25 @@ export function teamAutoProjectDir(repoId: string): string {
|
|
|
45
45
|
* Git operations for TeamAuto. Authentication uses the device-flow token
|
|
46
46
|
* inline in the remote URL (x-access-token basic auth) - proven to survive
|
|
47
47
|
* GitHub's smart-HTTP redirects where extraheader injection does not. The
|
|
48
|
-
* token never touches disk:
|
|
49
|
-
*
|
|
48
|
+
* token never touches disk: fetch/push rewrite the URL per invocation, and
|
|
49
|
+
* the one command that DOES store a URL (the initial clone) has its origin
|
|
50
|
+
* remote rewritten to the clean https URL right afterwards (ClawHub security
|
|
51
|
+
* review 2026.11.10). Every git error is redacted before it can reach a log,
|
|
52
|
+
* the store or a status response.
|
|
50
53
|
*/
|
|
51
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Strip GitHub credentials from anything derived from git output: inline
|
|
57
|
+
* x-access-token userinfo and raw token shapes (gho_/ghp_..., github_pat_...).
|
|
58
|
+
* Exported for tests; applied by run() to every failure message.
|
|
59
|
+
*/
|
|
60
|
+
export function redactGitSecrets(text: string): string {
|
|
61
|
+
return text
|
|
62
|
+
// Drop the whole userinfo so no "user:secret@" shape survives.
|
|
63
|
+
.replace(/x-access-token:[^@\s/]+@/gi, "[REDACTED]@")
|
|
64
|
+
.replace(/\b(?:gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,})\b/g, "[REDACTED]");
|
|
65
|
+
}
|
|
66
|
+
|
|
52
67
|
function gitEnv(): Record<string, string> {
|
|
53
68
|
return {
|
|
54
69
|
...process.env,
|
|
@@ -59,13 +74,27 @@ function gitEnv(): Record<string, string> {
|
|
|
59
74
|
}
|
|
60
75
|
|
|
61
76
|
async function run(args: string[], cwd?: string): Promise<string> {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
try {
|
|
78
|
+
const { stdout } = await exec("git", args, {
|
|
79
|
+
cwd,
|
|
80
|
+
env: gitEnv(),
|
|
81
|
+
maxBuffer: 16 * 1024 * 1024,
|
|
82
|
+
timeout: 120_000,
|
|
83
|
+
});
|
|
84
|
+
return stdout;
|
|
85
|
+
} catch (err) {
|
|
86
|
+
// git echoes the failing URL on stderr (the inline token userinfo ends
|
|
87
|
+
// up in the message), and callers persist error messages into the store
|
|
88
|
+
// and status responses. Redact before the error leaves this module.
|
|
89
|
+
if (err instanceof Error) {
|
|
90
|
+
err.message = redactGitSecrets(err.message);
|
|
91
|
+
const withStderr = err as Error & { stderr?: unknown };
|
|
92
|
+
if (typeof withStderr.stderr === "string") {
|
|
93
|
+
withStderr.stderr = redactGitSecrets(withStderr.stderr);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
throw err;
|
|
97
|
+
}
|
|
69
98
|
}
|
|
70
99
|
|
|
71
100
|
export function createRepoSync(auth: GithubAuthManager, logger: { warn: (m: string) => void }) {
|
|
@@ -75,6 +104,11 @@ export function createRepoSync(auth: GithubAuthManager, logger: { warn: (m: stri
|
|
|
75
104
|
return `https://x-access-token:${token}@${clean}.git`;
|
|
76
105
|
}
|
|
77
106
|
|
|
107
|
+
/** The token-less https URL that is safe to persist in .git/config. */
|
|
108
|
+
function cleanUrl(cloneUrl: string): string {
|
|
109
|
+
return `https://${cloneUrl.replace(/^https:\/\//, "").replace(/\.git$/, "")}.git`;
|
|
110
|
+
}
|
|
111
|
+
|
|
78
112
|
async function repoDir(repoId: string): Promise<string> {
|
|
79
113
|
const { reposRoot, legacyReposRoot } = resolveTeamAutoPaths();
|
|
80
114
|
await fs.mkdir(reposRoot, { recursive: true });
|
|
@@ -115,6 +149,9 @@ export function createRepoSync(auth: GithubAuthManager, logger: { warn: (m: stri
|
|
|
115
149
|
if (!exists) {
|
|
116
150
|
const authed = await tokenizedUrl(cloneUrl);
|
|
117
151
|
await run(["clone", "--filter=blob:none", "--no-checkout", authed, dir]);
|
|
152
|
+
// `git clone <url>` persists <url> as the origin remote - rewrite it to
|
|
153
|
+
// the clean https URL so the token never lands in .git/config.
|
|
154
|
+
await run(["remote", "set-url", "origin", cleanUrl(cloneUrl)], dir);
|
|
118
155
|
await run(["checkout", defaultBranch], dir);
|
|
119
156
|
} else {
|
|
120
157
|
const authed = await tokenizedUrl(cloneUrl);
|