Skip to content

Commit 60badbb

Browse files
msukkariclaude
andcommitted
fix(shared): trim tokens in getTokenFromConfig to prevent broken git clone URLs
Tokens with trailing newlines (common with env vars, .env files, and cloud secrets) get URL-encoded as %0A, causing fatal git credential parse errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d4f47ab commit 60badbb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/shared/src/crypto.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export const getTokenFromConfig = async (token: Token): Promise<string> => {
107107
throw new Error(`Environment variable ${token.env} not found.`);
108108
}
109109

110-
return envToken;
110+
return envToken.trim();
111111
} else if ('googleCloudSecret' in token) {
112112
try {
113113
const client = new SecretManagerServiceClient();
@@ -119,7 +119,7 @@ export const getTokenFromConfig = async (token: Token): Promise<string> => {
119119
throw new Error(`Secret ${token.googleCloudSecret} not found.`);
120120
}
121121

122-
return response.payload.data.toString();
122+
return response.payload.data.toString().trim();
123123
} catch (error) {
124124
throw new Error(`Failed to access Google Cloud secret ${token.googleCloudSecret}: ${error instanceof Error ? error.message : String(error)}`);
125125
}

0 commit comments

Comments
 (0)