Commit Graph
15 Commits
Author SHA1 Message Date
XuJian 95cbe7de34 feat(appsync): execute VTL pipeline resolvers on sidecar (#4586)
* feat(appsync): execute VTL pipeline functions

* fix(appsync): validate VTL functions before early return
2026-09-29 11:36:27 -04:00
XuJian 89344b76dc feat(appsync): authorize data source service roles (#4555)
* feat(appsync): authorize data source service roles

* test(appsync): verify service role at dispatch boundary

* fix(appsync): tighten service role authorization checks

* fix(appsync): honor IAM enforcement setting for data sources

* fix(appsync): adapt Lambda resolver test to authorizer dependency
2026-09-28 23:48:19 -05:00
XuJian 11b762d08b fix(appsync): send VTL Lambda payload to function (#4579)
* fix(appsync): pass JS Lambda request envelope to function

Signed-off-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>

* fix(appsync): send VTL Lambda payload to function

---------

Signed-off-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
2026-09-28 21:25:53 -04:00
XuJian 5e2edcb89b feat(appsync): execute VTL unit resolvers over data sources (#4423)
* feat(appsync): execute VTL unit resolvers over data sources

* fix(appsync): reject unbatched VTL Lambda BatchInvoke

* fix(appsync): normalize VTL Lambda payload and transact RDS statements

* fix(appsync): preserve sequential RDS statement effects

* fix(appsync): send full VTL request document to Lambda
2026-09-28 10:27:46 -04:00
XuJian 73ea1e2463 feat(appsync): execute VTL unit resolvers over NONE (#4356)
* feat(appsync): execute VTL unit resolvers over NONE

* fix(appsync): preserve pipeline early returns

* style(appsync): fix pipeline lookup indentation

* style(appsync): align pipeline result assignment
2026-09-25 11:13:45 -04:00
Anders Wasen 27633bf94d feat(appsync): execute APPSYNC_JS resolvers via a Node sidecar (#3422)
* feat(appsync): execute APPSYNC_JS resolvers via a Node sidecar

A field with a resolver resolved to null: no data fetchers were registered, so graphql-java
fell through to its property fetcher on an empty root. This runs the resolver instead, for
UNIT and PIPELINE alike, over NONE, AWS_LAMBDA, RELATIONAL_DATABASE and AMAZON_DYNAMODB data
sources.

Resolver JavaScript runs in a Node sidecar container rather than in process. Floci's published
image is a Mandrel native executable, which carries no Truffle languages, so there is no
in-process JavaScript to embed; running real Node also means a bundle executes as written, ES
modules and all. @aws-appsync/utils is a shim the sidecar writes at boot rather than the
published package, so a resolver call never depends on npm being reachable.

The pipeline follows AppSync's: ctx.stash threads through every stage, each stage sees the last
as ctx.prev.result, runtime.earlyReturn stops everything, util.error fails the field with the
type the resolver chose, and util.appendError returns its errors beside the data. A data source
failure does not fail the field on its own: the stage's response() handler is called with
ctx.error set and decides whether to re-raise or suppress, which is why resolvers carry an
explicit if (ctx.error) branch.

VTL mapping templates are not executed. A VTL stage fails its field saying so rather than
resolving to null, since a null that means "not implemented" is indistinguishable from a null
that means "no rows".

Carries model/FunctionConfiguration and AppSyncService so it builds and tests standalone; both
are identical to the copies in the AppSync CloudFormation change and collapse on merge.

* feat(appsync): enforce the APPSYNC_JS subset before evaluating resolver code

The sidecar is real Node, so it accepted JavaScript AWS rejects: async functions, promises,
classes, try/catch, while loops, this, and imports of Node builtins. For an emulator that is
the worst failure available, since a local run green-lights resolver code that cannot deploy.

Imports are restricted by a module resolve hook rather than a source scan, so a dynamic import
of a builtin cannot slip past either. An async handler is caught before it runs and a handler
returning a promise after. The remaining constructs are found by scanning the source with
comments, strings and template text blanked first, so the same keywords inside them are not
flagged. A rejected resolver fails its field with errorType UnsupportedFeature and the line.

Enforcement is on by default and can be turned off with
floci.services.appsync.js-runtime.enforce-appsync-subset, which exists only so a false positive
cannot block someone whose code AWS does accept.

Checking real resolvers against it found a gap of the same kind in the other direction:
@aws-appsync/utils/dynamodb is a real module the shim did not provide, so valid code was being
rejected. It now implements get, put and remove; the helpers that compile a condition or update
expression throw by name rather than returning something the data source would mishandle.

Also from review: cap the /evaluate request body, keep integer precision in the DynamoDB NS
branch as the N branch already did, reject two SQL parameters bound to the same name instead of
letting the Data API report it, drop the container id and close the log follower in reset(), and
bound the docker probe in the integration test so an unresponsive daemon cannot hang CI.

* feat(appsync): add the js-runtime url knob and stop the sidecar through ContainerTeardown

Follows the sidecar contract the other managed containers use. floci.services.appsync.
js-runtime.url points the runtime at a Node server that is already running, in which case
ensureStarted skips container management entirely: nothing is created, adopted or stopped, and
the URL is probed with the short adopt budget so a wrong one says so instead of holding the
first resolver for the full start timeout. Same shape and meaning as floci.services.duck.url.

NodeAppSyncJsRuntime now implements ContainerTeardown, so EmulatorLifecycle stops the sidecar
with the other process-bound containers at a deterministic point rather than only through
@PreDestroy, which the interface documents as running too late for the final storage flush.
Teardown is a no-op for a pre-configured URL, since that server is not ours to stop.

* fix(appsync): serialize reset() and stop the sidecar it gives up on

reset() touched started, baseUrl, containerId and logStream without holding the monitor that
ensureStarted() and stopManagedContainers() both take. A failed evaluation could therefore clear
those fields in the window after a container had been created and its id recorded but before
started was set, dropping the only handle to a live container: teardown then saw a null id,
treated the sidecar as never started, and the container was leaked rather than stopped.

reset() is now synchronized on the same monitor, and reentrant so the callers already holding it
are unaffected. The failure path in post() goes through discardSidecar(), which stops and removes
the container before clearing the fields instead of forgetting it, since forgetting is what leaks:
nothing else holds the id. A pre-configured url owns no container, so teardown there stays a no-op.

The regression races eight failing evaluations against startup and asserts every container the
runtime created was also stopped. It needs a transport-level failure to reach the path: a 500 is
rethrown as an AwsException before it, so the stub drops the connection instead. Against the
previous reset() it fails with expected <[container-1]> but was <[]>.

* refactor(appsync): run resolvers through the GraphQL sidecar callback

out of Floci, which left this branch building DataFetchers for a schema that no
longer has any. Resolver execution moves onto the sidecar's batched resolver
callback instead, so the engine stays in the sidecar and the resolvers, the data
sources and the Node runtime stay here.

/v1/execute now carries a resolve block naming every planned coordinate that has
a resolver, with a callback URL and a token minted for that one operation. The
sidecar batches each execution level into one POST /appsync-resolve, which runs
the field's resolver and answers with a value or an error. denyFields still win,
so a denied coordinate is never listed and never reaches a resolver, and the
token stops working as soon as the operation returns.

AppSyncResolverExecutor takes a ResolverInvocation record instead of a
DataFetchingEnvironment. Every value it read off the environment is on the
record, so the pipeline, the data source invokers and the JS runtime are
unchanged. ResolverDataFetcher is gone: fields with no resolver are the sidecar's
own property fetcher again, and a resolver that disappears mid-operation falls
back to the source property rather than failing.

One AppSync behaviour does not fit the callback response, which carries a value
or an error per field and never both. util.appendError means report this and
keep the data, so those errors come back on the operation's session and are
merged into the response envelope, which keeps data and appended errors together
as AppSync returns them.

Also gives the sidecar container host.docker.internal on Linux, since it now has
to reach Floci back, moves the JS runtime image pin into application.yml so CI
prefetches it the way it does the sidecar pins, and puts the Docker integration
test on the shared AppSyncGraphqlSidecarProfile so it is namespaced and gated
like the other AppSync integration tests.

* ci(appsync): prefetch the Node image only on the shard that starts it

The js-runtime prefetch matched /appsync/, so all four shards pulled
node:22-alpine although only the shard carrying
AppSyncJsResolverDockerIntegrationTest starts that container. Every other test
in the package is a unit test. Matching the class name instead is three fewer
Docker Hub pulls per run, which is what this script exists to avoid.

* fix(appsync): keep null arguments and move the resolver callback under _floci

Two review points from #3422.

ResolverInvocation copied arguments and variables with Map.copyOf, which rejects
a null value, so getMessages(nextToken: null) threw out of the callback and
answered 500. That failed every field in the batch, not only the field carrying
the null. Both copies are now null tolerant, and an explicit null stays
distinguishable from an absent argument: it is present in ctx.args and null,
where an absent one is not there at all.

The callback moves from /appsync-resolve to /_floci/appsync/resolve, with the
EKS webhooks. A bare path is reachable as a path-style S3 request for a bucket
of that name, and an S3 bucket name cannot begin with an underscore, so the
prefix cannot be shadowed.

The null case is covered both ways: a unit test in ResolverCallbackResourceTest
that fails with a NullPointerException against the previous code, and three
queries in the Docker round trip covering an explicit null, its value reaching
ctx.args, and an absent argument for contrast.
2026-09-22 14:41:55 -04:00
Priamo Germosen 918a09f54a fix(appsync): move the GraphQL engine to a sidecar, out of the native image (#3534)
graphql-java (~3.8MB with transitive deps) was an unconditional dependency,
so it and its schema/execution/parser classes were reachable in every
native image regardless of whether AppSync was ever used (issue #2917),
the same systemic pattern already fixed for Kubernetes (#2914) and Kafka
(#2916).

Schema parsing and query execution now run in floci/floci-sidecar-graphql,
published from floci-io/floci-sidecars, the same model #3799 already moved
Cedar onto: GraphqlSidecarManager lazily starts the pinned image and checks
the contract version it reports on /health, refusing a sidecar speaking
another contract major with a message naming the image and the variable to
change. GraphqlSidecarClient talks to it over plain HTTP. graphql-java is
no longer a dependency of this repository at all, not even test-scoped:
its schema/execution/parser classes, the query planner, and the 17 AWS
scalar coercions now live entirely in the sidecar's own repository.

The sidecar itself carries zero AppSync-specific knowledge, and zero AWS
vocabulary: its scalars are generic named coercion kinds a caller maps its
own scalar names onto, so SidecarSchemaCompiler now sends a scalars mapping
(AWSDateTime -> date-time, and so on for all 17) alongside every SDL, or
AWS scalar validation would silently degrade to pass-through coercion. It
exposes three endpoints: schema validate/compile, a query planner that
lists every (typeName, fieldName) coordinate a query would visit plus the
directives on each (with zero interpretation of what they mean), and
execute, which accepts an opaque denyFields list and nulls those
coordinates out with the caller-supplied error. All @aws_auth/IAM/
Cognito/Lambda-authorizer interpretation stays in Floci
(SidecarFieldAuthorizationPlanner, AppSyncAuthRequirements), computed from
the planner's output before /v1/execute is ever called, so a query the
planner can't fully analyze fails closed (refuses the request) instead of
silently running unauthorized. SidecarSchemaCompiler replaces
AppSyncSchemaParser: it still injects AppSync's directive declarations and
the 17 scalar type declarations into the customer's SDL (pure string work)
before handing the SDL to the sidecar.

While the scalar coercion logic was still being ported to the sidecar's
repository, testing surfaced a real bug: every scalar's parseLiteral()
delegated to parseValue(), which throws CoercingParseValueException;
graphql-java's literal validator only catches CoercingParseLiteralException,
so an invalid literal argument (as opposed to an invalid variable) escaped
as an unhandled exception instead of a spec-correct GraphQL
ValidationError. Fixed in the sidecar before it was ever published.

QueryRegistry, QueryExecutor, AuthFieldWrapper, AuthorizationDataFetcher's
live DataFetcher wrapper, and AppSyncFieldUnauthorizedException are
deleted: their in-process execution role no longer exists. The directive
interpretation half of AuthorizationDataFetcher survives as
AppSyncAuthRequirements, now taking generic data instead of live
graphql-java objects, shared rather than duplicated.

Verified end to end against the published image: pulled
floci/floci-sidecar-graphql:0.2.0 fresh and ran the full AppSync suite
(190 integration tests across schema lifecycle, auth, and execution)
through the real GraphqlSidecarManager, including the sidecar starting
and stopping as a real sibling container over the mounted Docker socket.
2026-09-18 07:57:15 -05:00
Niels Kootstra ef03c59864 fix(apigateway): prevent JWT issuer and JWKS SSRF (#3743)
* fix(apigateway): prevent JWT issuer and JWKS SSRF

* fix(apigateway): import verifier types
2026-09-16 18:00:01 -04:00
Niels Kootstra 144b90e6fa fix(apigateway,appsync): sandbox VTL rendering with SecureUberspector and execution limits (#3542)
* fix(apigateway,appsync): sandbox VTL rendering with SecureUberspector and execution limits

VtlTemplateEngine and AppSyncVtlEngine rendered templates with Velocity's
default UberspectImpl introspector, which allows arbitrary reflection
through any context object (e.g. $util.getClass().forName('java.lang.Runtime')),
and had no cap on #foreach iterations, output size, or execution time,
making them vulnerable to both sandbox escapes and denial of service via
runaway loops or #set string doubling.

Add a shared VtlSandbox helper that both engines call to switch to
SecureUberspector and restrict introspection on java.lang.Class,
ClassLoader, Runtime, ProcessBuilder, System, Thread, java.io.File and
related reflection/scripting/process packages, plus three independent
limit layers: a native #foreach loop cap that truncates the loop without
failing the template, a cooperative execution deadline checked from a new
SandboxedForeach directive before each loop iteration, and a BoundedWriter
output-size cap. The latter two throw the new VtlLimitExceededException,
an unchecked RuntimeException that flows through each engine's existing
error handling exactly like any other Velocity evaluation failure, with
no new error shape. Limits are configurable via EmulatorConfig
(vtlMaxLoops, vtlMaxOutputChars, vtlTimeoutMillis; application.yml keys
vtl-max-loops, vtl-max-output-chars, vtl-timeout-millis), mirroring the
project's existing per-service numeric-tunable config pattern, and
documented in api-gateway.md and appsync.md.

The classpath-shadowed velocity.properties resource is kept for any
embedding that resolves it normally, but is not the actual enforcement
point: under this project's test/runtime classloader, Velocity's own
getResourceAsStream lookup for that exact resource path can resolve to
the copy bundled inside the velocity-engine-core jar instead of this
project's shadowed copy, silently leaving the insecure UberspectImpl
active even with a correct properties file on disk. VtlSandbox configures
SecureUberspector and swaps in SandboxedForeach directly via the
VelocityEngine Java API instead, which is unaffected by that ambiguity.

* docs(apigateway): correct foreach registration documentation
2026-09-15 13:03:51 -04:00
Niels Kootstra f38a384e51 fix(appsync): verify JWT signatures and SigV4 requests for GraphQL auth (#3541)
* fix(appsync): verify JWT signatures and SigV4 requests for GraphQL auth

Cognito and OIDC auth modes decoded JWT claims without checking the
signature, and AWS_IAM auth accepted any well-formed Credential= value
without verifying a real SigV4 signature. An unregistered IAM access
key also fell back to an account-root identity instead of being
rejected. Any of these let an attacker forge claims or an identity
for AppSync's GraphQL data-plane endpoint.

Cognito now verifies the token against the issuing user pool's own
RS256 signing key (alg, kid, issuer, expiry) instead of trusting the
decoded payload. OIDC verifies against the configured issuer's
published JWKS via OIDC discovery, reusing JwtSignatureVerifier (the
same verifier the HTTP API JWT authorizer uses), and fails closed on
an unreachable issuer or unsupported algorithm. AWS_IAM verifies a
real header-signed SigV4 request (service "appsync", fixed
/v1/apis/{apiId}/graphql canonical path): the Credential= access key
must resolve to a secret via IamService and the signature must match
the actual request, including its body. An unknown or unsigned key is
always rejected and never resolves to root; the legacy test/test pair
is still emulator-allow but must be signed like any other key.

JwtClaimsDecoder gained decodeHeader()/rawToken() so callers can check
alg/kid and hand the raw token to a signature verifier.
AuthRequestInfo carries the raw request body so IAM signature
verification can hash the real payload rather than trusting an
unsigned one.

* fix(appsync): bind session tokens to temporary IAM credentials

IamAuthValidator.resolveSecretKey resolved a temporary (ASIA...)
access key's session secret and verified the SigV4 signature, but
never checked X-Amz-Security-Token. A caller holding just the secret
could authenticate without presenting the session token AWS requires
to prove the credential is live and genuinely STS-issued.

checkSessionToken now mirrors ExecuteApiSigV4Authorizer: a temporary
key with no X-Amz-Security-Token header is rejected, a present token
is compared against the value IamService recorded at mint time with
MessageDigest.isEqual, and a session recorded before Floci tracked
tokens (no issued value to compare against) is not locked out by a
check it cannot satisfy. The token does not need to ride in
SignedHeaders; comparing it against the issued value binds it
regardless of where it rode.

Also drops the dead Date-header fallback in headerSignedRequest
(AMZ_DATE can never parse RFC 1123 output, so that branch never ran)
and fixes an em-dash in the AWS_IAM docs row.

* test(appsync): sign IAM data-plane requests in the auth integration test

Two AppSyncAuthIntegrationTest cases sent the bare Credential= header
that is enough for the management plane to the GraphQL endpoint and
expected 200. Now that AWS_IAM requests are verified as real SigV4,
that header is an unsigned request and gets 401, which is the intended
behaviour. Sign those two requests with AppSyncRequestSigner using the
legacy test credential; the cases that expect 401 for a dummy
signature are unchanged.
2026-09-13 17:56:24 -04:00
武田隆志 29325006bb fix(appsync): use ApiKey.id as the API key value (#2645)
CreateApiKey returned a short random id and kept the value the execute
endpoint validates in a non-model apiKey field, which the AWS CLI and SDKs
drop. On AWS the id itself is the da2- key value sent as x-api-key, so make
id that value, validate against it, and drop the extra field. Keys persisted
by earlier builds keep their short id, stay listable and deletable, and never
authenticate (as before).
2026-08-28 09:59:42 -04:00
AgustinBertagna 3f12428d97 feat(appsync): Phase 7 — GraphQL execute authentication (#2380)
* feat(appsync): register GraphQL execute controller in the service catalog

Unsigned POST /v1/apis/{apiId}/graphql was not a registered AppSync resource, so the data-plane path could be claimed by other catch-all routes.

* feat(appsync): default API key expiry and reject duplicate auth providers

CreateApiKey now expires in seven days when omitted, caps expiry at 365 days, and looks keys up by value. Create/UpdateGraphqlApi reject duplicate API_KEY, IAM, and Lambda providers.

* feat(appsync): authenticate GraphQL execute requests

Classify credentials by header shape and require a configured provider before GraphQL runs. Request failures return HTTP 401 UnauthorizedException on the data-plane envelope.

* feat(appsync): enforce SDL field authorization on GraphQL execute

Wrap registered fields with AuthorizationDataFetcher so directive mismatch, Cognito groups, IAM field DENY, and Lambda deniedFields stay HTTP 200 with null data and errors[].

* test(appsync): execute GraphQL over HTTP with an SDK-created API key

Cover data-plane success with x-api-key and 401 without credentials after management CreateGraphqlApi/CreateApiKey.

* fix(appsync): match missing-header 401 text and SigV4 precedence

AWS returns Missing authorization header when credentials are absent, evaluates auth before schema, and routes SigV4 Authorization ahead of x-api-key without falling back to the API key.

* fix(appsync): emit field-level Unauthorized GraphQL errors

AWS AppSync returns HTTP 200 with errorType Unauthorized and
Not Authorized to access {field} on type {type}, not UnauthorizedException.

* fix(appsync): omit sourceIp from OIDC identity

Official AppSync OIDC identity is only sub, issuer, and claims.

* fix(appsync): round API key expiry down to the hour

CreateApiKey and UpdateApiKey store expires as epoch seconds rounded
down to the nearest hour, matching the AWS API Reference.

* fix(appsync): match duplicate auth provider BadRequestException text

AWS names the 1-based additional provider index and the repeated type.

* fix(appsync): reject API key expiry outside 1-365 days

CreateApiKey and UpdateApiKey now raise ApiKeyValidityOutOfBoundsException
when expires is not between 1 and 365 days from now.

* fix(appsync): set ApiKey deletes to expires plus 60 days

AWS keeps expired da2 keys for 60 days and returns deletes as epoch
seconds rounded down to the hour.
2026-08-19 11:46:11 -04:00
AgustinBertagna 819bfedc6c feat(appsync): Phase 6 — Query Execution + HTTP Endpoint (#1884)
* feat(appsync): Phase 6 GraphQL HTTP execute endpoint

Expose POST /v1/apis/{apiId}/graphql with AppSync-compatible error
mapping, dual Content-Type, schema rehydrate on boot, and smoke
execution without Phase 8 DataFetchers.

* fix(appsync): initialize graphql IdGenerator at native runtime

Query execution pulls graphql.util.IdGenerator into the native image
reachability graph; its static Random must not be frozen in the heap.

* fix(appsync): cache GraphQL engines and always set x-amzn-errortype

Cache graphql-java GraphQL wrappers per apiId in SchemaRegistry (invalidate
on register/remove/rehydrate), and emit x-amzn-errortype on all data-plane
non-2xx responses for AWS parity with AppSync transport errors.

* fix(appsync): hide unexpected exception details on GraphQL 500

AppSync returns a fixed InternalFailure message for unexpected
errors; keep the real cause in server logs only.

* chore(appsync): drop redundant native-init comment

* fix(appsync): rehydrate schemas across all accounts on boot

Startup has no request context, so keys()/get() only saw the default
account. Mirror recoverOrphans with scanAllAccountsAsMap, persist SDL via
putForAccount in the worker, and drop the shared .atl/ gitignore entry.

* fix(appsync): keep non-404 AwsException on data-plane envelope

Avoid rethrowing AwsException from the GraphQL execute endpoint into
AwsExceptionMapper (__type). Map unexpected lookup failures to
InternalFailure with the AppSync errors[] shape instead.

* docs(appsync): point error formatter @see at $util.error docs

security-authz.html covers authorization types, not errorType/errorInfo.
Cite built-in-util-js.html where $util.error documents those fields.

* refactor(storage): type StorageFactory.create as AccountAwareStorageBackend

The factory always wraps every mode in AccountAwareStorageBackend; declaring
that return type removes unsafe casts at AppSync/CodePipeline/CloudFormation
call sites and updates test overrides/mocks to match production.

* fix(test): stub StorageFactory.create with AccountAware backends

thenAnswer stubs that returned bare InMemoryStorage ClassCast after
create() was typed as AccountAwareStorageBackend; align the remaining
service unit tests with the production return type.
2026-08-12 09:32:03 -04:00
AgustinBertagna 4446404288 feat(appsync): Phase 2 — Schema Registry, Model Fixes, CRUDL completion & AWS Scalars (#1185)
* build: add graphql-java dependency

* feat(appsync): add and extend data models for Phase 2

- Add AdditionalAuthenticationProvider, DomainName, ChannelNamespace, ApiAssociation models
- Add 14 fields to GraphqlApi (apiType, visibility, owner, etc.)
- Change additionalAuthenticationProviders from raw maps to typed list
- Add 6 fields to Resolver (resolverArn, cachingConfig, maxBatchSize, etc.)
- Add dataSourceArn to DataSource
- Rename FunctionConfiguration.arn to functionArn

* feat(appsync): add service and controller changes for Phase 2

* feat(appsync): add service and controller changes for Phase 2

* test(appsync): add Phase 2 integration tests

Add ~60 new tests for:
- Model completeness (new fields, ARNs, functionArn rename)
- Domain names CRUDL + associate/disassociate
- Channel namespaces CRUDL + update
- Merged API associations CRUDL
- Enhanced metrics
- Schema registry parsing with AWS scalars and extensions
- Directive registration (aws_api_key, aws_subscribe, deprecated, unknown)
- Edge cases (null auth providers, maxBatchSize 0, cleanup on delete)

* test(appsync): add AWS scalar unit tests

Test all 17 AWS scalars:
- All registered in AppSyncScalarRegistry
- AWSDateTime, AWSJSON, AWSEmail parse valid/invalid values
- AWSTimestamp and AWSShort range validation
- AWSURL and AWSPhone format validation

* test(appsync): add SDK compatibility tests for Phase 2

Validate that the AWS SDK Java v2 can read:
- dataSourceArn() on CreateDataSource response
- resolverArn() on CreateResolver response
- functionArn() on CreateFunction response
- BadRequestException on invalid schema creation

* docs(appsync): add Phase 2 operations, schema registry, and AWS scalars documentation

- Add Domain Names, Channel Namespaces, Merged API Associations, Enhanced Metrics
- Document AWS scalar types (17 scalars with validation rules)
- Document AppSync directives (8 directives with locations)
- Update Not Implemented section with future phase references
- Add CLI examples for domain names and channel namespaces
- Update cascade delete to include channel namespaces and domain associations

* docs: add AppSync to service tables, env vars, storage config, and SDK README

- README.md: add AppSync to category table, detailed notes, and architecture diagram
- docs/index.md: add AppSync to supported services table, fix count to 52
- docs/configuration/environment-variables.md: add FLOCI_SERVICES_APPSYNC_ENABLED
- docs/configuration/advanced/application-yml.md: add appsync config block
- docs/configuration/storage.md: add AppSync per-service storage override
- compatibility-tests/sdk-test-java/README.md: add AppSyncTest to services table

* fix(appsync): reuse ObjectMapper and fix AWSJSON serialize for non-string values

AWSJSON scalar was creating a new ObjectMapper on every parseValue() call. serialize() used toString() which produces invalid JSON for Map/JsonNode results.

* fix(appsync): strip string literals and comments before unknown directive validation

The regex @(\w+) incorrectly flagged @ mentions inside GraphQL string literals and comments as unknown directives.

* fix(appsync): prevent silent overwrite on creates, validate required fields and input values

- Add existence checks on createDataSource, createResolver, createType,
  createChannelNamespace, createMergedApiAssociation (→ ConflictException 409)
- Validate authenticationType is required on createGraphqlApi
- Validate typeName is required on createResolver
- Validate dataSourceName exists on createResolver and createFunction
- Prevent associateApi from silently overwriting existing association
- Enforce API key limit (max 2 per API)
- Fix expires parsing to accept ISO 8601 strings, throw on invalid values
- Fix castInt overflow detection
- Fix updateApiKey expires validation (was silently swallowing errors)
- Change InvalidNextTokenException to BadRequestException (AWS standard)
- Fix maxResults=0 to return empty page
- Fix getIntrospectionSchema to throw 404 instead of returning null
- Fix tags with null values (was producing literal string "null")

* test(appsync): fix cascade delete test to create data source before function, align with new validation

* refactor(appsync): remove dead code and unused hasSchema()

- Delete AppSyncDirectiveRegistry.java (100 lines, never used)
- Delete DirectiveValidator.java (45 lines, never called)
- Remove hasSchema() from SchemaRegistry (never called)

* fix(appsync): scalar null-safety, type validation, and DNS resolution

- Add null checks to 5 serialize() methods (AWS_TIMESTAMP, AWS_LONG,
  AWS_INTEGER, AWS_BOOLEAN, AWS_FLOAT) to prevent NPE
- Fix AWS_TIMESTAMP parseValue() ClassCastException on String input
- Replace InetAddress.getByName() with regex in AWS IPAddress to
  prevent DNS resolution (SSRF concern)
- AWSBoolean now rejects non-boolean values (matches AppSync behavior)

* refactor(appsync): centralize directive definitions in AppSyncDirective enum

- Add AppSyncDirective enum as single source of truth for directive
  names and SDL definitions
- Update AppSyncSchemaParser to use enum instead of duplicated strings
- Eliminates 3 sources of truth (validateNoUnknownDirectives Set,
  injectDirectiveDefinitions SDL, and formerly AppSyncDirectiveRegistry)

* perf(appsync): cache scalarMap in AppSyncScalarRegistry

- Initialize scalarMap once in constructor as unmodifiableMap
- Avoids recreating HashMap on every call (was called twice per
  schema parse)

* test(appsync): add tests for scalar fixes and behavior changes

- Add tests for null-safety in serialize() (5 scalars)
- Add test for AWSTimestamp parseValue with String input
- Add tests for AWSIPAddress regex validation (IPv4, IPv6, invalid)
- Add tests for AWSBoolean rejecting non-boolean values
- Add test for scalarMap caching

* test(sdk): add AWS scalars schema creation test

Verifies that schemas with AWS scalar types (AWSDateTime, AWSJSON,
AWSIPAddress, AWSBoolean) parse correctly via the SDK.

* fix(appsync): correct API paths to match AWS documentation

- Channel namespaces: /v1/ → /v2/, channelnamespaces → channelNamespaces
- Domain association: /apis → /apiassociation
- Remove ListApiAssociations (not a real AppSync operation)
- Remove GetEnhancedMetricsConfig (not a real AppSync operation)
- Rename Merged API Association to Source API Association with correct paths:
  - AssociateSourceGraphqlApi: POST /v1/mergedApis/{id}/sourceApiAssociations
  - GetSourceApiAssociation: GET /v1/mergedApis/{id}/sourceApiAssociations/{id}
  - ListSourceApiAssociations: GET /v1/apis/{apiId}/sourceApiAssociations
  - DisassociateSourceGraphqlApi: DELETE /v1/mergedApis/{id}/sourceApiAssociations/{id}

* feat(appsync): add SourceApiAssociation models

Add SourceApiAssociation, SourceApiAssociationConfig, and
SourceApiAssociationSummary models to support merged/source API
association operations per AWS AppSync API Reference.

* feat(appsync): add ChannelNamespace support models

Add AuthMode, HandlerConfig, HandlerConfigs, Integration, and
LambdaConfig models for ChannelNamespace handler configuration
per AWS AppSync API Reference.

* fix(appsync): fix ApiAssociation and ChannelNamespace models

ApiAssociation: remove source/merged API fields, keep only domain
association fields (apiId, associationStatus, deploymentDetail,
domainName) per AWS AppSync API Reference.

ChannelNamespace: add missing fields (channelNamespaceArn,
codeHandlers, created, handlerConfigs, lastModified,
publishAuthModes, subscribeAuthModes, tags) per AWS docs.

* feat(appsync): add missing service methods and fix response models

- associateApi now returns full ApiAssociation object
- createMergedApiAssociation returns SourceApiAssociation
- createSourceApiAssociation returns SourceApiAssociation
- getSourceApiAssociation validates mergedApiId
- listSourceApiAssociations returns SourceApiAssociationSummary
- Add updateSourceApiAssociation method
- Add deleteMergedApiAssociation method
- ChannelNamespace: populate arn, timestamps on create/update

* feat(appsync): fix response formats and add missing endpoints

- associateMergedGraphqlApi: response key apiAssociation → sourceApiAssociation
- disassociateSourceGraphqlApi: returns 200 + body (not 204)
- associateApi: returns full ApiAssociation from service
- Add POST /v1/mergedApis/{id}/sourceApiAssociations/{assocId} (UpdateSourceApiAssociation)
- Add DELETE /v1/sourceApis/{id}/mergedApiAssociations/{assocId} (DisassociateMergedGraphqlApi)

* test(appsync): fix and add integration tests for new endpoints

- Fix associateSourceGraphqlApi: use mergedApiId and sourceApiAssociationStatus
- Fix deleteSourceApiAssociation: expect 200 with body (not 204)
- Add updateDomainName test
- Add associateMergedGraphqlApi test
- Add updateSourceApiAssociation test
- Add disassociateMergedGraphqlApi test

* test(appsync): add SDK tests for missing operations

- Add updateDomainName test
- Add associateMergedGraphqlApi test
- Add updateSourceApiAssociation test
- Add disassociateMergedGraphqlApi test
- Fix test ordering for new domain tests
2026-06-07 00:05:51 -05:00
AgustinBertagna c8b0048bac docs(appsync): add AppSync service documentation (#1149)
Add documentation for AWS AppSync Management API (Phase 1) covering
33 operations across GraphQL API, Schema, DataSources, Resolvers,
Functions, Types, API Keys, Tags, and Environment Variables.

Includes pagination, cascade delete behavior, CLI examples,
and service matrix entry.
2026-06-03 17:36:32 -05:00