The ddbsh browser edition: a static page that talks to DynamoDB directly

TL;DR

Go to https://www.ddbsh.org

The browser edition is a static web page: the ddbsh WASM engine, a small UI, and a vendored, pinned AWS SDK for JavaScript v3 (@aws-sdk/client-dynamodb
3.1174.0, bundled with esbuild down to the client and the 26 command classes the codec emits). Each request goes from the tab straight to DynamoDB. There is no server-side component, so any static host can serve it. Your credentials stay local to your browser.

The SDK as a signed HTTP pipe

The engine already builds every request body and parses every response, so the
bridge (web/sdk-bridge.mjs) uses the SDK only for credentials, endpoint
resolution, SigV4, retries, and fetch. On each call, one middleware runs after
the SDK’s serializer and swaps in the engine’s body:

args.request.body = body;
args.request.headers["x-amz-target"] = `DynamoDB_20120810.${op}`;

A second runs before the SDK’s deserializer and hands the raw response text
back to the engine. A service error arrives as its verbatim __type document
and is mapped as on every other path, so output needs no normalization.

Credentials

The page accepts only short-term credentials (an ASIA… key id, a secret,
a session token), pasted from aws sts get-session-token,
aws sts assume-role, or aws configure export-credentials. It refuses
long-term AKIA… keys and any paste outside a secure context (https:// or a
loopback http:// origin). Credentials live only in the bridge’s closure and the SDK client’s config: never on window or Module, never in storage or the URL,
never logged. A reload forgets them. SHOW CONNECTION shows only the masked
key and expiry:

Backend: wire/aws-sdk-js 3.1174.0 -> https://dynamodb.us-east-1.amazonaws.com (default); credentials ASIA…WXYZ expires 2026-11-20T23:03:00.000Z

An exact-host CSP

A page that holds a session token should only be able to reach DynamoDB. CSP
wildcards apply only to the leftmost label, so dynamodb.*.amazonaws.com is not a valid source. devtools/vendor-aws-sdk-js generates the connect-src list from the pinned SDK’s partition table instead: 304 exact hosts across the 38 regions
of the aws and aws-us-gov partitions. script-src is 'self' 'wasm-unsafe-eval'; the second keyword is what allows WebAssembly compilation.

The list holds dynamodb[-fips].<region> and search-dynamodb[-fips].<region>,
each under amazonaws.com and api.aws. The SDK sends SearchVectors (behind
SELECT … NEAREST) to the search-dynamodb hosts; the browser golden run
caught that on its first pass.

CONNECT, fail-closed

CONNECT <region> re-targets the session as in the native binary.
CONNECT <region> WITH ENDPOINT "<url>" accepts only four forms:
https://dynamodb[-fips].<region>.{amazonaws.com,api.aws}, with no path, query,
user info, or non-default port, and with the region in the host matching the
region CONNECT names. The search-dynamodb hosts are not accepted as overrides. A rejected target blocks the session:

us-east-1> connect us-east-1 with endpoint "https://evil.example.com";
CONNECT
browser: CONNECT rejected: endpoint https://evil.example.com is not permitted in the browser edition (not an AWS DynamoDB endpoint); allowed forms: ...

Every later statement then fails until a valid CONNECT, so the session never falls back to the previous target by mistake.

Serving it

emcmake cmake --preset wasm-release && cmake --build build-preset/wasm-release
devtools/serve-web 8080 # python3 -m http.server --bind 127.0.0.1 8080

From another machine, tunnel (ssh -L 8080:localhost:8080 <host>) rather than
bind a network interface. To host it publicly: HTTPS, the CSP as a response header plus frame-ancestors 'none', and .wasm served as application/wasm.

The page holds no secrets of its own, so it needs no sign-in gate.

Same engine, same 710 golden tests, running in a browser tab.

See it in action at https://www.ddbsh.org which is a simple cloudfront hosted site against a static S3 bucket, which gets pushed whenever a new version of dynamodb shell gets tagged in Git.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.