Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exact Action Binding

Deterministically bind authorization or review to the exact JSON-compatible action that will execute.

exact-action-binding is a small host-side integrity tool from InterAI Labs. It creates a stable SHA-256 digest for a proposed action and lets you verify immediately before a side effect that the action has not changed.

import { createActionBinding, assertActionMatches } from "./index.mjs";

const action = {
  tool: "wallet.sign",
  args: { chainId: 8453, to: "0x...", amount: "10.00" },
};

const binding = createActionBinding(action);

// Immediately before the consequential side effect:
assertActionMatches(binding, action);

Why this exists

An authorization is meaningful only if it still refers to the action that is actually going to execute. Arguments, destinations, amounts, tool names or nested data can be changed after review or after a remote decision.

This library gives the host a simple mutation-detection boundary:

proposed action
      |
      v
create binding
      |
      v
review / policy / authorization
      |
      v
rebuild final action
      |
      v
assert exact match
      |
   match? ---- no ---> stop and obtain a new decision
      |
     yes
      v
   execute

Guarantees

  • object keys are sorted recursively before hashing;
  • array order is preserved;
  • -0 is normalized to 0;
  • unsupported or ambiguous JavaScript values fail closed instead of being guessed;
  • snapshots are detached and deeply frozen;
  • matching uses a namespaced SHA-256 digest.

Rejected values include undefined, functions, symbols, BigInt, non-finite numbers, class instances, Dates, Maps and other non-plain JSON objects.

Non-goals

This is not an authorization engine, policy engine, signature system, replay-prevention service or proof that an action is safe.

It is also deliberately distinct from InterAI Risk Oracle's hosted CanonicalExecutionIntent, execution_intent_digest, ExecutionAuthorization, policy identity, expiry and single-use protocol. Those are service-level authorization semantics; this repository is a generic host-side binding tool.

API

  • canonicalJson(value) — deterministic JSON serialization for supported values.
  • snapshotJson(value) — normalized detached deeply frozen snapshot.
  • actionDigest(action, options?) — SHA-256 digest using the selected namespace.
  • createActionBinding(action, options?) — immutable binding object.
  • assertActionMatches(binding, action) — throws if the current action differs.
  • ActionBindingError — typed error with a machine-readable code.

Default namespace: interai.public-action-binding/v1.

Run tests

Requires Node.js 20 or newer.

npm test

No runtime dependencies are required.

Relationship to InterAI

This repository is one of the open-source tools around InterAI Risk Oracle, an independent pre-execution decision layer for consequential agent actions.

Exact Action Binding is useful on its own and is also used by Agent Action Gate. It contains no Risk Oracle scoring, policy, trust-intelligence, billing, signing or private decision-engine implementation.

Hosted Risk Oracle API: https://api.interailabs.dev

License

Apache-2.0. See LICENSE and NOTICE.

About

Deterministically bind authorization to the exact JSON-compatible action an agent is about to execute.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages