Files
floci/compatibility-tests/sdk-test-node/README.md
T
5befe8b619 feat: optional TLS/HTTPS support with self-signed certificate generation (#754)
* feat: optional TLS/HTTPS support with self-signed certificate generation

- Add TlsConfigSource (MicroProfile ConfigSource SPI) that injects Quarkus
  TLS properties before the HTTP server starts
- Auto-generate self-signed certificates with correct SANs including custom
  hostnames from FLOCI_HOSTNAME and FLOCI_BASE_URL
- Persist certificate metadata for change detection across restarts
- Fix CertificateGenerator to encode IP addresses as iPAddress SANs (RFC 5280)
- Serve HTTP + HTTPS simultaneously (LocalStack parity)
- Support user-provided certificates via FLOCI_TLS_CERT_PATH/KEY_PATH
- Add TLS configuration documentation
- Add Node.js SDK compatibility test for HTTPS connectivity
- Add comprehensive unit and integration tests (79 test cases)

Closes #711

* feat(tls): add TLS proxy server and WebSocket-over-TLS tests

- Add TlsProxyServer: TCP proxy on port 4566 that detects TLS ClientHello
  and routes to HTTPS (4511) or HTTP (4510) backend accordingly
- Add apigatewayv2-websocket-tls.test.ts: WSS compatibility tests covering
  connect/disconnect, route selection, broadcast, authorization,
  @connections API, binary frames, and payload size limits
- Update CI workflow to enable FLOCI_TLS_ENABLED=true for compat tests
- Update sdk-test-node Dockerfile with NODE_TLS_REJECT_UNAUTHORIZED=0
- Update tls.test.ts for HTTPS SDK client tests
- Update README with WebSocket-over-TLS test documentation

* fix(tls): address review comments — LocalStack parity and floci.io SANs

- Add USE_SSL and CUSTOM_SSL_CERT_PATH mappings to localstack-parity.sh
- Add localhost.floci.io and *.localhost.floci.io to default certificate SANs
- Update affected tests and documentation

---------

Co-authored-by: Dixit R Jain <dixitrjain@Mac-379.lan>
Co-authored-by: Dixit R Jain <dixitrjain@Mac.lan>
2026-05-10 10:21:03 -05:00

89 lines
4.3 KiB
Markdown

# sdk-test-node
Compatibility tests for [Floci](https://github.com/hectorvent/floci) using the **AWS SDK for JavaScript v3 (3.1003.0)**.
## Services Covered
| Group | Description |
| ----------------------- | -------------------------------------------------------------------------------------------------- |
| `ssm` | Parameter Store — put, get, label, history, path, tags |
| `sqs` | Queues, send/receive/delete, DLQ, visibility |
| `sns` | Topics, subscriptions, publish, SQS delivery |
| `s3` | Buckets, objects, tagging, copy, batch delete |
| `s3-cors` | CORS configuration |
| `s3-notifications` | S3 → SQS and S3 → SNS event notifications |
| `dynamodb` | Tables, CRUD, batch, TTL, tags |
| `lambda` | Create/invoke/update/delete functions |
| `iam` | Users, roles, policies, access keys |
| `sts` | GetCallerIdentity, AssumeRole, GetSessionToken |
| `secretsmanager` | Create/get/put/list/delete secrets, versioning, tags |
| `kms` | Keys, aliases, encrypt/decrypt, data keys, sign/verify |
| `kinesis` | Streams, shards, PutRecord/GetRecords |
| `cloudwatch` | PutMetricData, ListMetrics, GetMetricStatistics, alarms |
| `cloudformation-naming` | Auto physical name generation, explicit name precedence, cross-reference |
| `cognito` | User pools, clients, AdminCreateUser, InitiateAuth, GetUser |
| `cognito-oauth` | Resource server CRUD, confidential clients, `/oauth2/token`, OIDC discovery, JWKS/JWT verification |
| `apigatewayv2` | HTTP & WebSocket API lifecycle, routes, integrations, authorizers, stages, deployments, route responses, models, tagging |
## Requirements
- Node.js 20+
- npm
## Running
```bash
npm install
# All groups
npm test
# Via just (from compatibility-tests/)
just test-typescript
```
## Configuration
| Variable | Default | Description |
| ---------------- | ----------------------- | ----------------------- |
| `FLOCI_ENDPOINT` | `http://localhost:4566` | Floci emulator endpoint |
AWS credentials are always `test` / `test` / `us-east-1`.
## Docker
```bash
docker build -t floci-sdk-node .
docker run --rm --network host floci-sdk-node
# Custom endpoint (macOS/Windows)
docker run --rm -e FLOCI_ENDPOINT=http://host.docker.internal:4566 floci-sdk-node
```
## TLS Tests
The `tls.test.ts` file tests HTTPS connectivity with AWS SDK v3 clients.
The `apigatewayv2-websocket-tls.test.ts` file tests WebSocket over TLS (WSS),
covering connect/disconnect, route selection, broadcast, authorization,
`@connections` API, binary frames, and payload limits.
These tests always run as part of the suite — they derive the HTTPS/WSS endpoint
from the HTTP endpoint by swapping the scheme (`http://floci:4566` → `https://floci:4566`,
`ws://` → `wss://`).
Since Floci serves HTTP and HTTPS simultaneously when TLS is enabled, existing HTTP
tests are unaffected.
The Dockerfile sets `NODE_TLS_REJECT_UNAUTHORIZED=0` so self-signed certs are accepted.
The CI workflow starts Floci with `FLOCI_TLS_ENABLED=true`.
To run locally:
```bash
# 1. Start Floci with TLS enabled
FLOCI_TLS_ENABLED=true ./mvnw quarkus:dev
# 2. Run all tests (including TLS)
NODE_TLS_REJECT_UNAUTHORIZED=0 npm test
```