Skip to content

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

TypeScript

chore: Update mods/

GitHub Actions (publish-mods)5a2676e1079c
diff --git a/mods/sec-default/README.md b/mods/sec-default/README.md
index 81f7f050..afca903d 100644
--- a/mods/sec-default/README.md
+++ b/mods/sec-default/README.md
@@ -34,7 +34,7 @@ settings it decides by.
| `tool.describe`, `command.describe`, `agent.offer`, `agent.spawn` | When the subject's pinned `e.provider.tier` is `prepend` or `append` (a policy-installed plugin, the managed folder, a policy MCP server), continue past the user tier; a subject provided by `user`, `builtin` or `core` passes. |
| `tool.register` | A caller in `prepend` or `append` continues past the user tier. A `user`-tier caller is refused by name while managed settings hold `allowedMcpServers` (set at all, empty included). With no allowlist, one is still refused whose tool, called `mcp__<plugin>__<tool>`, would read as a tool of a server the organization delivers: a `managedMcpServers` entry, or a server of the enterprise `managed-mcp.json`, which the policy read names under that key. So is one whose name reads as a plugin the organization seats itself (`prependPlugins`, `appendPlugins`, or an id managed `enabledPlugins` turns on, by `true` or by a version list, as the engine reads an entry), or as an MCP server such a plugin's own manifest declares, which the engine spells under the plugin's scope (`mcp__plugin_<plugin>_<server>__`). A `user`-tier plugin keeps its own name exactly when the id the engine recorded for it (`<name>@<marketplace>`: the settings key the loader resolved, never the plugin's manifest) is one managed `enabledPlugins` turn on, compared as the engine compares ids (NFC, then lower case). That is how an organization's own plugin registers its tools where the engine leaves it in the `user` tier: only a copy read in place from a local folder marketplace that managed settings name is vouched for, so a plugin from a remote marketplace (git, GitHub, npm) can never be vouched for in this release, and neither is one a version list turns on. For an organization that means such a plugin runs among a person's plugins in the chain, not ahead of them, and keeps its tools by this exemption alone. A plugin loaded with `--plugin-dir` is always `<name>@inline` and never matches; nor does a same-named plugin from another marketplace, one whose name only folds to the organization's, or an id policy lists only in `prependPlugins` or `appendPlugins`. A person who registers a marketplace of their own under the organization's marketplace name gets an equal id, and so the exemption: it gives that plugin what every plugin had before this hold existed, and `strictKnownMarketplaces` in managed settings closes it today by allowing no other marketplace source. The mod hears a plugin's id at its admission, so after a load that seats the mod afresh while other plugins stay seated (a load that folds again, as a policy change mid-session can cause) the organization's own plugin is refused its name until the session restarts. A plugin's own MCP servers are connected by the engine from its manifest, not registered through `tool.register`, so they are unaffected. An id's name is everything before its last at-sign, as the engine parts ids, so a scoped `@scope/name@npm` counts. A `managed-mcp.json` that is present and cannot be read whole names nobody: the policy read marks it (`managedMcpServersUnreadable`) and every such registration is refused while it stands, its servers never taken for none; the only other reader of the mark is `tool.list` (the next row), so a person's plugins still load and still set what is not pinned. A server the file names and the engine dropped with a warning is still named; a warning about a server that loads is no failure. Names are compared folded, as a model reads them (spelled as the engine spells a name inside a tool's name, every character outside letters, digits, `-` and `_` a `_` and nothing normalized; then lower case, every run of `-` and `_` one `_`; a seated plugin counts under its name composed and decomposed, since the engine spells its tools from its manifest's own form): a plugin named as the server in any case or with other separators, one whose name and tool together spell it, and one whose tool's own name folds to nothing, is refused. A server whose name folds to nothing (no letter or digit in it) cannot be told from any name, so while the policy names one every `user`-tier registration is refused. The engine pins the tool's name at this event (a hook beneath that hands on another name fails, and the chain goes on without it), so the name judged is the name registered. Otherwise it passes. |
| `tool.list` | The tools of the organization's managed MCP servers, of the plugins it seats itself and of the MCP servers those plugins' own manifests declare (told by the name whole, as the engine spells it inside a tool's name: `mcp__<server>__`, never by a fold, so another server whose name only begins like the organization's is not taken for it; a seated plugin and its own servers, under its scope `mcp__plugin_<plugin>_`, fold to fold as the registration check compares, so policy may list its id in another letter case, and another plugin whose name begins with the seated one's and a `-` or `_` reads the same) are listed as the organization's tiers listed them; every other tool as the user tier left it. Where the server file cannot be read, every `mcp__` tool counts as the organization's. With no policy to read, or a refusal from either listing, the organization's listing stands whole. |
-| `tool.check` | A deny, an ask a settings rule, a classic hook, a setting's own check or an organization's ceiling on the tool stands behind, an ask a host answers in the person's place and an ask a built-in or an organization's hook put to a person, hold whole over the user tier: when a person's plugin rewrote the verdict it was handed without tightening it (a more permissive decision, or the same decision under another reason or with what it names changed), the dispatch is run again past the user tier, and unless the chain's answer is the stricter, that verdict, if it is a deny or names what stands behind it or who it is put to, is the answer as the engine gave it. See [Deny rules hold](#deny-rules-hold). Every other verdict passes as the chain left it. |
+| `tool.check` | A deny, an ask a settings rule, a classic hook, a setting's own check or an organization's ceiling on the tool stands behind, an ask a host answers in the person's place and an ask a built-in or an organization's plugin made, hold whole over the user tier: when a person's plugin rewrote the verdict it was handed without tightening it (a more permissive decision, or the same decision under another reason or with what it names changed), the dispatch is run again past the user tier, and unless the chain's answer is the stricter, that verdict, if it is a deny, names what stands behind it or is an ask a host answers, is the answer as the engine gave it. See [Deny rules hold](#deny-rules-hold). Every other verdict passes as the chain left it. |
| `ui.log` | A line a plugin in `prepend` or `append` logs, this one's included, continues past the user tier: no user hook rewrites or drops it, and none runs inside the hook that logged it. Every other line passes. |
| `env.get` | A read by a plugin in `prepend` or `append` continues past the user tier: no user hook answers what the organization's own plugin reads. Every other read passes. |
| `env.set` | A write by a plugin in `prepend` or `append` continues past the user tier, whatever the variable: no user hook rewrites or drops what the organization's own plugin sets. A variable managed settings set in `env` (its name in any case) is pinned, and so are `CLAUDE_CODE_PROCESS_WRAPPER` where they name a launcher with `processWrapper` and, always, the nine variables that move where policy and sign-in are read from or how policy's tiers compose (`CLAUDE_CODE_MANAGED_SETTINGS_PATH`, `CLAUDE_CODE_REMOTE_SETTINGS_PATH`, `CLAUDE_CODE_MOCK_REMOTE_SETTINGS`, `CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION`, `CLAUDE_CONFIG_DIR`, `CLAUDE_SECURESTORAGE_CONFIG_DIR`, `USE_LOCAL_OAUTH`, `USE_STAGING_OAUTH` and `CLAUDE_LOCAL_OAUTH_API_BASE`, which choose the server sign-in goes to; all nine on every build), and, on every build too, ten variables that can load code into a child the engine starts (`LD_PRELOAD`, `LD_LIBRARY_PATH`, `LD_AUDIT`, `DYLD_INSERT_LIBRARIES`, `DYLD_LIBRARY_PATH`, `DYLD_FRAMEWORK_PATH`, `BASH_ENV`, `ENV`, `ZDOTDIR`, `NODE_OPTIONS`): setting or unsetting it, a `user`-tier caller is refused by name and a built-in's write continues past the user tier. Any other variable is a person's plugin's to set. With no policy to read, every variable counts as pinned. `allowModsToOverrideDenyRules` does not unpin. See [Pinned variables](#pinned-variables). |
@@ -93,7 +93,7 @@ not loaded. Settings hooks, status lines and `/goal` are not touched by it.
`allowModsToOverrideDenyRules`: the plugins a person installs may answer
over a settings deny rule on `tool.check`, as they could before this plugin
held deny rules, and over every other deny, an ask rule, a classic hook's
-ask, a setting's own ask or an ask a host or a person answers with it: the one option
+ask, a setting's own ask or an ask a host answers or a plugin made with it: the one option
covers all that holds there. Off unless it is the
literal `true`; an option that reads as unset leaves them holding. See
[Deny rules hold](#deny-rules-hold).
@@ -150,8 +150,8 @@ host was to answer. Where this plugin is seated it does not:
chain's answer whatever decided it; an ask, when it names what decided it,
a settings rule (`rule`), a classic hook (`hook`), a setting whose own
check asked (`setting`) or an organization's ask cap on the tool
- (`ceiling`), or names who answers it (`decider`: a host, or a person a
- built-in or an organization's hook put it to). It is returned
+ (`ceiling`) or a built-in's or an organization's plugin that made it
+ (`plugin`), and an ask a host answers (`e.approver`). It is returned
whole, so the reason this event answers, which a person reads in the
prompt and the engine writes into a refusal, is the engine's, and what it
names is still named. (The refusal then enters the conversation as a tool
@@ -165,15 +165,15 @@ host was to answer. Where this plugin is seated it does not:
asked. An ask that names none of them and that the person answers at a
dialog (the mode's own, a check of the engine's own that no setting turns
on) is not held.
-- A person: a hook that answers `ask` with `decider: "person"` keeps the
- call from the classifier's allow. Made by a built-in or an organization's
- hook, that ask holds, so a person's plugin neither allows it nor turns it
- back into a plain ask. A person's own plugin may ask a person too, over a
- verdict that does not hold, and over a host's ask by changing only its
- `decider` to `"person"`: that is a tightening and passes. Any other change
- to a host's ask stays held. As for any hook's ask, a rule for the whole tool
- is not kept; a narrower rule the person saves is theirs and settles nothing
- while the hook asks.
+- A plugin: an ask a hook makes names the plugin (`plugin`, the engine's
+ word, never the hook's), and no classifier's allow settles it. The run past
+ the user tier holds no person's plugin, so a plugin named there is a
+ built-in or an organization's: that ask holds, and a person's plugin neither
+ allows it nor rewords it. A person's own plugin may ask too, over an allow
+ or the mode's own ask: there its ask stands, because it is stricter. Its
+ rewording of an ask that holds is held, with the notice. As for any hook's
+ ask, a rule for the whole tool is not kept; a narrower rule the person saves
+ is theirs and settles nothing while the hook asks.
- The setting the engine names today is the read block's
(`permissions.blockReadsOutsideWorkingDirectories`), for the two asks the
block keeps for the person: about a shell command that reads outside the
@@ -182,9 +182,9 @@ host was to answer. Where this plugin is seated it does not:
tools refuse such a read outright, and a deny holds as it is.
- A host: where the permission callback of the program that runs the session
answers its asks (an SDK host's `can_use_tool`, a permission prompt tool;
- a cloud session's host is one), the engine's own ask says so
- (`decider: "host"`), in every loop of the process, a subagent's included,
- and only where the host would be asked. Such an ask holds, the mode's own
+ a cloud session's host is one), the event says so (`e.approver` is
+ `host`), in every loop of the process, a subagent's included, and only
+ where the host would be asked. Such an ask holds, the mode's own
too: it goes on to whatever the mode puts between an ask and the host
(auto mode's classifier) and then to the callback, as it would with no
plugin loaded. An evaluation the engine has not classified is held.
@@ -236,8 +236,8 @@ host was to answer. Where this plugin is seated it does not:
settings from a <tool> call (<rule>); the deny rule holds over the plugins
you install (allowModsToOverrideDenyRules)`, or `tried to reword` where
the decision was kept and its words or its rule were not. The kinds are `a deny rule`,
- `an ask rule`, `a <event> hook's ask`, `a <key> setting's ask`, `a host's
- ask` and `a refusal` (a deny that names no rule); only the two rule kinds
+ `an ask rule`, `a <event> hook's ask`, `a <key> setting's ask`, `a
+ <plugin>'s ask`, `an ask cap`, `a host's ask` and `a refusal` (a deny that names no rule); only the two rule kinds
carry `in your settings` and a rule. Plugins the
engine ran as one
batch are named together, as it names them (`audit+easy`). A plain `-p`
diff --git a/mods/sec-default/hooks/held-verdict/ask-kind.ts b/mods/sec-default/hooks/held-verdict/ask-kind.ts
index 4602d275..530a418d 100644
--- a/mods/sec-default/hooks/held-verdict/ask-kind.ts
+++ b/mods/sec-default/hooks/held-verdict/ask-kind.ts
@@ -1,26 +1,32 @@
import type { EventResult } from 'claude-code'
+import { pluginOf } from './verdicts/plugin-of.js'
+
/**
* Names who asked, where no rule decided a verdict that holds: the classic
- * hook first, then the setting whose check asked, then the host it goes to.
+ * hook first, then the setting whose check asked, then the plugin that made
+ * it, then the ceiling an organization set on the tool.
*
- * An ask that names none of the three holds by the ceiling an organization
- * set on the tool.
+ * An ask that names none of them holds by the host that answers it.
*
* @param held the ask in question
- * @returns `<event> hook's ask`, `<key> setting's ask`, `host's ask`, or
- * `ask cap`
+ * @returns `<event> hook's ask`, `<key> setting's ask`, `<plugin>'s ask`,
+ * `ask cap`, or `host's ask`
*/
export function askKind(held: EventResult<'tool.check'>) {
+ const plugin = pluginOf(held)
const isHooked = held.hook !== undefined
const isSet = held.setting !== undefined
- const isHosted = held.decider !== undefined
+ const isMade = plugin !== undefined
+ const isCapped = held.ceiling !== undefined
return isHooked
? `${held.hook} hook's ask`
: isSet
? `${held.setting} setting's ask`
- : isHosted
- ? `${held.decider}'s ask`
- : 'ask cap'
+ : isMade
+ ? `${plugin}'s ask`
+ : isCapped
+ ? 'ask cap'
+ : "host's ask"
}
diff --git a/mods/sec-default/hooks/held-verdict/held-kind.ts b/mods/sec-default/hooks/held-verdict/held-kind.ts
index d21db20d..a4050469 100644
--- a/mods/sec-default/hooks/held-verdict/held-kind.ts
+++ b/mods/sec-default/hooks/held-verdict/held-kind.ts
@@ -4,11 +4,10 @@ import { askKind } from './ask-kind.js'
/**
* What kind of thing held over a person's plugin, as the notice calls it:
- * `deny rule`, `ask rule`, `refusal`, or whose ask it was, else `ask cap`.
+ * `deny rule`, `ask rule`, `refusal`, or whose ask it was.
*
* A deny that names no rule is a refusal even when it names a hook: the hook
- * may only have asked, and something else refused. An ask that names nobody
- * holds by the ceiling an organization set on the tool.
+ * may only have asked, and something else refused.
*
* @param held the verdict that holds
* @returns the kind
diff --git a/mods/sec-default/hooks/held-verdict/verdicts/holds-over.ts b/mods/sec-default/hooks/held-verdict/verdicts/holds-over.ts
index 35d5344b..39c10961 100644
--- a/mods/sec-default/hooks/held-verdict/verdicts/holds-over.ts
+++ b/mods/sec-default/hooks/held-verdict/verdicts/holds-over.ts
@@ -1,7 +1,7 @@
import type { EventResult } from 'claude-code'
-import { isPersonTightening } from './is-person-tightening.js'
import { isSameVerdict } from './is-same-verdict.js'
+import { pluginOf } from './plugin-of.js'
import Ranking from './ranking'
/**
@@ -9,25 +9,32 @@ import Ranking from './ranking'
* chain's answer: a deny, or an ask that names what stands behind it.
*
* It holds over a more permissive answer and over the same decision reworded
- * or stripped of what it names; a stricter answer stands, and so does a host's
- * ask that only changed who answers it to a person. A rule, a hook, a
- * setting, a host, a person or a ceiling counts; the mode's own ask at a
- * dialog never.
+ * or stripped of what it names; a stricter answer stands. A rule, a hook, a
+ * setting, a plugin or a ceiling counts, and a host answering the ask; the
+ * mode's own ask at a dialog never. The run past the user tier holds no
+ * person's plugin, so a plugin it names is a built-in or an organization's.
*
* @param held what the run past the user tier settled on
* @param answer what the whole chain settled on
+ * @param approver who answers this evaluation's asks (`e.approver`)
* @returns true when the held verdict is the one to return, as it is
*/
-export const holdsOver = (
+export function holdsOver(
held: EventResult<'tool.check'>,
answer: EventResult<'tool.check'>,
-) =>
- !Ranking.isLooser(held, answer) &&
- !isSameVerdict(held, answer) &&
- !isPersonTightening(held, answer) &&
- (held.decision === 'deny' ||
- held.rule !== undefined ||
- held.hook !== undefined ||
- held.setting !== undefined ||
- held.decider !== undefined ||
- held.ceiling !== undefined)
+ approver: string | undefined,
+): boolean {
+ const isAsked = held.decision === 'ask'
+
+ return (
+ !Ranking.isLooser(held, answer) &&
+ !isSameVerdict(held, answer) &&
+ (held.decision === 'deny' ||
+ held.rule !== undefined ||
+ held.hook !== undefined ||
+ held.setting !== undefined ||
+ pluginOf(held) !== undefined ||
+ held.ceiling !== undefined ||
+ (isAsked && approver === 'host'))
+ )
+}
diff --git a/mods/sec-default/hooks/held-verdict/verdicts/index.ts b/mods/sec-default/hooks/held-verdict/verdicts/index.ts
index 75775793..8e8928f9 100644
--- a/mods/sec-default/hooks/held-verdict/verdicts/index.ts
+++ b/mods/sec-default/hooks/held-verdict/verdicts/index.ts
@@ -1,7 +1,9 @@
export * from './holds-over.js'
export * from './is-same-verdict.js'
+export * from './plugin-of.js'
export * from './ranking'
export * from './rewritten-by-users.js'
+export type * from './stamped-verdict.js'
export * from './unchecked-deny.js'
export * as default from '.'
diff --git a/mods/sec-default/hooks/held-verdict/verdicts/is-person-tightening.ts b/mods/sec-default/hooks/held-verdict/verdicts/is-person-tightening.ts
deleted file mode 100644
index 8188be65..00000000
--- a/mods/sec-default/hooks/held-verdict/verdicts/is-person-tightening.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import type { EventResult } from 'claude-code'
-
-import { isSameVerdict } from './is-same-verdict.js'
-
-/**
- * Whether an answer is a host's ask with nothing changed but its `decider`,
- * now a person: the same ask, which no classifier's allow settles.
- *
- * @param held what the run past the user tier settled on
- * @param answer what the whole chain settled on
- * @returns true when the answer only tightened the ask
- */
-export function isPersonTightening(
- held: EventResult<'tool.check'>,
- answer: EventResult<'tool.check'>,
-): boolean {
- const decider: string | undefined = answer.decider
-
- return (
- held.decision === 'ask' &&
- held.decider === 'host' &&
- decider === 'person' &&
- isSameVerdict({ ...held, decider: undefined }, {
- ...answer,
- decider: undefined,
- })
- )
-}
diff --git a/mods/sec-default/hooks/held-verdict/verdicts/is-same-verdict.ts b/mods/sec-default/hooks/held-verdict/verdicts/is-same-verdict.ts
index 4bbb0b83..89943c6e 100644
--- a/mods/sec-default/hooks/held-verdict/verdicts/is-same-verdict.ts
+++ b/mods/sec-default/hooks/held-verdict/verdicts/is-same-verdict.ts
@@ -2,7 +2,7 @@ import type { EventResult } from 'claude-code'
/**
* Whether two `tool.check` verdicts say the same in every field: decision,
- * reason, and whatever either names (a rule, a hook, a setting, a host).
+ * reason, and whatever either names (a rule, a hook, a setting, a plugin).
*
* @param one a verdict
* @param other another, or undefined when nothing settled
diff --git a/mods/sec-default/hooks/held-verdict/verdicts/plugin-of.ts b/mods/sec-default/hooks/held-verdict/verdicts/plugin-of.ts
new file mode 100644
index 00000000..791a2d43
--- /dev/null
+++ b/mods/sec-default/hooks/held-verdict/verdicts/plugin-of.ts
@@ -0,0 +1,13 @@
+import type { StampedVerdict } from './stamped-verdict.js'
+
+/**
+ * The plugin the engine names on a `tool.check` ask, as the hook that made it.
+ *
+ * The released declarations this mod is checked against name neither this key
+ * nor `e.approver` until the next release, so it reads the shape it needs.
+ *
+ * @param verdict a verdict
+ * @returns the plugin, or undefined on an ask no hook made
+ */
+export const pluginOf = (verdict: StampedVerdict): string | undefined =>
+ verdict.plugin
diff --git a/mods/sec-default/hooks/held-verdict/verdicts/stamped-verdict.ts b/mods/sec-default/hooks/held-verdict/verdicts/stamped-verdict.ts
new file mode 100644
index 00000000..38b0a3b8
--- /dev/null
+++ b/mods/sec-default/hooks/held-verdict/verdicts/stamped-verdict.ts
@@ -0,0 +1,9 @@
+/**
+ * A `tool.check` verdict, read for the plugin that made its ask.
+ *
+ * `decision` keeps the type from being all-optional, which a verdict fails.
+ */
+export type StampedVerdict = {
+ decision: string
+ plugin?: string
+}
diff --git a/mods/sec-default/hooks/register.ts b/mods/sec-default/hooks/register.ts
index 542c3500..72e03245 100644
--- a/mods/sec-default/hooks/register.ts
+++ b/mods/sec-default/hooks/register.ts
@@ -116,7 +116,9 @@ export function register(on: On) {
const held = await next.to(e, 'append')
- if (!HeldVerdict.holdsOver(held, answer)) {
+ const { approver }: { tool: string; approver?: string } = e
+
+ if (!HeldVerdict.holdsOver(held, answer, approver)) {
return answer
}
diff --git a/mods/sec-default/tests/fixtures/tool-check/checked.ts b/mods/sec-default/tests/fixtures/tool-check/checked.ts
index 4e1cb97c..4636a350 100644
--- a/mods/sec-default/tests/fixtures/tool-check/checked.ts
+++ b/mods/sec-default/tests/fixtures/tool-check/checked.ts
@@ -7,3 +7,12 @@ export const CHECKED: Args<'tool.check'> = {
tool: 'Bash',
input: { command: 'echo x' },
}
+
+/**
+ * The same question where a host answers the asks: the engine's `approver`,
+ * which the released declarations do not name yet.
+ */
+export const CHECKED_BY_HOST: Args<'tool.check'> = Object.assign(
+ { approver: 'host' },
+ CHECKED,
+)
diff --git a/mods/sec-default/tests/fixtures/tool-check/host-ask.ts b/mods/sec-default/tests/fixtures/tool-check/host-ask.ts
index c47eb574..ffe49aaf 100644
--- a/mods/sec-default/tests/fixtures/tool-check/host-ask.ts
+++ b/mods/sec-default/tests/fixtures/tool-check/host-ask.ts
@@ -6,6 +6,5 @@ import type { EventResult } from 'claude-code'
*/
export const HOST_ASK: EventResult<'tool.check'> = {
decision: 'ask',
- reason: 'Bash needs approval',
- decider: 'host',
+ reason: 'The host answers this one',
}
diff --git a/mods/sec-default/tests/held-verdict.test.ts b/mods/sec-default/tests/held-verdict.test.ts
index 5b3c878f..7f8bd0b7 100644
--- a/mods/sec-default/tests/held-verdict.test.ts
+++ b/mods/sec-default/tests/held-verdict.test.ts
@@ -16,16 +16,16 @@ describe('held-verdict', () => {
Fixtures.PLAIN_DENY,
Fixtures.ASKED,
Fixtures.ALLOWED,
- ].map(held => Hooks.holdsOver(held, Fixtures.ALLOWED)),
+ ].map(held => Hooks.holdsOver(held, Fixtures.ALLOWED, undefined)),
).toEqual([true, true, true, true, true, false, false])
})
test("a setting's ask and a host's hold over an allow and a rewording", () => {
expect(
[Fixtures.SETTING_ASK, Fixtures.HOST_ASK].map(held => [
- Hooks.holdsOver(held, Fixtures.ALLOWED),
- Hooks.holdsOver(held, Fixtures.ASKED),
- Hooks.holdsOver(held, { ...held }),
+ Hooks.holdsOver(held, Fixtures.ALLOWED, 'host'),
+ Hooks.holdsOver(held, Fixtures.ASKED, 'host'),
+ Hooks.holdsOver(held, { ...held }, 'host'),
]),
).toEqual([
[true, true, false],
@@ -33,13 +33,16 @@ describe('held-verdict', () => {
])
})
- test('a setting or decider the answer itself names holds nothing', () => {
+ test('a setting the answer itself names holds nothing', () => {
expect(
- Hooks.holdsOver(Fixtures.ASKED, {
- ...Fixtures.ALLOWED,
- setting: 'permissions.blockReadsOutsideWorkingDirectories',
- decider: 'host',
- }),
+ Hooks.holdsOver(
+ Fixtures.ASKED,
+ {
+ ...Fixtures.ALLOWED,
+ setting: 'permissions.blockReadsOutsideWorkingDirectories',
+ },
+ undefined,
+ ),
).toBe(false)
})
@@ -73,9 +76,9 @@ describe('held-verdict', () => {
Fixtures.HOOK_DENY,
Fixtures.HOOK_ASK,
].map(held => [
- Hooks.holdsOver(held, Fixtures.ASKED),
- Hooks.holdsOver(held, Fixtures.PLAIN_DENY),
- Hooks.holdsOver(held, { ...held }),
+ Hooks.holdsOver(held, Fixtures.ASKED, undefined),
+ Hooks.holdsOver(held, Fixtures.PLAIN_DENY, undefined),
+ Hooks.holdsOver(held, { ...held }, undefined),
]),
).toEqual([
[true, true, false],
@@ -87,20 +90,28 @@ describe('held-verdict', () => {
test('an ask stripped of its rule, same sentence, is no same verdict', () => {
expect(
- Hooks.holdsOver(Fixtures.RULE_ASK, {
- decision: Fixtures.RULE_ASK.decision,
- reason: Fixtures.RULE_ASK.reason,
- }),
+ Hooks.holdsOver(
+ Fixtures.RULE_ASK,
+ {
+ decision: Fixtures.RULE_ASK.decision,
+ reason: Fixtures.RULE_ASK.reason,
+ },
+ undefined,
+ ),
).toBe(true)
})
test('a rule or hook the answer itself names makes nothing hold', () => {
expect(
- Hooks.holdsOver(Fixtures.ASKED, {
- ...Fixtures.ALLOWED,
- rule: 'Bash(echo *)',
- hook: 'PreToolUse',
- }),
+ Hooks.holdsOver(
+ Fixtures.ASKED,
+ {
+ ...Fixtures.ALLOWED,
+ rule: 'Bash(echo *)',
+ hook: 'PreToolUse',
+ },
+ undefined,
+ ),
).toBe(false)
})
diff --git a/mods/sec-default/tests/register.test.ts b/mods/sec-default/tests/register.test.ts
index 43643f0f..02c2f907 100644
--- a/mods/sec-default/tests/register.test.ts
+++ b/mods/sec-default/tests/register.test.ts
@@ -838,7 +838,9 @@ describe('register', () => {
Fixtures.checksAnswered(on, Fixtures.HOST_ASK)
- expect(await $.tool.check(Fixtures.CHECKED)).toEqual(Fixtures.HOST_ASK)
+ expect(await $.tool.check(Fixtures.CHECKED_BY_HOST)).toEqual(
+ Fixtures.HOST_ASK,
+ )
expect(lines).toEqual([
`transcript: ${Hooks.heldNotice('easy', 'Bash', Fixtures.HOST_ASK, 'lift')}`,
@@ -853,7 +855,7 @@ describe('register', () => {
on('settings.read', () => ({ value: Fixtures.MANAGED_POLICY }))
Fixtures.checksAnswered(on, Fixtures.HOST_ASK)
- expect(await $.tool.check(Fixtures.CHECKED)).toEqual({
+ expect(await $.tool.check(Fixtures.CHECKED_BY_HOST)).toEqual({
decision: 'allow',
})
},
@@ -1857,9 +1859,9 @@ describe('register', () => {
})
test("an organization's ask cap holds over a plugin's allow", () => {
- expect(Hooks.holdsOver(Fixtures.CEILING_ASK, Fixtures.CEILING_ALLOW)).toBe(
- true,
- )
+ expect(
+ Hooks.holdsOver(Fixtures.CEILING_ASK, Fixtures.CEILING_ALLOW, undefined),
+ ).toBe(true)
})
test('the launcher variable is pinned where policy names a launcher', () => {