Releases: AetherCore-Dev/ag402
v0.1.20 — Fix double-decompression & data truncation behind CDN
What's Changed
Critical Bug Fixes
-
Double-decompression crash — when upstream responses include
Content-Encoding: gzip(e.g. behind Cloudflare/CDN), the middleware re-wrapped the already-decoded body with the original encoding headers, causingzlib error: incorrect header check. Payment succeeded but the response body was unreadable. -
Silent data truncation —
Content-Lengthheader reflected the compressed wire size, not the decoded body size. Consumers readingContent-Lengthbytes would silently lose 50-90% of response data. No error raised — data simply disappeared. -
2 missed response paths — the post-payment retry success/failure paths (the highest-frequency production code paths) still used raw headers, affected by the same bug.
Additional Fixes
- Forward proxy: added
content-encodingto header strip list (defense-in-depth) requestsmonkey-patch: seturlandencodingon constructed Response (preventsraise_for_status()crash and charset detection issues)
Added
_decoded_headers()helper — stripscontent-encoding,transfer-encoding,content-lengthfrom all 9 MiddlewareResult construction paths- 3 regression tests covering gzip, transfer-encoding, and content-length mismatch scenarios
Impact
All users behind CDN/reverse proxy (Cloudflare, AWS ALB, nginx with gzip) were affected. After payment, responses would either crash with zlib error or silently return truncated data.
775+ tests passing across 4 packages.
Full Changelog: https://github.com/AetherCore-Dev/ag402/blob/main/CHANGELOG.md
v0.1.19 — Production Hardening
Changes
Security & CI Hardening
- CI least-privilege: Added
permissions: contents: readto CI workflow - Coverage enforcement: Added
--cov-fail-under=80for protocol and core tests - X402_MODE warning:
load_config()now warns when X402_MODE is unset (prevents accidental test mode in production) - Examples debug off: All TypeScript examples now default to
debug: false
Dependency Safety
- Added version upper bounds to all Python dependencies (
<1.0.0,<44.0.0for cryptography) - Prevents future breaking changes from silently breaking installs
Version Alignment
- All packages unified to v0.1.19 (core, protocol, adapters, npm)
- Fixed npm
@ag402/fetchand@ag402/solanapublish (previously stuck at 0.1.0)
v0.1.18 — Security audit fixes + test fix
What's Changed
Fixed
- 3-round multi-expert security audit — 30 fixes across 16 files (from v0.1.17 → v0.1.18)
- CI test fix —
test_gateway_refuses_production_without_verifiernow provides explicitaddressparam to match gateway's address-before-verifier validation order - Improved onboarding docs, error messages, and production TS example
- MCP server verification via glama.json
Security
- Header injection sanitization for chain/token/address fields
- Atomic wallet file writes with proper permissions
- Gateway rate limiting per IP
- Password strength validation (min 12 chars)
- SSRF protection for target_url
- Explicit X402_MODE requirement to prevent accidental test deployment
Full Changelog: v0.1.17...v0.1.18
@ag402/solana v0.1.0
@ag402/solana v0.1.0
Real Solana USDC on-chain payment provider for @ag402/fetch.
Added
SolanaPaymentProvider— implementsPaymentProviderfor real Solana USDC on-chain paymentsfromEnv()— construct provider fromSOLANA_PRIVATE_KEY; acceptsrpcUrl,usdcMint,confirmationLeveloptionsconfirmationLeveloption —"confirmed"(default) or"finalized"for high-value paymentsMAINNET_USDC_MINT— exported constant for the mainnet USDC mint address- SPL Token
transfer_checkedinstruction withAg402-v1|{requestId}Memo for server-side idempotency - ESM + CJS dual build
Security
- On-chain transaction failure detection:
confirmTransaction().value.errchecked — throws on failure to prevent wallet deduction without USDC transfer - Mainnet + devnet USDC mint mismatch guard: constructor throws when
rpcUrlcontains"mainnet"butusdcMintdefaults to devnet address - Zero-lamport guard: amounts smaller than 0.000001 USDC round to 0 lamports and throw before any RPC call
- Self-payment guard: throws when recipient address equals payer address
- ATA creation order: recipient ATA created first to minimise wasted SOL on failure
getAddress()strips CR/LF/quotes to prevent HTTP header injection
Install
```bash
npm install @ag402/solana @ag402/fetch
```
@ag402/fetch v0.1.0 — TypeScript buyer SDK
@ag402/fetch v0.1.0
First release of the TypeScript buyer-side SDK for the x402 auto-payment protocol.
Install
npm install @ag402/fetchWhat's in this release
createX402Fetch()— wraps nativefetch()to auto-handle HTTP 402 Payment RequiredInMemoryWalletwith micro-unit arithmetic (IEEE 754 float-safe)Wallet/PaymentProviderinterfaces for custom implementationsMockPaymentProviderwith production-env warningX402Config: per-call limit, total spend cap, chain/token allowlist, debugpaymentTimeoutMs: provider.pay() timeout with wallet rollback- Protocol utilities: parseWwwAuthenticate, buildAuthorization, parseAmount, etc.
- 100 tests; dual ESM+CJS; zero runtime deps; Node.js 18+
Security
- Header injection prevention (CR/LF/quote rejection in all build fns)
- 8 KB header size limit in parseWwwAuthenticate
- All construction options validated fail-fast
- buildAuthorization fallback on unsafe provider.getAddress() return value
- InMemoryWallet rejects NaN/Infinity initial balance
Notes
- No real Solana payment in this release —
@ag402/solanacoming soon - Not safe for concurrent Promise.all calls on the same instance
v0.1.17 — Prepaid recovery, TOCTOU fix, security hardening
What's Changed
Added
ag402 prepaid recover— self-service credential recovery after gateway timeout; auto-reads~/.ag402/pending_purchase.jsonso no arguments needed in the common caseag402 prepaid pending— shows current in-flight purchase waiting for recovery- Idempotent
/prepaid/purchase— sametx_hashalways returns the identical credential (same expiry, same signature); safe to retry after any failure - Prepaid issuance ledger —
prepaid_issuedSQLite table persists across gateway restarts; auto-purged after 366 days on startup
Fixed
- TOCTOU race condition —
INSERT OR IGNORE+rowcountcheck ensures only one credential issued pertx_hasheven under concurrent requests - Pending file security —
0600permissions, HMAC-SHA256 integrity tag, 30-day expiry, explicit failure warning - Windows compatibility —
socket.gethostname()replacesos.uname()in_pending_hmac;os.getlogin()fallback for containers - README prepaid syntax — corrected
buycommand, addedrecoverdocumentation
Full Changelog: https://github.com/AetherCore-Dev/ag402/blob/main/CHANGELOG.md
v0.1.16 — prepaid hardening, docs, security fixes
What's Changed
Security Fixes
- Credential dir permissions:
~/.ag402/set to0o700on Unix — prevents world-readable credential files - Corrupt credentials backup: corrupt file backed up to
.json.bakbefore starting fresh — no silent data loss - Weak signing key warning: gateway warns when
--prepaid-signing-key< 32 chars, includes keygen hint to_header_value()guard: malformed stored credential now rolls back deduction + falls through to on-chain instead of crashing- CLI JSON guard:
prepaid buyhandles non-JSON / non-dict gateway responses gracefully
Docs & Examples
- README: prepaid buyer/seller quick start (CLI commands, seller gateway setup)
- llms.txt: prepaid commands,
AG402_PREPAID_SIGNING_KEY, package ID reference table examples/prepaid_demo.py: complete working end-to-end demo
Bug Fixes
- Fixed 4 incorrect API calls in
prepaid_demo.py(non-existentPrepaidCredentialStore,middleware.send(),result.get()) - Fixed import sort lint error in
test_memory_safety.py
Full Changelog: https://github.com/AetherCore-Dev/ag402/blob/main/CHANGELOG.md
v0.1.14 — CI Pipeline Fixes & Lint Remediation
What's Changed
Fixed
- CI Workflows: Fix monorepo
pip installto install sub-packages with[dev]extras - CI Workflows: Upgrade
semgrep-actionto container-based;codeql-actionv3→v4; pinscorecard-actionv2.4.1 - CI Workflows: Add required
security-events: writeandid-token: writepermissions - Lint F821: Add module-level
API_KEYvariable inbridge.py - Lint SIM105: Use
contextlib.suppressinsolana_adapter.py - Lint SIM102: Merge nested
ifinprepaid_server.py - Lint B007: Prefix unused loop variable in
challenge_validator.py - Semgrep: Replace
urllib.requestwithsocketcheck insetup_wizard.py - Lint W293: Fix 35 whitespace errors across openclaw adapter files
- Ruff config: Add
N999exemption forag402-skill
Full Changelog: v0.1.13...v0.1.14
v0.1.13 — Security Hardening + Docs Overhaul
What's Changed
Security (TDD - 5 fixes)
- S1-1: Private key removed from os.environ, getter-only access
- S1-2: Mode-aware host binding (test->127.0.0.1, prod->0.0.0.0)
- S1-3: Strict mock verify (only .pay()-recorded tx_hashes)
- S2-1: /health minimal in production (no target_url/metrics)
- S2-2: Temp directory permissions 0o700 (cli + runners)
Bug Fixes (3 fixes)
- B1: loop=asyncio for uvicorn (macOS/Windows compat)
- B2: ATA error detection with friendly messages
- B3: Improved ConfigError with actionable guidance
Documentation
- README: Feature Matrix (50+ entries), integration guides, CLI ref
- CHANGELOG, SECURITY, CONTRIBUTING updated
Testing
- 17 new TDD security tests
- 588 passed, 0 failed, all 10 version files synced
Full Changelog: https://github.com/AetherCore-Dev/ag402/blob/main/CHANGELOG.md
v0.1.11 — Seller-No-Key documentation hardening
Security
- Seller-No-Key documentation hardening: Comprehensive audit ensuring sellers are never misled into providing a private key
.env.example:SOLANA_PRIVATE_KEYmarked BUYER ONLY with role-specific commentsSECURITY.md: Added Seller-No-Key Architecture to Security Designsetup_wizard.py: Security reminder box + private-key-paste detection for sellerscli.py:ag402 serveprints seller security reminder on startupllms.txt: Enhanced Sell Skill and Red Flags for LLM agentsREADME.md: Added For Sellers security guidanceindex.html: Seller security notice on landing page
Full Changelog: https://github.com/AetherCore-Dev/ag402/blob/main/CHANGELOG.md