Skip to content

fix: AWS endpoint scheme/region + default-region selector - #59

Merged
fuleinist merged 3 commits into
TabularisDB:mainfrom
fuleinist:fix/aws-endpoint-scheme-region
Aug 6, 2026
Merged

fix: AWS endpoint scheme/region + default-region selector#59
fuleinist merged 3 commits into
TabularisDB:mainfrom
fuleinist:fix/aws-endpoint-scheme-region

Conversation

@fuleinist

@fuleinist fuleinist commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Connecting to a real AWS DynamoDB endpoint via the generic GUI connection form (host / port / username / password) was broken in normalized_params — only DynamoDB Local worked. This PR fixes the transport/signing bugs, adds a plugin-level default-region setting, and teaches the plugin to consume the host's opaque connection extra fields.

Connection-edit-page region selector — per the review discussion in tabularis#593, the direction is an opaque extra: HashMap<String, String> on ConnectionParams, persisted and forwarded to drivers untouched, instead of driver-specific fields in the core app. This plugin already consumes extra["region"] (see below); once the core ships the extra field and the connection-modal extra_fields slot, a region selector can live entirely in this plugin. tabularis#593 is closed accordingly.

1. Wrong scheme — http://host:443

host + port always became http://host:port. With host=dynamodb.us-west-2.amazonaws.com, port=443 the plugin dialed plain HTTP to a TLS-only port → transport-level dispatch failure.

Fix: HTTPS when port == 443 or host ends with .amazonaws.com.

2. Wrong signing region — hardcoded us-east-1

The generic form has no region field, so the signing region defaulted to us-east-1 regardless of the endpoint. SigV4 signed for the wrong region → AWS rejects every request with InvalidSignatureException.

Fix: parse the region from the endpoint hostname (dynamodb.us-west-2.amazonaws.comus-west-2), among the resolution chain below.

3. Default-region setting (plugin settings page)

Declares a plugin-level "Default AWS region" select in .tabularium (all 34 current regions per the AWS Regions doc). Host renders it under Settings → Plugins → DynamoDB and delivers via initialize RPC.

4. Opaque extra connection fields

ConnectionParams now parses the opaque extra: HashMap<String, String> map the host persists and forwards to drivers unchanged (non-string values are dropped). extra["region"] acts as the per-connection signing region — this is where the connection-form region selector will land once the core slot work ships, so no core change is needed for the plugin to honour it.

Region resolution order:

  1. explicit region param
  2. extra["region"] (opaque per-connection field)
  3. region parsed from an AWS endpoint hostname
  4. plugin-level default-region setting
  5. us-east-1

Profile connections stay exempt — they inherit their region from the AWS profile's own config.

Test plan

  • cargo test — 192 passed
  • cargo clippy / cargo fmt — clean
  • Live verification against a real AWS account using GUI form fields only

Made with Cursor

Made with Cursor

Chris Chen and others added 2 commits August 3, 2026 16:50
Connecting to a real AWS DynamoDB endpoint via the generic GUI form
(host/port/username/password) failed two ways in normalized_params:

1. Scheme: host+port always became http://host:port, so port 443 produced
   http://dynamodb.us-west-2.amazonaws.com:443 — plain HTTP to a TLS-only
   port, failing at the transport level. HTTPS is now used when the port
   is 443 or the host ends with .amazonaws.com.

2. Region: with no region field in the form, the signing region defaulted
   to us-east-1 regardless of the endpoint, so AWS rejected every request
   with InvalidSignatureException. The region is now parsed from the
   endpoint hostname (dynamodb.<region>.amazonaws.com), falling back to
   us-east-1 only for non-AWS endpoints (e.g. DynamoDB Local).

Verified live against a real AWS account: test_connection succeeds and
get_tables returns 400 tables in ~6.5s using only the generic form fields.

Co-authored-by: Cursor <cursoragent@cursor.com>
The generic GUI connection form has no region field, and a per-connection
region selector is not possible from a driver plugin today: the
connection-modal.connection_content slot only receives {driver, database,
onDatabaseChange, connectionName} and only renders for
no_connection_required drivers.

Instead declare a plugin-level "Default AWS region" select setting in
.tabularium (all 34 current AWS regions per the AWS Regions docs). The
host renders it under Settings -> Plugins -> DynamoDB and delivers the
saved value via the initialize RPC, which the plugin now stores.

Region resolution order in normalized_params:
  1. explicit `region` param
  2. region parsed from an AWS endpoint hostname
  3. plugin-level default-region setting
  4. us-east-1

The settings cell is process-global; tests share a lock to avoid races.

Co-authored-by: Cursor <cursoragent@cursor.com>
@fuleinist fuleinist changed the title fix: use https and endpoint-derived region for AWS endpoints fix: AWS endpoint scheme/region + default-region selector Aug 3, 2026
The host (TabularisDB/tabularis#593) is moving to an opaque
extra: HashMap<String, String> on ConnectionParams instead of
driver-specific core fields. Parse it here and use extra["region"]
as the per-connection signing region when no explicit region param
is present.

Region precedence: explicit region param > extra["region"] > region
parsed from an AWS endpoint hostname > plugin-level default-region
setting > us-east-1. Profile connections remain exempt (they inherit
their region from ~/.aws/config).
@fuleinist

Copy link
Copy Markdown
Collaborator Author

Pushed 8ca5654 addressing the core-app review feedback from tabularis#593: the plugin now consumes the opaque extra: HashMap<String, String> connection fields (ConnectionParams.extra), using extra["region"] as the per-connection signing region. Region precedence: explicit region param → extra["region"] → hostname-parsed region → plugin default-region setting → us-east-1. 192 tests pass; tabularis#593 closed in favour of this approach.

debba pushed a commit to TabularisDB/tabularis that referenced this pull request Aug 4, 2026
…Params (#596)

* feat(connections): opaque plugin-specific extra fields for ConnectionParams

Adds a generic mechanism for plugins to carry custom connection
settings (e.g. an AWS region for DynamoDB) without core schema changes.

- ConnectionParams gains `extra: HashMap<String, String>` (Rust) and
  `extra?: Record<string, string>` (TS). Opaque to the host: persisted
  verbatim, forwarded to driver plugins, absent from JSON when empty.
- New plugin slot `connection-modal.extra_fields` rendered below the
  host/port section; context exposes `driver`, `extra`, and
  `setExtraField(key, value)` so plugin UI can edit the map.
- Pure `updateExtraField` helper in src/utils/connections.ts with
  unit tests (8 cases: set, merge, immutability, clear-on-empty,
  blank-key handling).
- Host API version 0.1.0 -> 0.2.0 (HOST_API_VERSION, plugin-api
  API_VERSION + package.json) since the slot map is observable to
  plugin bundles.
- PLUGIN_GUIDE slot table documents the new slot.

Follow-up to TabularisDB/tabularis-dynamodb-plugin#59.

* version

Co-authored-by: Chris Chen <1163738+fuleinist@users.noreply.github.com>

---------

Co-authored-by: fuleinist <fuleinist@users.noreply.github.com>
@fuleinist
fuleinist merged commit 3d9fcde into TabularisDB:main Aug 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant