fix: resolve high dependabot vulnerabilities#3505
Conversation
…aws-cdk-lib 2.260 (globalSecondaryIndexes no longer populated) [#3505] aws-cdk-lib 2.260 renamed the private DynamoDB L2 Table field `globalSecondaryIndexes`/`localSecondaryIndexes` to `_globalSecondaryIndexes`/`_localSecondaryIndexes` (now ArrayBox-backed, same `.some`/`.find`/`.length` surface and `{ indexName, keySchema }` element shape). The transformer read the old names, yielding `undefined` and `TypeError: Cannot read properties of undefined (reading 'some'/'find')`, breaking 63 relational unit tests plus a conversation unit test. Read the renamed field first, falling back to the public `globalSecondaryIndexes` used by Amplify's managed-table construct, so the duplicate-index-name dedupe is preserved (not disabled) for both table types. Sites fixed: - amplify-graphql-relational-transformer/src/resolvers.ts (3 reads) - amplify-graphql-transformer-core/src/utils/schema-utils.ts (getKeySchema) - amplify-graphql-conversation-transformer conversation-resolver-generator.ts
…lib, js-cookie) - ws: bump to ^7.5.11/^8.21.0 + resolution >=7.5.11 (memory exhaustion DoS) - form-data: add resolution >=4.0.6 (CRLF injection) - aws-cdk-lib: bump 2.224.0 → 2.246.0 (OS command injection in NodejsFunction) - js-cookie: add resolution >=3.0.7 (prototype hijack cookie-attribute injection)
TableProps.partitionKey and GlobalSecondaryIndexProps.partitionKey became Attribute | undefined in aws-cdk-lib 2.246.0. The construct guarantees these are always provided, so non-null assertions are safe.
…46.0 compatibility aws-cdk-lib@2.246.0 requires constructs@^10.5.0 as a peer dependency. Also updates peerDependencies in jsii-published packages to ^2.246.0 so that jsii validation passes.
….246.0 The peerDependency bump to ^2.246.0 was a breaking change for consumers on older CDK versions. Reverted to ^2.224.0 for backward compatibility. The vulnerability is still fixed via the yarn resolution + devDependency. Updated e2e test defaults from 2.224.0 to 2.246.0 so tests install the patched CDK version.
aws-cdk-lib@2.246.0 produces cloud assembly schema v53 which requires CDK CLI >= 2.1125.0. The jsonServer used ~2.1101.0 (max schema v50).
…flict aws-cdk-lib@2.246.0 has an internal dependency conflict: it depends on @aws-cdk/cloud-assembly-api@^2.2.0 (resolves to 2.2.6) which requires @aws-cdk/cloud-assembly-schema@>=54.5.0, but aws-cdk-lib only provides @aws-cdk/cloud-assembly-schema@^53.0.0. aws-cdk-lib@2.260.0 fixes this by depending on schema@^54.0.0.
…aws-cdk-lib 2.260 (globalSecondaryIndexes no longer populated) [#3505] aws-cdk-lib 2.260 renamed the private DynamoDB L2 Table field `globalSecondaryIndexes`/`localSecondaryIndexes` to `_globalSecondaryIndexes`/`_localSecondaryIndexes` (now ArrayBox-backed, same `.some`/`.find`/`.length` surface and `{ indexName, keySchema }` element shape). The transformer read the old names, yielding `undefined` and `TypeError: Cannot read properties of undefined (reading 'some'/'find')`, breaking 63 relational unit tests plus a conversation unit test. Read the renamed field first, falling back to the public `globalSecondaryIndexes` used by Amplify's managed-table construct, so the duplicate-index-name dedupe is preserved (not disabled) for both table types. Sites fixed: - amplify-graphql-relational-transformer/src/resolvers.ts (3 reads) - amplify-graphql-transformer-core/src/utils/schema-utils.ts (getKeySchema) - amplify-graphql-conversation-transformer conversation-resolver-generator.ts
02558f4 to
481b874
Compare
…60.0 (matrix bump left stale 2.224.0 snapshot) [#3505]
…nodejs24.x default from aws-cdk-lib 2.260 dropped callback handlers) [#3505]
…ulnerabilities # Conflicts: # packages/amplify-data-construct/.jsii # packages/amplify-graphql-api-construct/.jsii
…cdk-lib 2.260 cloud-assembly schema 54 (#3505 HttpTransformerV2)
|
The GSI access pattern ( A more stable alternative would be reading from the L1 CfnTable, which exposes GSIs as public API: const cfnTable = table.node.defaultChild as CfnTable;
const gsis = Stack.of(table).resolve(cfnTable.globalSecondaryIndexes) ?? [];This won't break with L2 internal refactors. Also worth centralizing into a single shared utility since the same pattern is duplicated across 3 packages — next time CDK changes something, we'd only need to fix it in one place. |
|
Thanks @sarayev — agree the private-field coupling isn't ideal long-term. Two issues with the 1. It breaks Amplify's managed tables. For the managed DDB strategy the table is 2. Property casing. Given both, I'd keep the current accessor for this security-fix PR (it's validated e2e-green). Happy to take the centralization idea (single shared helper) as a separate follow-up. |
|
Thanks for the detailed explanation — makes sense, especially the AmplifyDynamoDBTable case. LGTM, happy to see the centralization follow-up when it comes. |
Summary
Resolves open high-severity Dependabot alerts, and includes the collateral source/test fixes required by the
aws-cdk-libbump those alerts pulled in.Dependency vulnerability resolutions
^7.5.7→^7.5.11and^8.18.0→^8.21.0, and added root resolutionws: >=7.5.11.form-data: >=4.0.6in the root andscripts/manifests. Transitive (viaaxios), so a resolution is used.assign()): added root resolutionjs-cookie: >=3.0.7. Transitive (viaamazon-cognito-identity-js), so a resolution is used.uuid: ^11.1.1(retained).2.224.0→2.260.0(root resolution +amplify-data-constructandamplify-graphql-api-constructmanifests), withconstructs10.3.0→10.5.0. This is the driver behind the changes below.aws-cdk-lib 2.260 collateral fixes
aws-cdk-lib(as of 2.252) renamed the privateglobalSecondaryIndexes/localSecondaryIndexesarrays on the DynamoDB L2Tableto_globalSecondaryIndexes/_localSecondaryIndexes(nowArrayBoxes exposing the samefind/somesurface and element shape). Reading the old names threw aTypeError. Updated to read the renamed field first with a fallback to the public name (Amplify's managed-table construct keeps the public arrays) in:amplify-graphql-relational-transformer/src/resolvers.tsamplify-graphql-transformer-core/src/utils/schema-utils.tsamplify-graphql-conversation-transformer/src/transformer-steps/conversation-resolver-generator.tsaws-cdk-lib@2.224.0→aws-cdk-lib@2.260.0.reverse.ts(test-only): converted the Lambda handler from callback-style toasync.Runtime.NODEJS_LATESTresolves tonodejs24.xfrom 2.260, which dropped support for callback-style handlers.aws-cdkCLI~2.1101.0→~2.1129.0(cloud-assembly schema 54 compatibility withaws-cdk-lib2.260),aws-cdk-lib~2.224.0→~2.260.0,constructs^10.3.0→^10.5.0.Regenerated
.jsii,yarn.lockfiles, anddependency_licenses.txtaccordingly.Test plan