Commit Graph
21 Commits
Author SHA1 Message Date
shrimptails-f 5e6bcca401 fix(cognito): align sign-up confirmation with AWS behavior (#1488)
* fix(cognito): align sign-up confirmation with AWS behavior

* fix(cognito): centralize constructor initialization

* fix(cognito): use issued sign-up confirmation code in node compatibility test

* fix(cognito): align signup confirmation tests with issued codes
2026-06-24 22:35:57 -05:00
nblomquist 30a598f080 feat(kms): add GenerateRandom action (#1036)
- Add GenerateRandom action routing and handler in KmsJsonHandler
- Add SecureRandom field, constructor overload, and generateRandom() method with bounds validation
- Reject unsupported Recipient and CustomKeyStoreId fields
- Add integration tests for happy path, boundaries, validation, and unsupported fields
- Add SDK compatibility tests for Java, Python, and Node
2026-06-03 17:42:40 -05:00
Dixit R Jain 7e43b015e6 feat(lambda): Lambda layer support (PublishLayerVersion, GetLayerVersion, ListLayerVersions, DeleteLayerVersion) (#1015)
* feat: support PublishLayerVersion, GetLayerVersion, ListLayerVersions, DeleteLayerVersion and layer attachment

Implements full Lambda Layer lifecycle:
- PublishLayerVersion: POST /2018-10-31/layers/{name}/versions
- GetLayerVersion: GET /2018-10-31/layers/{name}/versions/{ver}
- ListLayerVersions: GET /2018-10-31/layers/{name}/versions
- DeleteLayerVersion: DELETE /2018-10-31/layers/{name}/versions/{ver}
- ListLayers: GET /2018-10-31/layers (now returns real data)

Layer content is extracted to disk and copied into Lambda containers
at /opt during launch, matching real AWS behavior where layers are
available at /opt/nodejs/node_modules/ etc.

CreateFunction and UpdateFunctionConfiguration already stored layer
ARNs; this commit makes the layer data actually resolvable and
mountable at runtime.

Closes #875

* feat: add Node SDK compatibility tests for Lambda Layers

Adds lambda-layers.test.ts covering:
- PublishLayerVersion (version 1 and 2)
- GetLayerVersion (success and 404)
- ListLayerVersions
- ListLayers
- DeleteLayerVersion (success, idempotent for non-existent)
- Layer attachment on CreateFunction
- Layer round-trip via GetFunctionConfiguration
- Layer update/removal via UpdateFunctionConfiguration
2026-05-24 15:05:56 -05:00
3a31c792fa fix(apigateway): populate full APIGatewayRequestAuthorizerEvent for REQUEST authorizers (#1002)
* fix: populate full APIGatewayRequestAuthorizerEvent for REQUEST authorizers

Closes #807.

Previously, REQUEST-type Lambda authorizers received only 'type' and
'methodArn'. This commit populates the complete event shape matching
real AWS behavior:

- headers, multiValueHeaders
- queryStringParameters, multiValueQueryStringParameters
- pathParameters (empty object when none, not null)
- stageVariables (from Stage config, null when unconfigured)
- requestContext with accountId, apiId, resourceId, resourcePath,
  path, httpMethod, stage, requestId, requestTimeEpoch
- requestContext.identity with sourceIp, userAgent, apiKey, clientCert

Also enriches the AWS_PROXY integration event (buildProxyEvent) with:
- Full identity object (all null fields matching AWS wire format)
- domainName, domainPrefix, protocol, requestTime, extendedRequestId
- stageVariables from Stage configuration
- API key resolution from usage plan keys

Refactors shared logic into reusable helpers:
- putSingleValueHeaders, putMultiValueHeaders
- putQueryStringParameters, putMultiValueQueryStringParameters

Resolves API key once per request (not duplicated across authorizer
and proxy event builders).

* fix: remove AWS SDK deps from main pom, rewrite test with RestAssured

Addresses review feedback: AWS SDK dependencies should not be in the
main Floci project. Rewrites ApiGatewayRequestAuthorizerIntegrationTest
to use only RestAssured for management-plane and execute-api calls,
matching the established pattern of all other @QuarkusTest tests.

---------

Co-authored-by: Dixit R Jain <dixitrjain@Dixits-MacBook-Pro.local>
Co-authored-by: Dixit R Jain <dixitrjain@Mac.lan>
2026-05-23 22:38:09 -05:00
Nitesh K JainandHector Ventura b71cf0f827 feat(neptune): Neptune control plane, Gremlin Docker backend, and SDK compatibility tests (#958)
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Co-authored-by: Hector Ventura <hectorvent@gmail.com>
2026-05-20 18:02:00 -05:00
Ricardo Medina c426289879 fix(cognito): correct USER_SRP_AUTH PASSWORD_VERIFIER signature (#912)
* fix(cognito): correct USER_SRP_AUTH PASSWORD_VERIFIER signature

Server-side SRP-6a produced HMAC signatures that never matched what
AWS Amplify / SDKs compute, so USER_SRP_AUTH always failed with
NotAuthorizedException. Five independent bugs in the byte layout and
key-derivation chain:

1. SRP multiplier k: hashed N and g left-padded to N_BYTES (384 bytes).
   Cognito/Amplify hash the minimal two's-complement representation
   (385 bytes for N — sign byte prepended because MSB is set — and
   1 byte for g = 2). k participates in both server B = k*v + g^b and
   client S = (B - k*g^x)^(a+ux), so a divergent k breaks the protocol.
   Use N.toByteArray() and G.toByteArray() directly.

2. Session key derivation: previously ran an undocumented "Caldera
   interleaved hash" over S, then fed that into HKDF with a zero salt.
   Cognito applies HKDF-Expand directly over S with the scrambling
   parameter U as salt:
     PRK  = HMAC-SHA256(U_bytes, S_bytes)
     T(1) = HMAC-SHA256(PRK, "Caldera Derived Key" || 0x01)
     key  = T(1)[0..16]
   Inline that HKDF in computeSessionKey; drop interleaved hash + the
   auxiliary hkdf() helper.

3. HKDF output length: helper returned 32 bytes; Amplify uses the first
   16. Return Arrays.copyOf(t1, 16).

4. computeSignature double-HKDF: when sessionKey was already the final
   HMAC key, computeSignature ran HKDF on it again. Use it as-is.

5. computeU / computeX byte layout: U was hashed with A and B
   left-padded to N_BYTES; salt was decoded as raw hex bytes. Amplify
   feeds the minimal two's-complement representation (with sign byte
   for positive MSB-set values). Use BigInteger.toByteArray() for A/B
   and round-trip the hex salt through BigInteger so a sign byte is
   prepended when needed.

Verified by reproducing floci's exact server-side computation in
JavaScript using Amplify's byte conventions: the JS replay reproduces
floci's expected HMAC byte-for-byte (proving the server is internally
consistent) and the divergence from the client's claimed HMAC traces
entirely to k differing. After the fix, USER_SRP_AUTH end-to-end signin
from Amplify v6 (React Native) against floci succeeds.

Compat note: users whose verifier was stored under the previous
computeX with a salt whose first byte has the MSB set (~50% of
generate-salt outputs) will produce a different x and must reset their
password. New signups against this fix are interoperable with Amplify.

Also drops the now-unused padTo() helper.

* test(compatibility): add USER_SRP_AUTH round-trip tests for Node + Java SDKs

The existing CognitoSrpTest only validated that PASSWORD_VERIFIER was
returned by InitiateAuth; nothing exercised the full handshake. With the
server-side SRP math now spec-compliant, add end-to-end tests that prove
real AWS SDK clients authenticate against floci.

Java (sdk-test-java/CognitoSrpTest):
 - Add step 4: compute PASSWORD_CLAIM_SIGNATURE from the challenge using
   the AWS "Caldera" SRP variant, send RespondToAuthChallenge, assert
   AuthenticationResult contains valid JWT id/access/refresh tokens.
 - Helper math (computeX / computeU / computeK / calderaHkdf /
   hmacSha256 / formatCognitoTimestamp) inlined since the AWS Java SDK
   v2 does not expose a public SRP client.

Node (sdk-test-node/tests/cognito-srp.test.ts):
 - New round-trip test using amazon-cognito-identity-js 6.3.16 — the
   canonical JS SRP impl that @aws-amplify/auth wraps internally.
 - Pool is provisioned via AdminCreateUser + AdminSetUserPassword so the
   test doesn't depend on an email-delivered verification code.
 - Validates tokens come back as well-formed JWTs.

Both tests pass against floci with the fix from the previous commit and
fail (CodeMismatchException / NotAuthorizedException) without it.
2026-05-18 23:02:49 -05:00
Hector Ventura 5ab178e10d fix(dynamodb): improve conformance across validation, expressions, and queries (#826)
* fix(dynamodb): improve conformance across validation, expressions, and queries

- Rename InvalidParameterValue → ValidationException for table-name errors
- Enforce min-length 3 on table names for all operations, not just CreateTable
- ListTables: alphabetical order, Limit validation (1–100), pagination
- Enum validation (ReturnValues, ReturnConsumedCapacity) fires before table lookup
- ProjectionExpression support on GetItem, Query, Scan, BatchGetItem
- Select=COUNT returns Count/ScannedCount and omits Items
- Parallel scan: Segment/TotalSegments validation and hash-based sharding
- Reserved words rejected in FilterExpression, ConditionExpression, UpdateExpression
- Legacy API: AttributesToGet, AttributeUpdates, QueryFilter, ScanFilter, KeyConditions
- TransactWriteItems idempotency token with payload-hash conflict detection
- ReturnValuesOnConditionCheckFailure on PutItem, UpdateItem, DeleteItem
- Item size limit (400 KB) and number normalization on write
- Tags API: TagResource, UntagResource, ListTagsOfResource with ARN validation
- New Java and Node SDK conformance tests covering all changes above

* fix(dynamodb): fix unit testing
2026-05-13 02:14:00 -05:00
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
Dixit R Jain 3ae5c7b467 feat(apigatewayv2): Add WebSocket data-plane support (#712)
* feat: implement API Gateway v2 WebSocket data-plane support Implement full WebSocket data-plane for API Gateway v2, including: - Real WebSocket connection handling via Vert.x (ws://localhost:4566/ws/{apiId}/{stage}) - $connect/$disconnect/$default route lifecycle with Lambda integration - Custom route selection via routeSelectionExpression ($request.body.{field}) - @connections management API (POST/GET/DELETE) for server-to-client messaging - Lambda REQUEST authorizer support on $connect with identity source validation - Stage variable substitution in integration URIs - Multiple integration types: AWS_PROXY, AWS (VTL), HTTP_PROXY, HTTP (VTL), MOCK - Route response selection expression for bidirectional messaging - Binary frame support (isBase64Encoded: true) - 128 KB payload size limit enforcement (frames and @connections POST) - 10-minute idle timeout and 2-hour max connection duration - GoneException (410) for disconnected connections - $connect response headers propagation - Server-initiated close via @connections DELETE (skips $disconnect Lambda) Also includes: - Refactored LambdaArnUtils.extractFunctionNameFromUri as shared utility - Extended Authorizer/Integration/Stage models with new fields - Comprehensive Java integration tests (WebSocket lifecycle, routing, auth, etc.) - Node.js SDK compatibility tests using ws client and @aws-sdk/client-apigatewaymanagementapi - Updated documentation with full feature matrix

* test(apigatewayv2): support custom WebSocket endpoint via env var

- Update wsUrl helper to read FLOCI_ENDPOINT environment variable
- Convert http/https schemes to ws/wss for WebSocket compatibility
- Strip trailing slashes from endpoint URL for consistent formatting
- Enable testing against non-localhost endpoints for CI/CD flexibility

* fix: use AwsErrorResponse for @connections API error responses

Replace raw JSON string literals in handlePostToConnection,
handleGetConnectionInfo, and handleDeleteConnection with the
project-standard AwsErrorResponse record, which serialises to
the correct {"__type": ..., "message": ...} wire shape.

* fix: simplify extractFunctionNameFromUri using AwsArnUtils.parse

Adopt AwsArnUtils.parse() as the core of the implementation per
reviewer suggestion. One addition beyond the suggested snippet:
the API Gateway v1 integration URI format embeds a Lambda ARN
inside an apigateway ARN (resource starts with 'path/.../functions/'),
so we detect that pattern and recurse on the embedded ARN before
applying the standard function-name extraction. All 43
LambdaArnUtilsTest cases pass, including the API Gateway v1 style URI.
2026-05-08 17:15:35 -05:00
Dixit R Jain 8fe2bf4c97 feat(apigatewayv2): add WebSocket API support, Update ops, Route/Integration Responses, Models, and Tagging (#682)
Closes #526

Add 27 new API Gateway v2 operations (21 → 48 total):

- WebSocket protocol: CreateApi with WEBSOCKET, wss:// endpoints,
  routeSelectionExpression validation, routeResponseSelectionExpression
- Update operations: UpdateApi, UpdateRoute, UpdateIntegration,
  UpdateAuthorizer, UpdateStage, UpdateDeployment
- Route Responses: full CRUD (5 ops)
- Integration Responses: full CRUD (5 ops)
- Models: full CRUD (5 ops)
- Tagging: TagResource, UntagResource, GetTags
2026-05-02 07:53:13 -05:00
Yorí 8eeb2244a7 Feat/lambda image config working directory (#673)
* feat(lambda): support ImageConfig.WorkingDirectory override

Propagate WorkingDirectory from the Lambda ImageConfig through the full
stack so container images that rely on a specific WORKDIR can be invoked
correctly, matching real AWS behavior.

- LambdaFunction: add imageConfigWorkingDirectory field + getter/setter
- LambdaService: parse WorkingDirectory on CreateFunction and
  UpdateFunctionConfiguration
- ContainerSpec: add workingDir record component
- ContainerBuilder: add withWorkingDir() fluent method
- ContainerLifecycleManager: pass workingDir to Docker via withWorkingDir()
- ContainerLauncher: apply workingDir when building the container spec
- LambdaController: serialize WorkingDirectory in ImageConfigResponse

* test(lambda): add tests for ImageConfig.WorkingDirectory

Unit tests (LambdaImageConfigTest):
- CreateFunction stores WorkingDirectory alongside Command/EntryPoint
- createFunction with all three fields together
- updateFunctionConfiguration updates and clears WorkingDirectory
- ContainerLauncher passes workingDir to ContainerSpec

Compat tests across all SDKs:
- awscli (lambda.bats): create/get/update WorkingDirectory round-trip
- Java SDK (LambdaFunctionConfigTest): ImageConfig.WorkingDirectory round-trip
- Python (test_lambda_function_config.py): TestImageConfigWorkingDirectory class
- Node (lambda.test.ts): create/update WorkingDirectory assertions
- Go (lambda_test.go): TestLambdaImageConfigWorkingDirectory subtests
- Rust (lambda_test.rs): full create/get/update round-trip
2026-04-30 17:25:03 -05:00
Yorí 1cccf43f7b feat(cognito): include all standard attributes in DescribeUserPool Schema (#642)
* feat(cognito): include all standard attributes in DescribeUserPool SchemaAttributes

AWS Cognito always returns all 20 standard OIDC attributes (sub, name,
email, phone_number, etc.) in SchemaAttributes when describing a user
pool, even if none were explicitly configured. Floci was returning only
what was passed in Schema during creation.

Adds CognitoStandardAttributes with the full default set and a merge()
helper that overlays explicit schema overrides and appends custom:
attributes after the standard ones.

* test(cognito): add compat tests for standard SchemaAttributes across all SDKs

Adds DescribeUserPool SchemaAttributes coverage to all compatibility test
suites (AWS CLI/bats, Go, Java, Node, Python, Rust), verifying that all
20 standard OIDC attributes are returned and that sub is required and
immutable.
2026-04-29 00:01:48 -05:00
Christine Nguyen eed72e6222 feat(pipes): add filtering, input templates, batch sizes, and DLQ routing (#576) 2026-04-23 22:56:05 -05:00
Christine Nguyen 51bf4f8480 feat(pipes): add source polling and target invocation for EventBridge Pipes (#555) 2026-04-22 23:36:48 -05:00
Conor Heine a0ed51e9d1 feat: ecr (#337) 2026-04-11 09:59:05 -05:00
Hector Ventura 9ca82e5748 feat(eventbridge): add InputTransformer support and S3 event notifications (#294)
* feat(eventbridge): add InputTransformer support for rule targets

Support InputPathsMap + InputTemplate on EventBridge targets so events
can be projected to a subset of fields before delivery to SQS/SNS/Lambda.

- Add InputTransformer model with inputPathsMap and inputTemplate fields
- Parse and serialize InputTransformer in PutTargets / ListTargetsByRule
- Apply transformer in invokeTarget: extract JSONPath variables, substitute
  <varName> placeholders in the template
- Use Jackson JsonPointer for JSONPath resolution ($.a.b.c → /a/b/c)
- Add unit tests for extractJsonPath and applyInputTransformer edge cases
- Add integration tests covering full put/list/deliver/transform flow

Fixes #140
2026-04-08 16:23:59 -05:00
Hector Ventura 4724db97be feat: add KMS GetKeyPolicy, PutKeyPolicy and fix CreateKey Tags (#258 #259 #269) (#280) 2026-04-08 01:37:38 -05:00
Hector Ventura 5e8b39c1aa fix: resolve Cognito auth, token, and user lookup issues (#218 #220 #228 #229 #233 #234 #235) (#279) 2026-04-08 01:30:26 -05:00
Conor Heine 13916913e8 fix: handle base64-encoded ACM cert imports (#248) 2026-04-07 13:20:27 -05:00
Conor Heine f4f1752b0d fix: return 400 when encoded s3 copy source is malformed (#244)
fix: replace silent exception swallowing and add per-test timeout in Python test suite

test: misc compatibility-tests cleanups

- Added sync comments to both main.tf files
- Created compatibility-tests/.dockerignore
- Cached CRC32 table in Node setup.ts
- Removed >/dev/null 2>&1 from 3 Dockerfiles

test: add missing .terraform.lock.hcl

chore: remove .terraform.lock.hcl
2026-04-06 16:53:14 -05:00
Conor Heine eeefb729c4 test: move compatibility tests into this repo (#225)
* test: move compatibility tests into this repo
* fix: add StatisticValues parsing to CloudWatchMetricsJsonHandler
* fix: add missing required abstract methods to EmulatorConfig in EventBridgeSchedulerIntegrationTest
* test: add sdk tests for multipart S3 copy coverage
* fix: cover and fix smithy cbor and multipart s3 copy regressions
* test: migrate more test coverage to new folder
* test: add missing ec2 expectation in healthcheck test
* docs: update READMEs in `./compatibility-tests`
2026-04-06 09:35:53 -05:00