PolicyGuard

An on-chain counterparty & policy check for AI agents that pay — built for NEAR HACKATHON (Security track). Before an agent sends funds, it asks: allow, warn, or block? — and why. NEAR testnet no wallet needed for this demo

This page needs to be served over HTTP(S) for its modules to load (opening it as a file:// URL blocks them). Serve this folder, e.g. python3 -m http.server in the repository root, then open http://localhost:8000/demo/ — or use the hosted demo linked in the README.

1 · Try a payment

The check runs the same rules the smart contract enforces (see shared/policy.mjs). On warn, the browser asks you — the human — to approve or deny. On block, nothing is signed.

2 · Agent policy

Spent today (this demo session): 0 NEAR · applies on the next check.

3 · Shared blocklist

Reports carry evidence. On chain, anyone can report; the owner can remove entries (appeals).

AccountReasonEvidence

4 · Allowlist

Allowlisted counterparties skip the first-interaction warning.

Account

5 · Prompt-injection attack simulation

Runs the canned attack from agent/src/attack-demo.mjs in this page: an injected instruction tries to pay a blocklisted drainer, a legit payment goes through, and a warn case asks the human. Nothing here signs anything real.

6 · Decision log (this session)

TimeVerdictPaymentReasons

7 · Live contract on NEAR testnet

Read-only view calls over public RPC — no wallet, no signing. Enter the deployed contract account to see its real policy state and decision log.

Deployed on NEAR testnet: policyguard-okdes.testnet (explorer). Press “Query testnet” to read its real state. Sections 1–6 run the identical rules locally.