From 60badbb6fc0d6446bf395c9ef5a6fe037231e883 Mon Sep 17 00:00:00 2001 From: msukkari Date: Wed, 1 Apr 2026 11:27:23 -0700 Subject: [PATCH 1/3] 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 --- packages/shared/src/crypto.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/shared/src/crypto.ts b/packages/shared/src/crypto.ts index f542ece45..ae2aa423c 100644 --- a/packages/shared/src/crypto.ts +++ b/packages/shared/src/crypto.ts @@ -107,7 +107,7 @@ export const getTokenFromConfig = async (token: Token): Promise => { throw new Error(`Environment variable ${token.env} not found.`); } - return envToken; + return envToken.trim(); } else if ('googleCloudSecret' in token) { try { const client = new SecretManagerServiceClient(); @@ -119,7 +119,7 @@ export const getTokenFromConfig = async (token: Token): Promise => { throw new Error(`Secret ${token.googleCloudSecret} not found.`); } - return response.payload.data.toString(); + return response.payload.data.toString().trim(); } catch (error) { throw new Error(`Failed to access Google Cloud secret ${token.googleCloudSecret}: ${error instanceof Error ? error.message : String(error)}`); } From adebc59eb2ace16e6fc2a029bc5b0105682f329f Mon Sep 17 00:00:00 2001 From: msukkari Date: Wed, 1 Apr 2026 11:28:01 -0700 Subject: [PATCH 2/3] docs: add CHANGELOG entry for #1067 Co-Authored-By: Claude Opus 4.6 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c6a33b8d..6850f7056 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed `GET /api/mcp` hanging with zero bytes by returning `405 Method Not Allowed` per the MCP Streamable HTTP spec [#1064](https://github.com/sourcebot-dev/sourcebot/pull/1064) +- Fixed tokens with trailing newlines (common with env vars and cloud secrets) breaking git clone URLs by adding `.trim()` in `getTokenFromConfig()` [#1067](https://github.com/sourcebot-dev/sourcebot/pull/1067) ### Removed - Removed "general" settings page with options to change organization name and domain. [#1065](https://github.com/sourcebot-dev/sourcebot/pull/1065) From d5625720c3395a4a84092e6e235b2fec2c0f22e8 Mon Sep 17 00:00:00 2001 From: Michael Sukkarieh Date: Wed, 1 Apr 2026 11:29:05 -0700 Subject: [PATCH 3/3] changelog nit --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6850f7056..c21dbc00e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed `GET /api/mcp` hanging with zero bytes by returning `405 Method Not Allowed` per the MCP Streamable HTTP spec [#1064](https://github.com/sourcebot-dev/sourcebot/pull/1064) -- Fixed tokens with trailing newlines (common with env vars and cloud secrets) breaking git clone URLs by adding `.trim()` in `getTokenFromConfig()` [#1067](https://github.com/sourcebot-dev/sourcebot/pull/1067) +- Fixed tokens with trailing newlines breaking git clone URLs by adding `.trim()` in `getTokenFromConfig()` [#1067](https://github.com/sourcebot-dev/sourcebot/pull/1067) ### Removed - Removed "general" settings page with options to change organization name and domain. [#1065](https://github.com/sourcebot-dev/sourcebot/pull/1065)