@akasecurity/ai-tc-copilot 0.0.0-stage → 0.9.20
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/LICENSE +201 -0
- package/README.md +88 -2
- package/hooks.json +48 -0
- package/package.json +42 -3
- package/plugin.json +13 -0
- package/scripts/content-retention.js +23681 -0
- package/scripts/fail-open-count.js +13693 -0
- package/scripts/history-sync.js +31636 -0
- package/scripts/post-tool-use.js +35329 -0
- package/scripts/pre-tool-use.js +35332 -0
- package/scripts/scan-worker.js +13986 -0
- package/scripts/session-start.js +37029 -0
- package/scripts/sync.js +38974 -0
- package/scripts/triage-rubric.md +93 -0
- package/scripts/user-prompt-submit.js +35254 -0
- package/skills/setup/SKILL.md +284 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: aka-setup
|
|
3
|
+
description: Set up AKA Security for GitHub Copilot — what this host can enforce, and what it cannot.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AKA setup — GitHub Copilot
|
|
7
|
+
|
|
8
|
+
AKA works fully locally with **zero backend and zero Docker**: detection runs
|
|
9
|
+
in-process and findings persist to a local SQLite store at `~/.aka/data/aka.db`.
|
|
10
|
+
|
|
11
|
+
**The calibration wizard is not wired on this host yet.** The Claude Code, Codex
|
|
12
|
+
and Antigravity plugins each run a full calibration → triage → remediation flow
|
|
13
|
+
from this skill; this adapter ships the live enforcement half only. Until the
|
|
14
|
+
wizard lands, use the `aka` CLI directly (`aka init`, `aka detections`,
|
|
15
|
+
`aka scan`) and read the dashboard with `aka dashboard`. Do not describe a
|
|
16
|
+
calibration step to the user as though it exists here.
|
|
17
|
+
|
|
18
|
+
## Install — Copilot CLI
|
|
19
|
+
|
|
20
|
+
The plugin is installed from an unpacked copy of its npm package. There is no
|
|
21
|
+
marketplace entry for it yet. Run these from a folder of their own, and keep
|
|
22
|
+
that folder: updates are taken from it. The first line is safe to run again: it
|
|
23
|
+
reuses an existing `aka-copilot` folder rather than failing.
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
mkdir -p aka-copilot && cd aka-copilot
|
|
27
|
+
tar -xzf "$(npm pack @akasecurity/ai-tc-copilot --silent)"
|
|
28
|
+
copilot plugin install ./package
|
|
29
|
+
copilot plugin list
|
|
30
|
+
aka init
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
To update, from inside that same `aka-copilot` folder:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
rm -rf package
|
|
37
|
+
tar -xzf "$(npm pack @akasecurity/ai-tc-copilot --silent)"
|
|
38
|
+
copilot plugin update aka-copilot
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`copilot plugin update` re-copies the `package` folder into the installed
|
|
42
|
+
plugin. It does not fetch a newer version itself: the newer version is whatever
|
|
43
|
+
`npm pack` just unpacked there. Removing the old `package` folder first matters,
|
|
44
|
+
because unpacking over it would keep files the newer version deleted, and the
|
|
45
|
+
update would copy those too.
|
|
46
|
+
|
|
47
|
+
What Copilot CLI 1.0.98 was recorded doing with these commands:
|
|
48
|
+
|
|
49
|
+
- `copilot plugin list` shows `aka-copilot` once the install has landed.
|
|
50
|
+
- The installed copy is placed under `$COPILOT_HOME/installed-plugins/_direct/`.
|
|
51
|
+
`COPILOT_HOME` defaults to `~/.copilot`, per `copilot help environment`.
|
|
52
|
+
- `copilot plugin uninstall aka-copilot` removes it: `copilot plugin list` no
|
|
53
|
+
longer shows it, the `_direct` folder is gone, and installing again with
|
|
54
|
+
`copilot plugin install ./package` works.
|
|
55
|
+
|
|
56
|
+
Limits of this install:
|
|
57
|
+
|
|
58
|
+
- **The CLI warns that this install route is deprecated.** It says direct
|
|
59
|
+
installs from a path are being replaced by `plugin@marketplace` installs.
|
|
60
|
+
A marketplace install of this plugin has not been measured.
|
|
61
|
+
- **Hook notices were not seen on the screen.** In `-p` mode, the only mode
|
|
62
|
+
observed, AKA's messages appeared only in the CLI's debug log, with debug
|
|
63
|
+
logging enabled (`--log-level debug --log-dir <dir>`). An interactive
|
|
64
|
+
session has not been measured.
|
|
65
|
+
- **Windows is unconfirmed.** The plugin has not been installed and run against
|
|
66
|
+
a real Copilot CLI on Windows, so whether its hook commands survive that
|
|
67
|
+
platform's shell is untested.
|
|
68
|
+
- **Updating re-copies the folder the plugin was installed from.** The install
|
|
69
|
+
remembers that folder, and `copilot plugin update aka-copilot` replaces the
|
|
70
|
+
installed copy with whatever the folder holds, an older version included. It
|
|
71
|
+
does not fetch from npm; the update steps above put the newer version in the
|
|
72
|
+
folder first. If that folder has been deleted, update fails and changes
|
|
73
|
+
nothing; AKA keeps running from the installed copy. A `-p` session start was
|
|
74
|
+
observed not to update the plugin; an interactive session has not been
|
|
75
|
+
measured.
|
|
76
|
+
- **The cloud coding agent is not covered by this install.** It does not load
|
|
77
|
+
installed plugins; it reads only the repository's `.github/hooks/*.json`.
|
|
78
|
+
|
|
79
|
+
## Known limitations
|
|
80
|
+
|
|
81
|
+
This section is the authority on what AKA can actually do on this host. It is
|
|
82
|
+
**rendered from `src/capabilities.ts`** and held to it by
|
|
83
|
+
`test/capability-matrix.test.ts`, so a row here and the code that implements it
|
|
84
|
+
cannot drift apart. Be honest about every one of these if the user asks why
|
|
85
|
+
something was not caught — never imply coverage this plugin does not have.
|
|
86
|
+
|
|
87
|
+
**One package covers three surfaces, and they are not equivalent.** The Copilot
|
|
88
|
+
CLI, VS Code agent mode and the cloud coding agent each have their own event
|
|
89
|
+
names, payload spelling and failure convention. Which one a session is on
|
|
90
|
+
decides what AKA can do in it.
|
|
91
|
+
|
|
92
|
+
**The VS Code half is built to the published contract and partly confirmed
|
|
93
|
+
against a live install.** One agent-mode session on VS Code 1.141.0 with Copilot
|
|
94
|
+
Chat 0.69.0 loaded this plugin and ran all four of its hooks; the payloads are in
|
|
95
|
+
`test/fixtures/vscode/plugin-load-1.141/`. That session confirmed the session
|
|
96
|
+
start, the prompt capture and the tool-result capture, and those three rows
|
|
97
|
+
below are marked verified. It also recorded a tool-call capture with a warn
|
|
98
|
+
finding and a file-write capture. A deny, an input rewrite, a large-input
|
|
99
|
+
refusal and a flagged tool result were never driven, so the block and rewrite
|
|
100
|
+
rows stay unverified. Treat an unverified row as what the vendor documents, not
|
|
101
|
+
as what was seen to happen.
|
|
102
|
+
The doc-derived fixtures the half was first written from still sit in
|
|
103
|
+
`test/fixtures/vscode-provisional/`.
|
|
104
|
+
|
|
105
|
+
**Only the pre-tool-use event ENFORCES.** Four events are wired — the session
|
|
106
|
+
start, the prompt, the tool call and the tool result — but only the tool call
|
|
107
|
+
can be stopped or rewritten. Your prompts and the tool output the model reads
|
|
108
|
+
**are** captured, scanned and recorded, so a secret in either shows up as a
|
|
109
|
+
finding on the dashboard; **neither can be withheld or masked.** A `block` or
|
|
110
|
+
`redact` policy on one of those is recorded as a finding and the text goes to
|
|
111
|
+
the model unchanged. Under VS Code AKA returns the notice as a hook message,
|
|
112
|
+
and it appears only in VS Code's "GitHub Copilot Chat Hooks" output channel: in
|
|
113
|
+
the recorded session the chat showed nothing from AKA. On the CLI it writes the
|
|
114
|
+
notice to stderr. In `-p` mode, the only mode observed, the CLI did not show a
|
|
115
|
+
successful hook's stderr: it appeared only in Copilot's debug log, and only
|
|
116
|
+
because debug logging was enabled (`--log-level debug`). Whether an interactive
|
|
117
|
+
session shows it has not been measured. It never pretends it enforced.
|
|
118
|
+
|
|
119
|
+
The reason is that neither host has a channel for it that has been seen to
|
|
120
|
+
work: the CLI's `modifiedPrompt` and `modifiedResult` are documented and were
|
|
121
|
+
never observed, and VS Code blocks through exit 2, which no path in this plugin
|
|
122
|
+
takes. A tool result is also too late by construction — the tool has already
|
|
123
|
+
run, and what is at stake is only whether its output reaches the model.
|
|
124
|
+
|
|
125
|
+
**A prompt or tool result too large to scan in time is reported, not
|
|
126
|
+
refused.** A field of 32,768 characters or more is scanned in a separate thread
|
|
127
|
+
under a deadline. If that scan does not finish, AKA says the text was too large
|
|
128
|
+
to scan in time and that it went to the model unchanged. If AKA's scan thread
|
|
129
|
+
could not run at all, it says that instead: nothing was checked, the text went
|
|
130
|
+
to the model unchanged, and the plugin should be reinstalled if it happens
|
|
131
|
+
again — a missing scan thread is an install fault, and every text this large
|
|
132
|
+
goes unscanned until it is repaired. Either way it is never treated as clean,
|
|
133
|
+
and never stopped: neither event has a channel to stop it with. A structured tool result is read only to a fixed
|
|
134
|
+
depth, number of text values and total size; anything past those limits is
|
|
135
|
+
reported as unscanned in the same way.
|
|
136
|
+
|
|
137
|
+
**There is still no history backfill.** Nothing reads the sessions that
|
|
138
|
+
happened before AKA was installed, or any session's own transcript on disk.
|
|
139
|
+
`aka scan` and the dashboard cover the working tree after the fact.
|
|
140
|
+
|
|
141
|
+
**Command text is never masked in place.** Rewriting a shell command changes
|
|
142
|
+
what runs, so a `redact` policy on command text follows this workspace's
|
|
143
|
+
`redactFallback` instead. It ships as `warn`, which means the command runs and
|
|
144
|
+
the only trace is a message.
|
|
145
|
+
|
|
146
|
+
**Under VS Code, a warn is not shown in the chat.** AKA returns a warn, and the
|
|
147
|
+
notice that a redact fell back to warn, as a hook message. In the recorded
|
|
148
|
+
session VS Code accepted it and showed it only in the "GitHub Copilot Chat
|
|
149
|
+
Hooks" output channel, so the user never saw it, and a warn there is hard to
|
|
150
|
+
tell from `monitor`. A redact on `run_in_terminal`'s `explanation` or `goal`
|
|
151
|
+
takes the same fallback as one on its command, because rewriting them would
|
|
152
|
+
need an allow that approves the command too. Set `redactFallback` to `block` if
|
|
153
|
+
a redact on a terminal call has to be visible; a VS Code deny itself was never
|
|
154
|
+
driven, so that row stays unverified.
|
|
155
|
+
|
|
156
|
+
**Under VS Code, a rewrite can be silently discarded.** That host validates
|
|
157
|
+
`updatedInput` against the tool's own input schema and applies **last hook
|
|
158
|
+
wins**, so a user's or a repository's own `PreToolUse` hook returning one
|
|
159
|
+
replaces AKA's.
|
|
160
|
+
|
|
161
|
+
**Under VS Code, matchers are ignored.** The hook is spawned for every tool call
|
|
162
|
+
the agent makes, including ones AKA has no field table for. Those exit
|
|
163
|
+
immediately, write nothing and open no store.
|
|
164
|
+
|
|
165
|
+
**On the CLI a crashing hook denies the call.** `preToolUse` is the one
|
|
166
|
+
fail-closed event there: a hook that exits non-zero other than 2 denies the tool
|
|
167
|
+
call, exit 2 denies, and a timed-out one allows. Empty stdout is none of those —
|
|
168
|
+
the hooks reference documents it as "default behavior", meaning the call goes to
|
|
169
|
+
your own permission flow. So AKA writes **nothing** when it has no verdict, and
|
|
170
|
+
what it guarantees is that no path exits non-zero.
|
|
171
|
+
|
|
172
|
+
**AKA never pre-approves a call on the CLI.** `permissionDecision: "allow"` is a
|
|
173
|
+
verdict that the tool executes, so printing one per clean call would suppress
|
|
174
|
+
the approval prompts your own Copilot settings would have raised. AKA emits a
|
|
175
|
+
verdict only to deny, rewrites arguments only through `modifiedArgs`, and
|
|
176
|
+
otherwise stays out of the way. A warning it has is written to stderr, because
|
|
177
|
+
the CLI documents no message field on this event.
|
|
178
|
+
|
|
179
|
+
**In `-p` mode a warn reached only the CLI's debug log, not the screen.** The
|
|
180
|
+
hooks reference describes stderr surfacing for a FAILING hook ("logged as a
|
|
181
|
+
hook failure") and says nothing about one that exits 0. Observed on Copilot
|
|
182
|
+
CLI 1.0.98 in `-p` mode: a successful hook's stderr appears nowhere in the
|
|
183
|
+
CLI's own output, and only in the debug log (`--log-level debug --log-dir
|
|
184
|
+
<dir>`), as `[rust:hooks] [hook stderr] …` lines. So under `redactFallback:
|
|
185
|
+
warn` — the shipped default — the call goes through and the notice is in that
|
|
186
|
+
log rather than in front of you, which makes a warn hard to tell from
|
|
187
|
+
`monitor` on this host. An interactive session has not been measured. Set
|
|
188
|
+
`redactFallback` to `block` if a redact on command text has to be visible.
|
|
189
|
+
|
|
190
|
+
**The cloud coding agent is captured only where the repository asks for it.**
|
|
191
|
+
It reads `.github/hooks/*.json` on the **default branch** and nowhere else, and
|
|
192
|
+
it has no local store of its own.
|
|
193
|
+
|
|
194
|
+
**Where the session's activity goes may not be shown to you.** On a machine
|
|
195
|
+
attached to the organization's control plane, the Claude Code and Codex plugins
|
|
196
|
+
print one line at session start: forwarding everything, forwarding for the
|
|
197
|
+
enrolled repository the session is in, or local-only. This adapter's
|
|
198
|
+
session-start hook has no message field on either surface, so it writes that
|
|
199
|
+
line to **stderr**, together with its other once-per-session notices: that a
|
|
200
|
+
newer AKA binary is on the machine than this plugin, that a warn-era store's
|
|
201
|
+
block and redact categories were kept at warn, and that the store path is
|
|
202
|
+
redirected. Its stdout stays empty. In `-p` mode the CLI did not show a
|
|
203
|
+
successful hook's stderr (see above), so these lines were seen only in the
|
|
204
|
+
debug log, with debug logging enabled; an interactive session is unmeasured.
|
|
205
|
+
`aka status` shows whether this machine is attached, whether it sends
|
|
206
|
+
everything or only enrolled repositories, and which repositories are enrolled.
|
|
207
|
+
|
|
208
|
+
### Capability matrix
|
|
209
|
+
|
|
210
|
+
| Surface | Event | Subject | Channel | Verified | Why |
|
|
211
|
+
| ------- | ------------------- | --------------------------------- | ------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
212
|
+
| cli | preToolUse | bash.command | block | yes | A deny on stdout with exit 0 blocks the call; masking command text would change what runs, so a redact policy follows redactFallback instead of rewriting. |
|
|
213
|
+
| cli | preToolUse | bash.description | rewrite | yes | Model-authored prose that rides along with the call, rewritten in place through modifiedArgs. Scanned for secrets and PII only: the command-risk rules judge bash.command, never this prose. |
|
|
214
|
+
| cli | preToolUse | apply_patch.input | rewrite | no | No payload for this tool was recorded, so the argument name is unverified; a wrong name costs a silent skip rather than a wrong answer. |
|
|
215
|
+
| cli | sessionStart | session | none | yes | Opens the session root every later capture hangs off, and records the host, harness and project inventory. It decides nothing and emits nothing — there is no verdict to reach on a session start. |
|
|
216
|
+
| cli | userPromptSubmitted | prompt | none | yes | Captured and scanned; nothing can be stopped or rewritten. modifiedPrompt is documented and was not observed from a command hook, so a block or redact policy is recorded and the prompt is sent unchanged. |
|
|
217
|
+
| cli | postToolUse | toolResult | none | yes | Captured and scanned; nothing can be withheld. The tool has already run, and modifiedResult is documented but was not observed replacing what the model sees, so a finding is recorded and the output reaches the model unchanged. |
|
|
218
|
+
| cli | permissionRequest | toolInput | none | yes | Deliberately not a scan point: it fires for the same call as preToolUse and carries a strict subset of its arguments, so scanning here would double-count and still miss description. |
|
|
219
|
+
| vscode | PreToolUse | run_in_terminal.command | block | no | The capture and the warn were recorded in test/fixtures/vscode/plugin-load-1.141/: the call was stored with its finding, and the warn systemMessage reached only the hooks output channel, never the chat. A deny through hookSpecificOutput was never driven, so the block itself is unverified. |
|
|
220
|
+
| vscode | PreToolUse | run_in_terminal.explanation, goal | block | no | Model-authored prose that rides along with the call; both fields were recorded in test/fixtures/vscode/plugin-load-1.141/. They do not execute, but this host takes updatedInput only alongside permissionDecision allow, which would cover the command too, so they are never rewritten: a redact follows redactFallback (warn by default), exactly as on command, and a block policy denies the call. A deny through hookSpecificOutput was never driven. Scanned for secrets and PII only: the command-risk rules judge run_in_terminal.command, never this prose. |
|
|
221
|
+
| vscode | PreToolUse | file-write content | rewrite | no | create_file content was recorded as captured, in test/fixtures/vscode/plugin-load-1.141/. No updatedInput was ever driven; it is validated against the tool input schema and LAST HOOK WINS, so a user or repo hook returning one discards this. |
|
|
222
|
+
| vscode | SessionStart | session | none | yes | Opens the session root as the vscode interface, recorded in test/fixtures/vscode/plugin-load-1.141/. A payload carrying no cwd declines without opening the store; the recorded host sent cwd on every event. |
|
|
223
|
+
| vscode | UserPromptSubmit | prompt | none | yes | Captured and scanned, recorded in test/fixtures/vscode/plugin-load-1.141/; nothing can be stopped or rewritten. This host blocks through exit 2, which no path in this adapter takes, so a block or redact policy is recorded and the prompt is sent unchanged. |
|
|
224
|
+
| vscode | PostToolUse | tool_response | none | yes | Captured and scanned, recorded in test/fixtures/vscode/plugin-load-1.141/ as a string response; nothing can be withheld. This host has no output-rewrite field at all, and its whole-result block has never been driven, so a finding is recorded and the output reaches the model unchanged. |
|
|
225
|
+
| cloud | preToolUse | bash.command | block | no | Speaks the CLI protocol, so the adapter behaves identically — but it runs only where the repository commits a hook on its default branch, and ask is coerced to deny there. |
|
|
226
|
+
|
|
227
|
+
## Install — VS Code agent mode (beta)
|
|
228
|
+
|
|
229
|
+
**VS Code agent mode support is beta.** Capture was observed in one agent-mode
|
|
230
|
+
session on VS Code 1.141.0 with the built-in GitHub Copilot Chat 0.69.0. That is
|
|
231
|
+
the only version it has been seen on. Enforcement is unverified. The capability
|
|
232
|
+
matrix above is the authority on which VS Code rows are verified: rely only on a
|
|
233
|
+
row marked `yes` as working, and describe every row marked `no` as what the
|
|
234
|
+
vendor documents, not as what was seen to happen.
|
|
235
|
+
|
|
236
|
+
**Load the package from a local directory.** There is no marketplace install for
|
|
237
|
+
VS Code. If the Copilot CLI install above has already been done, reuse its
|
|
238
|
+
`aka-copilot` folder and skip these two lines, so VS Code loads the same folder
|
|
239
|
+
the update steps refresh. Otherwise pack and unpack the npm package, then point
|
|
240
|
+
VS Code at the unpacked folder in your user settings:
|
|
241
|
+
|
|
242
|
+
```sh
|
|
243
|
+
mkdir -p aka-copilot && cd aka-copilot
|
|
244
|
+
tar -xzf "$(npm pack @akasecurity/ai-tc-copilot --silent)"
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
```json
|
|
248
|
+
{
|
|
249
|
+
"chat.plugins.enabled": true,
|
|
250
|
+
"chat.useHooks": true,
|
|
251
|
+
"chat.pluginLocations": { "<absolute path to the unpacked package folder>": true }
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
`npm pack` unpacks into a folder named `package`; use its absolute path. VS Code
|
|
256
|
+
reads the plugin's own `hooks.json` — no VS Code-specific hooks file is needed —
|
|
257
|
+
runs its four hooks and expands `${PLUGIN_ROOT}` in their commands.
|
|
258
|
+
|
|
259
|
+
**What was observed working: capture only.** In that session AKA recorded the
|
|
260
|
+
session start, the prompt, a `run_in_terminal` command, a `create_file` write
|
|
261
|
+
and the tool result. A secret-bearing command raised a finding on the dashboard.
|
|
262
|
+
Nothing else in the session was driven.
|
|
263
|
+
|
|
264
|
+
**Not verified.** None of these has been seen to work on VS Code, so do not
|
|
265
|
+
promise them:
|
|
266
|
+
|
|
267
|
+
- blocking a tool call (a deny);
|
|
268
|
+
- rewriting a file write (`updatedInput`);
|
|
269
|
+
- the large-input refusal;
|
|
270
|
+
- scanning an object-shaped tool result.
|
|
271
|
+
|
|
272
|
+
**AKA's notices are not shown in the chat.** A hook's `systemMessage`, such as a
|
|
273
|
+
warn or the first-run notice, appeared only in VS Code's "GitHub Copilot Chat
|
|
274
|
+
Hooks" output channel, and the chat showed nothing from AKA. To read them, open
|
|
275
|
+
the Output panel and choose the "GitHub Copilot Chat Hooks" channel. Do not tell
|
|
276
|
+
a user a warning will appear in the chat.
|
|
277
|
+
|
|
278
|
+
**Caveats that apply here.** Matchers are ignored, so the hook runs for every
|
|
279
|
+
tool call, and a rewrite is last-hook-wins, so another hook's `updatedInput` can
|
|
280
|
+
discard AKA's. Both are described under Known limitations above.
|
|
281
|
+
|
|
282
|
+
**The cloud coding agent is not covered by this install.** It reads hooks from
|
|
283
|
+
`.github/hooks/*.json` on a repository's default branch and is a separate
|
|
284
|
+
surface; see Known limitations.
|