@blogic-cz/agent-tools 1.11.1 → 1.13.0
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/README.md +18 -43
- package/dist/credential-guard/bash.d.ts +3 -0
- package/dist/credential-guard/bash.d.ts.map +1 -0
- package/dist/credential-guard/claude-hook.d.ts.map +1 -1
- package/dist/credential-guard/engine.test.d.ts +5 -0
- package/dist/credential-guard/engine.test.d.ts.map +1 -0
- package/dist/credential-guard/index.d.ts +8 -35
- package/dist/credential-guard/index.d.ts.map +1 -1
- package/dist/credential-guard/ir.d.ts +150 -0
- package/dist/credential-guard/ir.d.ts.map +1 -0
- package/dist/credential-guard/literal-output.d.ts +2 -0
- package/dist/credential-guard/literal-output.d.ts.map +1 -0
- package/dist/credential-guard/passive-awk.d.ts +2 -0
- package/dist/credential-guard/passive-awk.d.ts.map +1 -0
- package/dist/credential-guard/passive-jq.d.ts.map +1 -1
- package/dist/credential-guard/passive-sed.d.ts +2 -0
- package/dist/credential-guard/passive-sed.d.ts.map +1 -0
- package/dist/credential-guard/passive.test.d.ts +2 -0
- package/dist/credential-guard/passive.test.d.ts.map +1 -0
- package/dist/credential-guard/paths.d.ts +14 -0
- package/dist/credential-guard/paths.d.ts.map +1 -0
- package/dist/credential-guard/policy.d.ts +47 -0
- package/dist/credential-guard/policy.d.ts.map +1 -0
- package/dist/credential-guard/powershell.d.ts +3 -0
- package/dist/credential-guard/powershell.d.ts.map +1 -0
- package/dist/credential-guard/registry.d.ts +89 -0
- package/dist/credential-guard/registry.d.ts.map +1 -0
- package/dist/credential-guard/review4.test.d.ts +2 -0
- package/dist/credential-guard/review4.test.d.ts.map +1 -0
- package/dist/credential-guard/review7.test.d.ts +2 -0
- package/dist/credential-guard/review7.test.d.ts.map +1 -0
- package/dist/credential-guard/shell-oracle.d.ts +2 -0
- package/dist/credential-guard/shell-oracle.d.ts.map +1 -0
- package/dist/credential-guard/xargs.d.ts +7 -0
- package/dist/credential-guard/xargs.d.ts.map +1 -0
- package/dist/gh-tool/pr/checkbox-markdown.d.ts +22 -0
- package/dist/gh-tool/pr/checkbox-markdown.d.ts.map +1 -0
- package/dist/gh-tool/pr/checkbox.d.ts +21 -0
- package/dist/gh-tool/pr/checkbox.d.ts.map +1 -0
- package/dist/gh-tool/pr/commands.d.ts +9 -0
- package/dist/gh-tool/pr/commands.d.ts.map +1 -1
- package/dist/gh-tool/pr/index.d.ts +1 -1
- package/dist/gh-tool/pr/index.d.ts.map +1 -1
- package/dist/gh-tool/read/api.d.ts +8 -0
- package/dist/gh-tool/read/api.d.ts.map +1 -1
- package/dist/gh-tool/read/cache.d.ts.map +1 -1
- package/dist/gh-tool/read/commands.d.ts +5 -0
- package/dist/gh-tool/read/commands.d.ts.map +1 -1
- package/dist/gh-tool/read/pulls.d.ts +1 -0
- package/dist/gh-tool/read/pulls.d.ts.map +1 -1
- package/dist/gh-tool/read/reads.d.ts +39 -0
- package/dist/gh-tool/read/reads.d.ts.map +1 -1
- package/dist/gh-tool/read/telemetry-command.d.ts +7 -0
- package/dist/gh-tool/read/telemetry-command.d.ts.map +1 -0
- package/dist/gh-tool/read/telemetry-store.d.ts +3 -0
- package/dist/gh-tool/read/telemetry-store.d.ts.map +1 -0
- package/dist/gh-tool/read/telemetry.d.ts +59 -0
- package/dist/gh-tool/read/telemetry.d.ts.map +1 -0
- package/dist/gh-tool/read/transport.d.ts +9 -0
- package/dist/gh-tool/read/transport.d.ts.map +1 -1
- package/dist/gh-tool/read/writes.d.ts +2 -1
- package/dist/gh-tool/read/writes.d.ts.map +1 -1
- package/package.json +2 -1
- package/schemas/agent-tools.schema.json +1 -1
- package/src/credential-guard/bash.ts +769 -0
- package/src/credential-guard/claude-hook.ts +14 -14
- package/src/credential-guard/engine.test.ts +2050 -0
- package/src/credential-guard/index.ts +285 -4268
- package/src/credential-guard/ir.ts +139 -0
- package/src/credential-guard/literal-output.ts +8 -0
- package/src/credential-guard/passive-awk.ts +239 -0
- package/src/credential-guard/passive-jq.ts +183 -24
- package/src/credential-guard/passive-sed.ts +78 -0
- package/src/credential-guard/passive.test.ts +141 -0
- package/src/credential-guard/paths.ts +108 -0
- package/src/credential-guard/policy.ts +1576 -0
- package/src/credential-guard/powershell.ts +220 -0
- package/src/credential-guard/registry.ts +4720 -0
- package/src/credential-guard/review4.test.ts +83 -0
- package/src/credential-guard/review7.test.ts +51 -0
- package/src/credential-guard/rg-types.json +389 -0
- package/src/credential-guard/shell-oracle.ts +187 -0
- package/src/credential-guard/xargs.ts +65 -0
- package/src/gh-tool/main.ts +32 -6
- package/src/gh-tool/pr/checkbox-markdown.ts +317 -0
- package/src/gh-tool/pr/checkbox.ts +113 -0
- package/src/gh-tool/pr/commands.ts +55 -2
- package/src/gh-tool/pr/core.ts +2 -2
- package/src/gh-tool/pr/index.ts +1 -0
- package/src/gh-tool/read/api.ts +73 -6
- package/src/gh-tool/read/cache.ts +13 -4
- package/src/gh-tool/read/commands.ts +17 -1
- package/src/gh-tool/read/pulls.ts +19 -0
- package/src/gh-tool/read/reads.ts +86 -2
- package/src/gh-tool/read/telemetry-command.ts +45 -0
- package/src/gh-tool/read/telemetry-store.ts +85 -0
- package/src/gh-tool/read/telemetry.ts +191 -0
- package/src/gh-tool/read/transport.ts +95 -6
- package/src/gh-tool/read/writes.ts +19 -2
- package/src/gh-tool/workflow.ts +2 -2
package/README.md
CHANGED
|
@@ -230,6 +230,10 @@ bun run agent-tools/example-tool/index.ts ping
|
|
|
230
230
|
3. Run tools:
|
|
231
231
|
|
|
232
232
|
```bash
|
|
233
|
+
bun gh-tool rate-limit # Inspect all GitHub API rate-limit resources
|
|
234
|
+
bun gh-tool rate-limit --resource core # Inspect one resource
|
|
235
|
+
bun gh-tool telemetry # Report direct HTTP requests, gh invocations and ReadCache hits
|
|
236
|
+
bun gh-tool telemetry --hours 24 --format json # Report one day of telemetry
|
|
233
237
|
bun gh-tool pr status
|
|
234
238
|
bun observability-tool trace get 0b7bdf0dde1c55458364ba5588a8075e --env local
|
|
235
239
|
bun observability-tool trace search '{ status = error }' --env local --start now-6h
|
|
@@ -381,6 +385,7 @@ bun gh-tool pr rerun-checks --pr 123 --failed-only --watch --timeout 600
|
|
|
381
385
|
bun gh-tool pr trigger-checks --pr 123 --workflow dotnet-pull-request.yml # only when zero checks reported
|
|
382
386
|
bun gh-tool pr watch --prs 123,124 --format jsonl --timeout 600
|
|
383
387
|
bun gh-tool pr edit-comment --comment-id 456 --body-file correction.md # Edit your own review comment
|
|
388
|
+
bun gh-tool pr checkbox --pr 123 --match "Add regression coverage" --check # Toggle one PR task item
|
|
384
389
|
bun gh-tool pr edit-comment --comment-id 789 --kind issue --pr 123 --body "Corrected detail"
|
|
385
390
|
bun gh-tool pr reply-and-resolve --comment-id 456 --body "Done" # infers PR and thread
|
|
386
391
|
bun gh-tool pr request-review --repo be --pr 123 --reviewers alice,bob
|
|
@@ -437,7 +442,7 @@ bun audit-tool list --limit 50 --format json
|
|
|
437
442
|
bun audit-tool list --tool gh
|
|
438
443
|
|
|
439
444
|
# Filter by project directory
|
|
440
|
-
bun audit-tool list --project /
|
|
445
|
+
bun audit-tool list --project /home/user/my-repo
|
|
441
446
|
|
|
442
447
|
# Purge entries older than 30 days
|
|
443
448
|
bun audit-tool purge --days 30
|
|
@@ -647,7 +652,7 @@ The wrappers check outgoing user content and redact recognized credentials in ag
|
|
|
647
652
|
|
|
648
653
|
## Credential Guard
|
|
649
654
|
|
|
650
|
-
The guard
|
|
655
|
+
The guard checks tool inputs for named credential sources, sensitive file access, and supplied code that it cannot inspect. Write/Edit content checks detect known secret formats. Shell output and existing program contents are outside these checks.
|
|
651
656
|
|
|
652
657
|
**What it blocks:**
|
|
653
658
|
|
|
@@ -694,57 +699,27 @@ Claude Code uses shell command hooks. The package ships a ready-made wrapper scr
|
|
|
694
699
|
|
|
695
700
|
That's it. The hook reads tool input from stdin, runs the guard, and exits with code 2 (blocked + reason on stderr) or 0 (allowed).
|
|
696
701
|
|
|
697
|
-
|
|
702
|
+
### Shell policy
|
|
698
703
|
|
|
699
|
-
|
|
704
|
+
Bash and PowerShell use separate parsers and one shared policy. The policy checks that the command text names no secret source and supplies no code that the guard cannot inspect. A parse error, an analysis limit, or an unresolved executable, file path, environment name, or code operand refuses the command. Refusal messages identify the rule and give one recovery hint per rule family.
|
|
700
705
|
|
|
701
|
-
|
|
706
|
+
The guard follows local bindings, finite loops, substitutions, redirects, pipelines, nested supported shell bodies, and command chains. It checks each reachable command and each possible literal path. For example, `F=README.md; cat "$F"` passes. A binding made only after a successful `cd` does not become certain after a later semicolon. Command output does not establish a known filename or executable. Unsupported shell syntax and shell state changes refuse.
|
|
702
707
|
|
|
703
|
-
|
|
708
|
+
`HOME`, `PWD`, `OLDPWD`, and `PATH` are built-in non-secret names in Bash and PowerShell. Other environment reads require exact names in `credentialGuard.allowedEnvironmentVariables`, whose default list is empty. Bash HOME resolves to the hook home directory, and PWD follows the analyzed working directory. A successful Bash `cd` also records OLDPWD. Unresolved values, including PowerShell environment-provider values, remain unknown for roles that require literal paths or code. All four names retain ordinary path, code, and startup checks: `ls "$HOME/projects"` can pass, `cat "$HOME/.env"` refuses, and changing PATH before an interpreter refuses. Local literal bindings are separate from ambient environment values. Environment dumps, process-environment files, credential-store commands, and startup or executable-lookup mutations refuse. Bash treats `%NAME%` as literal text. PowerShell environment providers and names use PowerShell rules.
|
|
704
709
|
|
|
705
|
-
|
|
710
|
+
Command argument roles distinguish data, paths, environment names, executables, and code. Literal search patterns and Herdr prompt text stay data. Names-only listing and staging commands may name files that content readers cannot open. An unknown executable with literal nonsensitive operands can pass. This does not inspect its implementation or certify the contents of existing scripts, project tasks, native executables, aliases, or host startup files. Known CLI operations that require a wrapper still refuse. Supported literal help and version requests can pass without the wrapper.
|
|
706
711
|
|
|
707
|
-
|
|
712
|
+
Inline Python, JavaScript, and other runtime code refuse because they have no analyzer. This includes the Python and Node programs that older versions recognized with special-case patterns. Supported literal shell bodies receive recursive policy checks. Jq uses a closed passive grammar; it admits ordinary projections, literal objects and arrays, and supported pure filters. Environment access, imports, program files, interpolation, and unknown jq syntax refuse. Jq runs under the trusted host-startup assumption: the guard does not inspect the user's `.jq` file. The limited awk field-projection and sed print grammars also refuse unsupported programs.
|
|
708
713
|
|
|
709
|
-
|
|
714
|
+
`python3 -m py_compile src/main.py` is supported with literal nonsensitive source operands. Isolation flags and cache-location proofs are not required. Compilation can write bytecode caches and show source in error output. The guard checks the supplied operands; it does not inspect source contents or runtime identity. Inline cache-free Python alternatives remain unsupported.
|
|
710
715
|
|
|
711
|
-
|
|
716
|
+
Literal heredoc bodies can be written as data. Unquoted heredoc expansion is analyzed, and code sent to an interpreter requires a code analyzer. Redirect destinations receive path checks. Files written or copied during a command do not become trusted existing scripts when invoked later in that command. Bash output and heredoc writes do not receive Write/Edit content scanning.
|
|
712
717
|
|
|
713
|
-
|
|
718
|
+
Copy operations in a Herdr chain require `credentialGuard.chainCopyDestinations`. Copies also receive this destination proof whenever the configured list is nonempty. The synchronous filesystem check refuses errors, symlinks, missing parent directories, and destinations outside the configured directories. Ordinary copies without a Herdr invocation or configured destinations still receive normal source and destination checks.
|
|
714
719
|
|
|
715
|
-
|
|
720
|
+
Sensitive paths include credential files and configured blocked paths. Known template paths and explicit allowed paths can provide exceptions. Process-environment files cannot be allowed by a path exception. Slash direction and Windows path case are normalized independently of the host OS. General path checks do not resolve filesystem symlinks or confine commands to the repository; the copy-destination check above is the bounded filesystem exception. Custom command patterns apply to the original text, nested shell text, and resolved invocations.
|
|
716
721
|
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
With any `additionalBlockedPaths` rule, implicit compiler cache/temp filenames cannot be proved against that policy, so `py_compile` refuses. Use a cache-free syntax parse instead: `python3 -I -S -B -c 'import ast; ast.parse(open("src/main.py", "rb").read(), filename="src/main.py")'`. This form remains subject to source-path, inline-program and command policies. It parses the named source without executing it or writing target bytecode caches. The refusal explains the cache boundary separately from environment access.
|
|
720
|
-
|
|
721
|
-
Paths are checked against sensitive filename patterns and configured path rules. Supported proofs apply those checks to their expanded operands. Ordinary parent-directory and absolute paths may be allowed; the guard does not resolve filesystem paths or symlinks, or enforce repository confinement. The default kubeconfig pattern protects every path segment containing `kubeconfig`, including ancestor directories and names without separators such as `mykubeconfig` or `kubeconfig2`. Only a final ordinary Markdown basename that does not start with `kubeconfig`, such as `check-kubeconfig-topology.md` or `cluster-kubeconfig-notes.md`, has the documentation exception; the `.md` suffix must be the exact end of the path. A kubeconfig-containing ancestor still matches the blocked pattern; `kubeconfig.md` remains protected. Existing explicit path allowances take precedence over blocked patterns, including template names such as `prod-kubeconfig/.env.example` and configured `additionalAllowedPaths`. Otherwise, configured blocked paths still apply to documentation names. This filename convention does not attest file contents, and there is no blanket Markdown or memory-directory exception.
|
|
722
|
-
|
|
723
|
-
Recognized Linux process-environment paths such as `/proc/self/environ`, `/proc/thread-self/environ`, and PID/task variants are blocked before configured path exceptions.
|
|
724
|
-
|
|
725
|
-
Single literal `echo`/`printf` writes with output redirection and single `cat`/`tee` heredoc writes are allowed. Heredoc braces are data. Use a quoted delimiter for literal code; unquoted heredocs containing `$`, backticks, or backslashes do not receive the literal-write exception. The exception permits only supported combinations with navigation or selected inspections; unsupported following commands remain outside it. Supported complete Python stdin heredocs are checked as inline programs, with the normal runtime-argument, path, execution, and environment checks.
|
|
726
|
-
|
|
727
|
-
A supported Python stdin heredoc can be followed by complete literal `cat`/`tee` heredoc writers and passive consumers. The guard retains every writer header, file operand and redirect while excluding only the proved literal bodies from path evidence. Incomplete bodies, executable/unknown headers and unsupported following commands gain no exception. Heredoc composition is bounded to 32 bodies and 65,536 bytes. This separates prose from path operands; Bash writes/output are not content attestation, and Write/Edit secret scanning remains separate.
|
|
728
|
-
|
|
729
|
-
Quoted single-letter literal bindings such as `D="/workspace/docs/topic"; ls -la "$D"; grep -n X "$D/file.md"` receive the existing closed path proof. Finite literal loops can use the binder inside a jq filename, for example `for i in 1 2; do jq '.rows // [] | length' sample-$i.json; done`; the filter/options and every materialized path are checked. A derived path list such as `f=$(git grep -l PATTERN -- '*.cs')` remains unproved: the input-only guard cannot inspect output paths, shell splitting or sensitive matches. Use direct `git grep` output or separately checked literal paths. This refusal identifies a local derived binding rather than claiming ambient environment access. A literal binding in a script/executable operand also remains outside the file-data proof.
|
|
730
|
-
|
|
731
|
-
The same finite loop proof admits numeric `--pr` selectors for `bun run gh-tool pr checks`, `checks-failed`, `info` and `review-triage`, with optional literal `--repo`, and `git diff [one literal revision-shaped operand] -- literal filenames`. Git diff loop prefix options, including output/order files and no-index mode, remain unproved. Git can implicitly compare filesystem paths outside a worktree or when a path points outside it. The optional operand also receives ordinary/custom file policy as a potential path, including proved cwd and Git `-C` qualification; the guard does not certify repository context or guarantee that it is a revision. Every generated path receives the ordinary policy. One literal local directory binding may be used only by the first successful gated `cd`, followed by supported literal commands including Git clone without executable configuration/upload-pack options. Variable script operands and HOME-dependent tilde bindings remain unproved.
|
|
732
|
-
|
|
733
|
-
Literal Herdr prompt pipelines may compose with independent commands such as pane close or a literal script operation. The prompt pipeline's consumers must be supported data commands; each sibling still receives ordinary path, environment, runtime and configured policy checks. If the lexer finds an unterminated quoted argument, recovery explains shell encoding. A single-quoted apostrophe can be encoded as `'don'"'"'t'`. File-input options are recommended only when the command documents one.
|
|
734
|
-
|
|
735
|
-
Bun's late startup-flag scan respects a separate `--` after a supported literal task/file operand. Words thereafter are tool argv for this scan, including `-p:Example=false`; actual startup controls before the separator still refuse. Missing targets, runtime subcommands and embedded/attached separator text do not receive this boundary. Task/file lookup retains the existing trusted host/project assumption, including task lifecycle hooks; source contents are not inspected. Explicit interpreter lookup/loader variables such as `BUN_OPTIONS`, `NODE_OPTIONS`, `PYTHONPATH` and `BASH_ENV` cannot establish startup context. Literal ordinary selector/deadline prefixes remain subject to the existing path/environment rules.
|
|
736
|
-
|
|
737
|
-
Shared Git diff inspection uses a finite argv-role table. Output/order-file values and positional revision/file words receive ordinary/custom path policy, with proved cwd and Git `-C` qualification. Known required search/prefix values are data; optional context/rename/color/relative values attach to their option and never consume the next file. Short clusters are read left to right, so `-pO.env` has a file role and `-S-O.env` has a search-data role. Exact long options take priority over unique supported abbreviations; ambiguous/unknown options, incomplete roles and executable callbacks refuse with Git-specific recovery. This does not inspect repository state, trusted native executables/configuration, task contents, aliases or symlinks.
|
|
738
|
-
|
|
739
|
-
Python JSON parsing, dictionary iteration, and printing are not themselves evidence of credential access. They follow the same access and execution rules as other supported inline programs. This intentionally permits ordinary JSON output that older versions refused. Unknown secrets in ordinary files can therefore reach arbitrary shell output; wrapper content checks do not protect that output. A refusal caused by unsupported syntax means the guard could not establish its policy conditions, not that it observed a secret being read.
|
|
740
|
-
|
|
741
|
-
The bounded Python subprocess proof supports one immutable literal argv binding followed by one `subprocess.run` call. A literal `cwd` is replayed as a quoted, success-gated directory change before the nested argv, so relative reader operands and named directories receive the ordinary path policies. Supported directories are literal relative or absolute paths, including quoted spaces. Empty, dynamic, Unicode, escaped, tilde and other unsupported directory forms refuse rather than dropping the context. Cwd proof recursively unwraps only supported command, RTK proxy and environment wrappers. Environment directory/split-string options and unproved wrapper forms refuse. Only supported passive text, reader, metadata, literal Bun script and blocked CLI roles receive nested replay; shell executors, inline interpreter programs, unproved sed programs, find execution actions and unknown command roles refuse. Nested blocked CLI, environment, sensitive-path and custom-command policies remain active. Outer shell redirects retain their original shell directory. Arbitrary multi-call Python and `check_output` programs remain unsupported; direct Git metadata commands provide index/tree inspection.
|
|
742
|
-
|
|
743
|
-
Supported runtime script/tool operands form an argument boundary: a later tool `-c` configuration flag is data. Genuine eval and loader flags, Bun exec/repl and unproved startup-option arity still refuse. Literal Herdr prompts can compose with literal agent-get, pane-read and agent-read forms and passive consumers. Both read forms require a literal identifier followed by `--source recent-unwrapped --lines N`, with positive integer `N`. A separate `sleep N` command accepts one literal nonnegative integer or decimal duration; delay pipelines, options and extra operands receive no composition proof. Delay redirects receive the ordinary sensitive-path checks. The wrapper sleep-polling guard still applies. One literal `--sql` operand on the supported `bun run db-tool sql/query` shape can contain SQL braces; substitutions, duplicate SQL operands and unknown wrapper options receive no exception. SQL output pipelines require closed passive consumers, so shell, xargs and unknown executors refuse. Native `cut` joins those passive consumers for byte, character and field selection, including after a proved sed print program. Its literal file operands and redirects still receive the shared path checks, and expansion, environment, blocked CLI and configured command policies remain active. This recognizes textual native command roles; it does not verify binaries, aliases or command lookup. Numeric `$?` can appear only in passive echo/printf data operands, with passive pipeline consumers. Explicitly approved environment names can appear in quoted equality or blankness tests, including the quoted empty default `${NAME:-}`. This does not add default-approved names or permit shell evaluators. One sed print program with numeric or escaped-regex addresses/ranges and known `-n`/`-E` flags is passive; execution/read/write callbacks, extra programs and script files receive no print proof. Local file bindings use that same closed print proof and never a generic sed-word fallback. Ordinary path and configured command policies still apply to all these forms.
|
|
744
|
-
|
|
745
|
-
Literal shell bodies receive recursive shared policy replay under exact `sh -c`/`bash -c` and `zsh -f -c` invocations, using only these bare executable names or their `/bin/` and `/usr/bin/` paths and known RTK/command wrappers. Both protected paths and blocked CLIs remain enforced inside the body, along with environment and custom-command policies. A conventional shell-family name or numeric version in an unproved executing operand/control position refuses; proved literal text, reader and file-metadata operands remain data. Only the listed sh/bash/zsh identities receive body replay; rbash/rksh/ksh93 and versioned names refuse, and arbitrary renamed executables are outside this identity proof. Replay permits only existing closed body roles/materializations, at most eight shell levels and 64 KiB per invocation. Unproved options, environment prefixes, active exec/nohup/sudo wrappers, positional/script/stdin forms, executable binders, control flow and outer directory changes around a wrapper refuse. A body-internal proved cd affects body readers; outer redirects retain the outer shell directory. This is a textual body proof, not verification of native binaries or all host startup code. In particular, zsh -f still sources the global zshenv file. For unsupported executable inventories, use separate literal metadata requests and literal candidate invocations; no program name or --version flag receives a special exception.
|
|
746
|
-
|
|
747
|
-
A separate bounded Node proof supports literal `package.json` inventory loops that print `bin` metadata or use the supported scripts filter. The complete invocation must preserve loader identity through known passive commands, closed literal writers, or proved inventories. Startup/environment mutations, unknown commands, loader changes, and other dynamic loading remain unproved and are refused.
|
|
722
|
+
The kubeconfig pattern protects path segments containing `kubeconfig`. A final ordinary Markdown basename such as `check-kubeconfig-topology.md` has a documentation exception; `kubeconfig.md` and kubeconfig-containing parent directories remain protected. Explicit allowed paths take precedence over ordinary blocked patterns. This filename convention does not attest file contents.
|
|
748
723
|
|
|
749
724
|
### Setup for OpenCode
|
|
750
725
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/credential-guard/bash.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAKV,UAAU,EAIV,MAAM,EAIP,MAAM,MAAM,CAAC;AAgvBd,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,CAE3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-hook.d.ts","sourceRoot":"","sources":["../../src/credential-guard/claude-hook.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG"}
|
|
1
|
+
{"version":3,"file":"claude-hook.d.ts","sourceRoot":"","sources":["../../src/credential-guard/claude-hook.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.test.d.ts","sourceRoot":"","sources":["../../src/credential-guard/engine.test.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,cAAc,UAoI1B,CAAC;AACF,eAAO,MAAM,gBAAgB,UA0T5B,CAAC;AA4FF,eAAO,MAAM,oBAAoB,UAShC,CAAC;AACF,eAAO,MAAM,sBAAsB,UA+BlC,CAAC"}
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Credential Guard
|
|
3
|
-
*
|
|
4
|
-
* Security patterns and functions for detecting sensitive files and secrets.
|
|
5
|
-
* Used by AI coding agent hooks/plugins.
|
|
6
|
-
*
|
|
7
|
-
* Security layers:
|
|
8
|
-
* 1. Path-based blocking (files that should never be read)
|
|
9
|
-
* 2. Content scanning (detect secrets in write operations)
|
|
10
|
-
* 3. Dangerous bash command detection
|
|
11
|
-
* 4. CLI tool blocking (must use wrapper tools)
|
|
12
|
-
*
|
|
13
|
-
* Note: This is a convenience layer. Real security should be enforced
|
|
14
|
-
* at infrastructure level (K8s RBAC, file permissions, etc.)
|
|
15
|
-
*/
|
|
16
1
|
import type { CredentialGuardConfig } from "#config/types";
|
|
17
2
|
export { findSecretMatches } from "#shared/credential-patterns";
|
|
18
3
|
export { redactSensitiveText } from "#shared/content-security";
|
|
@@ -47,33 +32,21 @@ export declare function extractFilePath(args: Record<string, unknown>): string;
|
|
|
47
32
|
export declare function extractContent(args: Record<string, unknown>): string;
|
|
48
33
|
/** Extract command from hook arguments. */
|
|
49
34
|
export declare function extractCommand(args: Record<string, unknown>): string;
|
|
50
|
-
/**
|
|
51
|
-
* Create a credential guard with optional extra patterns merged into defaults.
|
|
52
|
-
*
|
|
53
|
-
* @param config - Optional overrides. Arrays are concatenated with defaults (not replaced).
|
|
54
|
-
* @returns Object with all guard functions bound to the merged pattern sets.
|
|
55
|
-
*/
|
|
56
35
|
export declare function createCredentialGuard(config?: CredentialGuardConfig): CredentialGuard;
|
|
57
36
|
/** Handle tool execution with default guard (no extra config). */
|
|
58
|
-
export declare const handleToolExecuteBefore:
|
|
37
|
+
export declare const handleToolExecuteBefore: CredentialGuard["handleToolExecuteBefore"];
|
|
59
38
|
/** Detect secrets in content with default guard. */
|
|
60
|
-
export declare const detectSecrets:
|
|
61
|
-
name: string;
|
|
62
|
-
match: string;
|
|
63
|
-
} | null;
|
|
39
|
+
export declare const detectSecrets: CredentialGuard["detectSecrets"];
|
|
64
40
|
/** Check if a path is in the allowed exceptions list (default guard). */
|
|
65
|
-
export declare const isPathAllowed:
|
|
41
|
+
export declare const isPathAllowed: CredentialGuard["isPathAllowed"];
|
|
66
42
|
/** Check if a path should be blocked (default guard). */
|
|
67
|
-
export declare const isPathBlocked:
|
|
43
|
+
export declare const isPathBlocked: CredentialGuard["isPathBlocked"];
|
|
68
44
|
/** Check if a bash command might expose secrets (default guard). */
|
|
69
|
-
export declare const isDangerousBashCommand:
|
|
45
|
+
export declare const isDangerousBashCommand: CredentialGuard["isDangerousBashCommand"];
|
|
70
46
|
/** Get blocked CLI tool info (default guard). */
|
|
71
|
-
export declare const getBlockedCliTool:
|
|
72
|
-
name: string;
|
|
73
|
-
wrapper: string;
|
|
74
|
-
} | null;
|
|
47
|
+
export declare const getBlockedCliTool: CredentialGuard["getBlockedCliTool"];
|
|
75
48
|
/** Check if a gh command is allowed (default guard). */
|
|
76
|
-
export declare const isGhCommandAllowed:
|
|
49
|
+
export declare const isGhCommandAllowed: CredentialGuard["isGhCommandAllowed"];
|
|
77
50
|
/** Detect sleep-polling with agent-tools wrapper commands (default guard). */
|
|
78
|
-
export declare const detectSleepPolling:
|
|
51
|
+
export declare const detectSleepPolling: CredentialGuard["detectSleepPolling"];
|
|
79
52
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/credential-guard/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/credential-guard/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAY3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAM/D,8CAA8C;AAC9C,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,+CAA+C;AAC/C,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B,CAAC;AAEF,+CAA+C;AAC/C,MAAM,MAAM,eAAe,GAAG;IAC5B,uBAAuB,EAAE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AAE3C,yEAAyE;AACzE,eAAO,MAAM,aAAa,EAAE,eAAe,CAAC,eAAe,CACjB,CAAC;AAE3C,yDAAyD;AACzD,eAAO,MAAM,aAAa,EAAE,eAAe,CAAC,eAAe,CACjB,CAAC;AAE3C,oEAAoE;AACpE,eAAO,MAAM,sBAAsB,EAAE,eAAe,CAAC,wBAAwB,CAC1B,CAAC;AAEpD,iDAAiD;AACjD,eAAO,MAAM,iBAAiB,EAAE,eAAe,CAAC,mBAAmB,CACrB,CAAC;AAE/C,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAAC,oBAAoB,CACtB,CAAC;AAEhD,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAAC,oBAAoB,CACtB,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
export type Span = {
|
|
2
|
+
readonly start: number;
|
|
3
|
+
readonly end: number;
|
|
4
|
+
};
|
|
5
|
+
export type Script = {
|
|
6
|
+
readonly kind: "script";
|
|
7
|
+
readonly dialect: "bash" | "powershell";
|
|
8
|
+
readonly source: string;
|
|
9
|
+
readonly body: List;
|
|
10
|
+
readonly span: Span;
|
|
11
|
+
};
|
|
12
|
+
export type List = {
|
|
13
|
+
readonly items: readonly AndOr[];
|
|
14
|
+
};
|
|
15
|
+
export type AndOr = {
|
|
16
|
+
readonly first: Pipeline;
|
|
17
|
+
readonly background: boolean;
|
|
18
|
+
readonly rest: readonly {
|
|
19
|
+
readonly op: "&&" | "||";
|
|
20
|
+
readonly pipeline: Pipeline;
|
|
21
|
+
}[];
|
|
22
|
+
};
|
|
23
|
+
export type Pipeline = {
|
|
24
|
+
readonly negated: boolean;
|
|
25
|
+
readonly stderr: boolean;
|
|
26
|
+
readonly commands: readonly Command[];
|
|
27
|
+
};
|
|
28
|
+
export type Command = SimpleCommand | {
|
|
29
|
+
readonly kind: "group";
|
|
30
|
+
readonly subshell: boolean;
|
|
31
|
+
readonly body: List;
|
|
32
|
+
readonly redirects: readonly Redirect[];
|
|
33
|
+
readonly span: Span;
|
|
34
|
+
} | {
|
|
35
|
+
readonly kind: "for";
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly items: readonly Word[];
|
|
38
|
+
readonly body: List;
|
|
39
|
+
readonly redirects: readonly Redirect[];
|
|
40
|
+
readonly span: Span;
|
|
41
|
+
} | {
|
|
42
|
+
readonly kind: "while";
|
|
43
|
+
readonly condition: List;
|
|
44
|
+
readonly body: List;
|
|
45
|
+
readonly redirects: readonly Redirect[];
|
|
46
|
+
readonly span: Span;
|
|
47
|
+
} | {
|
|
48
|
+
readonly kind: "until";
|
|
49
|
+
readonly condition: List;
|
|
50
|
+
readonly body: List;
|
|
51
|
+
readonly redirects: readonly Redirect[];
|
|
52
|
+
readonly span: Span;
|
|
53
|
+
} | {
|
|
54
|
+
readonly kind: "if";
|
|
55
|
+
readonly branches: readonly {
|
|
56
|
+
readonly condition: List;
|
|
57
|
+
readonly body: List;
|
|
58
|
+
}[];
|
|
59
|
+
readonly otherwise: List | null;
|
|
60
|
+
readonly redirects: readonly Redirect[];
|
|
61
|
+
readonly span: Span;
|
|
62
|
+
} | {
|
|
63
|
+
readonly kind: "case";
|
|
64
|
+
readonly subject: Word;
|
|
65
|
+
readonly arms: readonly {
|
|
66
|
+
readonly patterns: readonly Word[];
|
|
67
|
+
readonly body: List;
|
|
68
|
+
}[];
|
|
69
|
+
readonly redirects: readonly Redirect[];
|
|
70
|
+
readonly span: Span;
|
|
71
|
+
} | {
|
|
72
|
+
readonly kind: "test";
|
|
73
|
+
readonly words: readonly Word[];
|
|
74
|
+
readonly span: Span;
|
|
75
|
+
};
|
|
76
|
+
export type SimpleCommand = {
|
|
77
|
+
readonly kind: "simple";
|
|
78
|
+
readonly assignments: readonly Assignment[];
|
|
79
|
+
readonly argv: readonly Word[];
|
|
80
|
+
readonly redirects: readonly Redirect[];
|
|
81
|
+
readonly span: Span;
|
|
82
|
+
};
|
|
83
|
+
export type Assignment = {
|
|
84
|
+
readonly operation: "replace" | "opaque";
|
|
85
|
+
readonly name: string;
|
|
86
|
+
readonly value: Word;
|
|
87
|
+
readonly exported: boolean;
|
|
88
|
+
};
|
|
89
|
+
export type Word = {
|
|
90
|
+
readonly split: boolean;
|
|
91
|
+
readonly parts: readonly WordPart[];
|
|
92
|
+
readonly span: Span;
|
|
93
|
+
};
|
|
94
|
+
export type WordPart = {
|
|
95
|
+
readonly kind: "literal";
|
|
96
|
+
readonly text: string;
|
|
97
|
+
readonly quoted: boolean;
|
|
98
|
+
} | {
|
|
99
|
+
readonly kind: "glob";
|
|
100
|
+
readonly text: string;
|
|
101
|
+
} | {
|
|
102
|
+
readonly kind: "brace";
|
|
103
|
+
readonly alternatives: readonly string[];
|
|
104
|
+
} | {
|
|
105
|
+
readonly kind: "parameter";
|
|
106
|
+
readonly name: string;
|
|
107
|
+
readonly ambient: boolean;
|
|
108
|
+
readonly operator: "plain" | "default" | "alternate" | "length";
|
|
109
|
+
readonly operand: Word | null;
|
|
110
|
+
readonly span: Span;
|
|
111
|
+
} | {
|
|
112
|
+
readonly kind: "special";
|
|
113
|
+
readonly name: string;
|
|
114
|
+
} | {
|
|
115
|
+
readonly kind: "command-substitution";
|
|
116
|
+
readonly body: Script;
|
|
117
|
+
} | {
|
|
118
|
+
readonly kind: "process-substitution";
|
|
119
|
+
readonly body: Script;
|
|
120
|
+
};
|
|
121
|
+
export type Redirect = ({
|
|
122
|
+
readonly kind: "file";
|
|
123
|
+
readonly op: "<" | ">" | ">>" | "<>" | ">|" | "&>" | "&>>";
|
|
124
|
+
readonly target: Word;
|
|
125
|
+
} | {
|
|
126
|
+
readonly kind: "duplicate";
|
|
127
|
+
readonly input: boolean;
|
|
128
|
+
readonly target: string;
|
|
129
|
+
} | {
|
|
130
|
+
readonly kind: "heredoc";
|
|
131
|
+
readonly body: Word;
|
|
132
|
+
readonly literal: boolean;
|
|
133
|
+
} | {
|
|
134
|
+
readonly kind: "herestring";
|
|
135
|
+
readonly body: Word;
|
|
136
|
+
}) & {
|
|
137
|
+
readonly fd: number | null;
|
|
138
|
+
};
|
|
139
|
+
export type ParseErrorCode = "syntax" | "unterminated-quote" | "unterminated-heredoc" | "unterminated-substitution" | "function-definition" | "unsupported-keyword" | "indirect-expansion" | "unsupported-parameter-operator" | "depth-limit" | "size-limit" | "work-limit";
|
|
140
|
+
export type ParseError = {
|
|
141
|
+
readonly kind: "parse-error";
|
|
142
|
+
readonly code: ParseErrorCode;
|
|
143
|
+
readonly span: Span;
|
|
144
|
+
};
|
|
145
|
+
export declare const MAX_ANALYSIS_UNITS = 4096;
|
|
146
|
+
export declare const MAX_PARSE_DEPTH = 8;
|
|
147
|
+
export declare const MAX_SCRIPT_BYTES = 262144;
|
|
148
|
+
export declare function literalWord(text: string, span?: Span): Word;
|
|
149
|
+
export declare function wordText(word: Word): string | undefined;
|
|
150
|
+
//# sourceMappingURL=ir.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir.d.ts","sourceRoot":"","sources":["../../src/credential-guard/ir.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AACpE,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB,CAAC;AACF,MAAM,MAAM,IAAI,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,KAAK,EAAE,CAAA;CAAE,CAAC;AACxD,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,CAAC,KAAK,EAAE,QAAQ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ACjB,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB,CAAC;AACF,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,eAAO,MAAM,gBAAgB,SAAS,CAAC;AACvC,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,IAA2B,GAAG,IAAI,CAEjF;AACD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAOvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"literal-output.d.ts","sourceRoot":"","sources":["../../src/credential-guard/literal-output.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAO1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passive-awk.d.ts","sourceRoot":"","sources":["../../src/credential-guard/passive-awk.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CA8OzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passive-jq.d.ts","sourceRoot":"","sources":["../../src/credential-guard/passive-jq.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"passive-jq.d.ts","sourceRoot":"","sources":["../../src/credential-guard/passive-jq.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEzD;AAmSD,4FAA4F;AAC5F,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAsBxE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passive-sed.d.ts","sourceRoot":"","sources":["../../src/credential-guard/passive-sed.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CA6EzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passive.test.d.ts","sourceRoot":"","sources":["../../src/credential-guard/passive.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const CODE_OR_PROSE_EXTENSION: RegExp;
|
|
2
|
+
export declare const DEFAULT_BLOCKED_PATH_PATTERNS: RegExp[];
|
|
3
|
+
export declare const DEFAULT_ALLOWED_PATH_PATTERNS: RegExp[];
|
|
4
|
+
export type PathContext = {
|
|
5
|
+
readonly home: string;
|
|
6
|
+
readonly cwd: string;
|
|
7
|
+
readonly contentRead?: boolean;
|
|
8
|
+
readonly additionalBlockedPaths?: readonly RegExp[];
|
|
9
|
+
readonly additionalAllowedPaths?: readonly RegExp[];
|
|
10
|
+
};
|
|
11
|
+
export declare function normalizePath(path: string, home?: string, cwd?: string): string;
|
|
12
|
+
export declare function isSensitivePath(path: string, context: PathContext): boolean;
|
|
13
|
+
export declare function expandGlobAlternatives(pattern: string): readonly string[] | null;
|
|
14
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/credential-guard/paths.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,QAC8C,CAAC;AAEnF,eAAO,MAAM,6BAA6B,EAAE,MAAM,EAgBjD,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,MAAM,EAEjD,CAAC;AAKF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,sBAAsB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpD,QAAQ,CAAC,sBAAsB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACrD,CAAC;AACF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,SAAM,EAAE,GAAG,SAAM,GAAG,MAAM,CAmBzE;AAID,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CA2B3E;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,IAAI,CAkBhF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ParseError, Script, Span } from "./ir";
|
|
2
|
+
import type { PathContext } from "./paths";
|
|
3
|
+
import type { Registry } from "./registry";
|
|
4
|
+
export type RuleId = string & {
|
|
5
|
+
readonly __brand: "RuleId";
|
|
6
|
+
};
|
|
7
|
+
export type Finding = {
|
|
8
|
+
readonly rule: RuleId;
|
|
9
|
+
readonly detail: string;
|
|
10
|
+
readonly span: Span;
|
|
11
|
+
};
|
|
12
|
+
export type Decision = {
|
|
13
|
+
readonly kind: "pass";
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: "violation";
|
|
16
|
+
readonly findings: readonly [Finding, ...Finding[]];
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: "missing-knowledge";
|
|
19
|
+
readonly findings: readonly [Finding, ...Finding[]];
|
|
20
|
+
};
|
|
21
|
+
export type PolicyContext = PathContext & {
|
|
22
|
+
readonly approvedNames?: ReadonlySet<string>;
|
|
23
|
+
readonly onInvocation?: (executable: string, argv: readonly (string | undefined)[]) => void;
|
|
24
|
+
readonly registry?: Registry;
|
|
25
|
+
readonly dangerousPatterns?: readonly RegExp[];
|
|
26
|
+
readonly isPathBlocked?: (path: string) => boolean;
|
|
27
|
+
readonly chainCopyDestinations?: readonly string[];
|
|
28
|
+
readonly proveCopyDestination?: (path: string, source: string) => boolean;
|
|
29
|
+
};
|
|
30
|
+
export type Value = {
|
|
31
|
+
readonly kind: "literal";
|
|
32
|
+
readonly texts: readonly string[];
|
|
33
|
+
} | {
|
|
34
|
+
readonly kind: "opaque";
|
|
35
|
+
readonly mentions: readonly string[];
|
|
36
|
+
readonly prefix: string;
|
|
37
|
+
readonly globPatterns?: readonly string[];
|
|
38
|
+
readonly supplied?: boolean;
|
|
39
|
+
} | {
|
|
40
|
+
readonly kind: "stream";
|
|
41
|
+
readonly stdout: Value;
|
|
42
|
+
};
|
|
43
|
+
export declare const MAX_VALUE_ALTERNATIVES = 64;
|
|
44
|
+
export declare const MAX_LOOP_PASSES = 8;
|
|
45
|
+
export declare const MAX_FOLD_STEPS = 20000;
|
|
46
|
+
export declare function judge(script: Script | ParseError, context: PolicyContext): Decision;
|
|
47
|
+
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/credential-guard/policy.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAiB,UAAU,EAAsB,MAAM,EAAE,IAAI,EAAQ,MAAM,MAAM,CAAC;AAO9F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,KAAK,EAAmB,QAAQ,EAAE,MAAM,YAAY,CAAC;AAqB5D,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;AAQ7D,MAAM,MAAM,OAAO,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,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