@glassbox-ai/engine 0.1.0 → 0.1.2

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.
Files changed (48) hide show
  1. package/README.md +2 -0
  2. package/dist/action/acc.d.ts +1 -1
  3. package/dist/action/agent-clis.d.ts +44 -0
  4. package/dist/action/agent-clis.js +175 -0
  5. package/dist/action/builtin-tools.d.ts +5 -0
  6. package/dist/action/builtin-tools.js +74 -0
  7. package/dist/action/inline.js +2 -2
  8. package/dist/action/paths.js +1 -1
  9. package/dist/action/powershell.js +10 -4
  10. package/dist/action/schedule.d.ts +7 -0
  11. package/dist/action/schedule.js +10 -0
  12. package/dist/action/shell/analyze.js +75 -15
  13. package/dist/action/shell/parse.js +1 -1
  14. package/dist/action/shell/view.js +1 -1
  15. package/dist/action/sql.js +1 -1
  16. package/dist/action/tools.js +70 -3
  17. package/dist/action/upload.d.ts +6 -2
  18. package/dist/action/upload.js +32 -7
  19. package/dist/analysis/fields.js +3 -3
  20. package/dist/analysis/findings.js +1 -1
  21. package/dist/analysis/gate.js +8 -6
  22. package/dist/analysis/manifest.js +2 -2
  23. package/dist/analysis/match.js +2 -2
  24. package/dist/analysis/scan.js +1 -1
  25. package/dist/canon/decode.js +1 -1
  26. package/dist/canon/views.js +1 -1
  27. package/dist/evidence/evidence.js +1 -1
  28. package/dist/fingerprint/diff.js +1 -1
  29. package/dist/index.d.ts +5 -1
  30. package/dist/index.js +6 -2
  31. package/dist/intake/json.js +1 -1
  32. package/dist/intake/snapshot.js +1 -1
  33. package/dist/policy/decide.d.ts +14 -1
  34. package/dist/policy/decide.js +68 -15
  35. package/dist/ruleset/load.d.ts +2 -3
  36. package/dist/ruleset/load.js +20 -6
  37. package/dist/ruleset/schema.d.ts +1 -1
  38. package/dist/ruleset/schema.js +1 -1
  39. package/dist/ruleset-entry.js +1 -1
  40. package/dist/secrets/detect.js +2 -2
  41. package/dist/secrets/redact.js +1 -1
  42. package/dist/types.d.ts +21 -0
  43. package/dist/types.js +1 -1
  44. package/dist/util/jcs.js +1 -1
  45. package/dist/util/re.js +1 -1
  46. package/dist/version.d.ts +1 -1
  47. package/dist/version.js +1 -1
  48. package/package.json +7 -6
@@ -1,4 +1,4 @@
1
- // @glassbox-ai/engine/ruleset: loading signed ruleset caches (engine-spec §10.2).
1
+ // @glassbox-ai/engine/ruleset: loading signed ruleset caches.
2
2
  // Kept out of the main entry so an ordinary hook call doesn't pay for Ed25519 and schema
3
3
  // validation at start-up (150 ms hook budget). Import this only when a cache file exists.
4
4
  export { loadRuleset, EMBEDDED_TRUSTED_KEYS, REVOKED_KEY_IDS } from "./ruleset/load.js";
@@ -1,4 +1,4 @@
1
- // Secret detectors (engine-spec §8.1). Patterns run on the linear regex engine (re2js).
1
+ // Secret detectors. Patterns run on the linear regex engine (re2js).
2
2
  import { findAll } from "../util/re.js";
3
3
  const PLACEHOLDER = /^(\*+|x+|password|passwd|secret|changeme|<[^>]*>|\$\{[^}]*\}|\$[A-Z_]+|%[A-Z_]+%|\{\{[^}]*\}\})$/i;
4
4
  function entropy(s) {
@@ -202,7 +202,7 @@ function resolveOverlaps(hits) {
202
202
  }
203
203
  return kept.sort((a, b) => a.start - b.start);
204
204
  }
205
- // ── Masking (§8.2) ───────────────────────────────────────────────────────
205
+ // ── Masking ───────────────────────────────────────────────────────
206
206
  const PUBLIC_PREFIXES = [
207
207
  "github_pat_", "ghp_", "gho_", "ghu_", "ghs_", "ghr_", "glpat-", "gldt-", "glrt-", "xoxb-", "xoxa-", "xoxp-", "xoxr-", "xoxs-", "xapp-",
208
208
  "sk_live_", "sk_test_", "rk_live_", "rk_test_", "whsec_", "sk-proj-", "sk-svcacct-", "sk-admin-", "AKIA", "ASIA", "ABIA", "ACCA", "AIza", "eyJ",
@@ -1,4 +1,4 @@
1
- // redact() (engine-spec §8.2): deep copy with every detected secret masked.
1
+ // redact(): deep copy with every detected secret masked.
2
2
  // Unscanned content is replaced, never passed through raw.
3
3
  import { findDecodable } from "../canon/decode.js";
4
4
  import { resolveLimits } from "../limits.js";
package/dist/types.d.ts CHANGED
@@ -213,6 +213,13 @@ export interface ServerRequestInput {
213
213
  serverId: string;
214
214
  message: unknown;
215
215
  }
216
+ /** What a built-in agent tool can do (see BUILTIN_TOOLS). */
217
+ export type BuiltinToolCategory = "read" | "write" | "command" | "network" | "agent" | "other";
218
+ /**
219
+ * "Allow & remember", set by the user outside the agent. Applies only in the project whose
220
+ * `projectIdHash` equals `SessionContext.projectIdHash`. Lifts a mode-driven ask only: never an
221
+ * irreversible-or-public ask, a finding ≥ high, or any locked row.
222
+ */
216
223
  export interface RememberedRule {
217
224
  projectIdHash: string;
218
225
  serverId: string;
@@ -220,6 +227,17 @@ export interface RememberedRule {
220
227
  actionTag: ActionTag;
221
228
  createdAt: string;
222
229
  }
230
+ /**
231
+ * A permission the user granted for one session (`glassbox allow --session …`), outside the agent.
232
+ * Applies only when `sessionId` equals `SessionContext.sessionId`; same limits as RememberedRule.
233
+ */
234
+ export interface SessionGrant {
235
+ sessionId: string;
236
+ serverId: string;
237
+ toolName: string;
238
+ actionTag: ActionTag;
239
+ createdAt: string;
240
+ }
223
241
  export type PolicyChoice = "allow" | "ask" | "deny";
224
242
  export interface UserPolicy {
225
243
  mode: ApprovalMode;
@@ -237,7 +255,10 @@ export interface SessionContext {
237
255
  platform: "linux" | "darwin" | "win32";
238
256
  claudeConfigDir?: string;
239
257
  glassboxSecretPaths?: readonly string[];
258
+ /** The current project's id (caller-computed, e.g. HMAC of the project root). Remembered rules need it. */
259
+ projectIdHash?: string;
240
260
  remembered?: readonly RememberedRule[];
261
+ sessionGrants?: readonly SessionGrant[];
241
262
  homeDir: string;
242
263
  cwd: string;
243
264
  caseInsensitiveFs: boolean;
package/dist/types.js CHANGED
@@ -1,4 +1,4 @@
1
- // Public types (engine-spec §4). Kept free of logic.
1
+ // Public types. Kept free of logic.
2
2
  export const ACTION_TAGS = [
3
3
  "fs.read", "fs.read.sensitive", "fs.write", "fs.delete", "fs.destroy", "fs.move", "net.egress",
4
4
  "net.fetch.package-manager", "net.fetch.vcs", "vcs.commit", "vcs.push", "vcs.force-push",
package/dist/util/jcs.js CHANGED
@@ -1,4 +1,4 @@
1
- // RFC 8785 JSON Canonicalization Scheme, hand-written (engine-spec §12.8).
1
+ // RFC 8785 JSON Canonicalization Scheme, hand-written.
2
2
  // Works on snapshot values (null-prototype objects, arrays, strings, finite numbers,
3
3
  // booleans, null). Iterative, so input depth can't overflow the stack.
4
4
  export class JcsError extends Error {
package/dist/util/re.js CHANGED
@@ -1,4 +1,4 @@
1
- // Linear-time regex (engine-spec §10.3): every pattern applied to untrusted text goes
1
+ // Linear-time regex: every pattern applied to untrusted text goes
2
2
  // through re2js. Compiled patterns are cached per pattern string (bounded cache).
3
3
  import { RE2JS } from "re2js";
4
4
  import { initTimed } from "./initclock.js";
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const ENGINE_VERSION = "0.1.0";
1
+ export declare const ENGINE_VERSION = "0.1.2";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const ENGINE_VERSION = "0.1.0";
1
+ export const ENGINE_VERSION = "0.1.2";
2
2
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glassbox-ai/engine",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Glassbox security engine: pure, deterministic analysis of MCP metadata and agent tool calls.",
5
5
  "keywords": [
6
6
  "mcp",
@@ -42,6 +42,11 @@
42
42
  "engines": {
43
43
  "node": ">=24.11.0"
44
44
  },
45
+ "scripts": {
46
+ "build": "tsc -b",
47
+ "test": "vitest run",
48
+ "prepublishOnly": "tsc -b"
49
+ },
45
50
  "dependencies": {
46
51
  "@noble/curves": "2.4.0",
47
52
  "@noble/hashes": "2.4.0",
@@ -50,9 +55,5 @@
50
55
  },
51
56
  "publishConfig": {
52
57
  "access": "public"
53
- },
54
- "scripts": {
55
- "build": "tsc -b",
56
- "test": "vitest run"
57
58
  }
58
- }
59
+ }