deepwiki-open icon indicating copy to clipboard operation
deepwiki-open copied to clipboard

Private repository tokens are propagated in browser and API URLs

Open carfeii opened this issue 1 month ago • 0 comments

Affected versions: confirmed on main at commit d92819a9 (the project publishes no tagged release).

Summary

The repository entry form appends the private-repository access token to the client-side navigation URL's query string, and the Code Viewer forwards it again in /codemap/file's query string, a route that never reads a token parameter.

Details

// src/app/page.tsx
const params = new URLSearchParams();
if (accessToken) {
  params.append('token', accessToken);
}
// src/components/CodeViewer.tsx
const params = new URLSearchParams({ repo_url: repoUrl, file_path: activeFile, type: repoType || 'github' });
if (token) params.set('token', token);
fetch(`${getApiBaseUrl()}/codemap/file?${params.toString()}`)

POC

(available upon request)

Impact

The token enters browser history and any copied/shared link, and is visible to same-origin scripts via the URL. The second occurrence additionally reaches proxy/access logs with no functional need, since /codemap/file never consumes it.

Suggested fix: keep tokens in ephemeral state, send them only where consumed, and scrub any URL that already carries one. A fix is included in the linked PR.

Fix: #600

carfeii avatar Oct 05 '26 15:10 carfeii