@vincemakes/kiso-tools-node 0.40.6 → 0.40.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/corpus.d.ts CHANGED
@@ -34,6 +34,10 @@ import { type Ignore } from "ignore";
34
34
  /** The walk stops here. `search_text` has always used 8; the glob inherits
35
35
  * it so a pattern cannot reach deeper than a search can. */
36
36
  export declare const CORPUS_MAX_DEPTH = 8;
37
+ /** RO-F4: the credential files named by their DIRECTORY as well — a path
38
+ * (absolute or root-relative), folded to lower case as a case-insensitive
39
+ * disk would. The read-only shell rule asks this same question. */
40
+ export declare function isCredentialPath(path: string): boolean;
37
41
  export declare function isCredentialName(name: string): boolean;
38
42
  export interface CorpusOptions {
39
43
  workspaceRoot: string;
package/dist/corpus.js CHANGED
@@ -53,11 +53,18 @@ export const CORPUS_MAX_DEPTH = 8;
53
53
  * id_ecdsa, are different names and stay searchable, which is
54
54
  * id_ed25519 correct: a public key is public.
55
55
  * *.pem the same, by extension
56
+ * `.npmrc`, `.pypirc`, `.git-credentials`, `.htpasswd` — RO-F4, the
57
+ * owner's 0.40.7 ruling. `.npmrc` was OUT here ("tokens
58
+ * in it are normally `${VAR}` placeholders") while the
59
+ * read-only shell rule (0.40.0, B4) already called it a
60
+ * credential: two lists that disagreed, so a search
61
+ * exposed what `cat` asked about. One set now, used by
62
+ * both; a literal `_authToken=` is common enough.
63
+ * and, by PATH (a name alone would be too broad — `config`,
64
+ * `credentials`): `.aws/credentials`, `.config/gh/hosts.yml`,
65
+ * `.docker/config.json`, `.kube/config` (isCredentialPath)
56
66
  *
57
67
  * OUT, deliberately, so the omissions are decisions and not oversights:
58
- * `.npmrc` a config file by convention; tokens in it are normally
59
- * `${VAR}` placeholders, so excluding it would cost more
60
- * than it protects
61
68
  * `*.key` too many non-secret uses to be a credential by name
62
69
  *
63
70
  * An explicit `read_file` of ANY of these is unchanged. Reading on
@@ -65,7 +72,15 @@ export const CORPUS_MAX_DEPTH = 8;
65
72
  * from a search for "KEY" is exposure without intent, and only the
66
73
  * second is what this prevents. */
67
74
  const ENV_TEMPLATES = new Set([".env.example", ".env.sample", ".env.template"]);
68
- const CREDENTIAL_NAMES = new Set([".envrc", ".netrc", "id_rsa", "id_dsa", "id_ecdsa", "id_ed25519"]);
75
+ const CREDENTIAL_NAMES = new Set([".envrc", ".netrc", "id_rsa", "id_dsa", "id_ecdsa", "id_ed25519", ".npmrc", ".pypirc", ".git-credentials", ".htpasswd"]);
76
+ const CREDENTIAL_PATHS = ["/.aws/credentials", "/.config/gh/hosts.yml", "/.docker/config.json", "/.kube/config"];
77
+ /** RO-F4: the credential files named by their DIRECTORY as well — a path
78
+ * (absolute or root-relative), folded to lower case as a case-insensitive
79
+ * disk would. The read-only shell rule asks this same question. */
80
+ export function isCredentialPath(path) {
81
+ const folded = `/${path.split(sep).join("/")}`.toLowerCase();
82
+ return CREDENTIAL_PATHS.some((s) => folded.endsWith(s));
83
+ }
69
84
  export function isCredentialName(name) {
70
85
  if (ENV_TEMPLATES.has(name))
71
86
  return false;
@@ -105,7 +120,7 @@ export function ignoredBy(layers, full, isDir) {
105
120
  export function corpusSkips(declared, layers, full, name, isDir) {
106
121
  if (name === "node_modules" || name === ".git")
107
122
  return true;
108
- if (isCredentialName(name))
123
+ if (isCredentialName(name) || isCredentialPath(full))
109
124
  return true;
110
125
  if (!declared)
111
126
  return name.startsWith(".");
package/dist/index.d.ts CHANGED
@@ -187,7 +187,7 @@ export { PROTECTED_REFUSAL, diskPath, isProtectedPath, protectedIdentity, protec
187
187
  /** The search corpus's credential rule, by name — exported so the CLI's
188
188
  * read-only shell allow holds a shell read to the same definition rather
189
189
  * than a copy of it. */
190
- export { isCredentialName } from "./corpus.js";
190
+ export { isCredentialName, isCredentialPath } from "./corpus.js";
191
191
  export declare function shellTool(opts: WorkspaceToolsOptions): Tool<{
192
192
  command: string;
193
193
  timeoutMs?: number;
package/dist/index.js CHANGED
@@ -1204,7 +1204,7 @@ export { PROTECTED_REFUSAL, diskPath, isProtectedPath, protectedIdentity, protec
1204
1204
  /** The search corpus's credential rule, by name — exported so the CLI's
1205
1205
  * read-only shell allow holds a shell read to the same definition rather
1206
1206
  * than a copy of it. */
1207
- export { isCredentialName } from "./corpus.js";
1207
+ export { isCredentialName, isCredentialPath } from "./corpus.js";
1208
1208
  export function shellTool(opts) {
1209
1209
  return defineTool({
1210
1210
  name: "shell",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincemakes/kiso-tools-node",
3
- "version": "0.40.6",
3
+ "version": "0.40.7",
4
4
  "description": "kiso coding tools for Node hosts \u2014 read file, list directory, search text, write/edit file, shell command.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -25,7 +25,7 @@
25
25
  "test": "vitest run"
26
26
  },
27
27
  "dependencies": {
28
- "@vincemakes/kiso-core": "0.40.6",
28
+ "@vincemakes/kiso-core": "0.40.7",
29
29
  "ignore": "^7.0.9"
30
30
  },
31
31
  "devDependencies": {