Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions js/test/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ import {createDocsClient, type MarkdownFetch} from '../src/client';
const REPO = 'acme-guild/handbook';
const DOCS = ['handbook/rules.md', 'handbook/getting-started.md'];

// A credential-shaped string, and a body that quotes it back. A real GitHub
// error body does not echo the credential, but an upstream that did — a
// The stand-in secret, and a body that quotes it back. A real GitHub error
// body does not echo the credential, but an upstream that did — a
// misconfigured proxy, a future API, an intermediary — must not be able to
// launder it through this package.
const TOKEN = 'ghp_a1b2c3d4e5f6g7h8i9j0_secretvalue';
//
// Deliberately NOT shaped like a real credential: no `ghp_` / `gho_` /
// `github_pat_` prefix and no random-looking entropy, because this repo is
// public and a realistic-looking literal trips GitHub secret scanning, which
// files a false-positive alert and can block pushes that touch this line. The
// leak assertions only need a distinctive, greppable sentinel to look for, and
// this string is exactly as good at that job. Please do not "fix" it back into
// something that looks authentic.
const TOKEN = 'sentinel-not-a-real-credential-leak-canary';
const LEAKY_BODY = `{"message":"Bad credentials: ${TOKEN}","documentation_url":"https://docs.github.com/rest"}`;

const okResponse = (text: string): Response =>
Expand Down
12 changes: 11 additions & 1 deletion python/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@
)

REPO = "acme-guild/handbook"
TOKEN = "ghp_a1b2c3d4e5f6g7h8i9j0_secretvalue"
# The stand-in secret handed to the client. The leak tests assert this exact
# string never reaches a returned value, a URL or an error message.
#
# Deliberately NOT shaped like a real credential: no `ghp_` / `gho_` /
# `github_pat_` prefix and no random-looking entropy, because this repo is
# public and a realistic-looking literal trips GitHub secret scanning, which
# files a false-positive alert and can block pushes that touch this line. The
# assertions only need a distinctive, greppable sentinel to look for, and this
# string is exactly as good at that job. Please do not "fix" it back into
# something that looks authentic.
TOKEN = "sentinel-not-a-real-credential-leak-canary"
ROOTS = ("handbook", "policies", "players")


Expand Down
Loading