{"draft":null,"from":270,"to":271,"files":[{"path":"client/src/config.ts","added":10,"removed":4,"diff":"--- a/client/src/config.ts\n+++ b/client/src/config.ts\n@@ -51,7 +51,7 @@\n export function readConfig(\n \troot: string,\n \tenv: Readonly<Record<string, string | undefined>> = process.env,\n-\ttokenFileOk = true,\n+\ttokenFileOk = false,\n ): Config {\n \tconst raw = JSON.parse(readFileSync(configPath(root), \"utf8\")) as Partial<Settings>;\n \tif (raw.visitor === true) {\n@@ -102,6 +102,7 @@\n \troot: string,\n \tserver: string,\n \tenv: Readonly<Record<string, string | undefined>> = process.env,\n+\ttokenFileOk = false,\n ): { kind: \"agent key\" | \"shared token\" | \"pipeline run key\" | \"none\"; id: string | null } {\n \tconst key = readKeyFile(root);\n \tif (key) {\n@@ -110,7 +111,7 @@\n \t}\n \tif (fromEnv(env, \"TOKEN\")) return { kind: \"shared token\", id: null };\n \tif (fromEnv(env, \"KEY_FILE\")) return { kind: \"pipeline run key\", id: null };\n-\treturn { kind: readToken(env) ? \"shared token\" : \"none\", id: null };\n+\treturn { kind: tokenFileOk && tokenFile() ? \"shared token\" : \"none\", id: null };\n }\n \n interface StoredKey {\n@@ -182,10 +183,15 @@\n \tserver: string,\n \tenv: Readonly<Record<string, string | undefined>> = process.env,\n \troot?: string,\n-\ttokenFileOk = true,\n+\ttokenFileOk = false,\n ): string | undefined {\n \tif (root) {\n \t\tconst key = readKeyFile(root);\n+\t\t// A folder with a key signs in with that key and nothing else, even when the server refuses it.\n+\t\tif (!key && existsSync(keyPath(root)))\n+\t\t\tthrow new UsageError(\n+\t\t\t\t`this folder's key file (${keyPath(root)}) can't be read, so abso sends nothing; abso key install puts a key back`,\n+\t\t\t);\n \t\tif (key) {\n \t\t\tif (originOf(key.server) !== originOf(server))\n \t\t\t\tthrow new UsageError(\"this folder's key was issued for a different server, so abso will not send it\");\n@@ -251,7 +257,7 @@\n \treturn key;\n }\n \n-/** This machine's token file (~/.abso/token, else ~/.avcs/token), or none. abso init and join read it only with --token-file. */\n+/** This machine's token file (~/.abso/token, else ~/.avcs/token), or none. Read only for a command given --token-file. */\n export function tokenFile(): string | undefined {\n \treturn readToken({});\n }"}],"unmatched":[]}