Repository navigation
Stop publishing the codegen node_modules - #30
Conversation
The 0.34.0 codegen pinned exact, now outdated @aws-sdk/* versions in the generated clients (@aws-sdk/core 3.856.0 brings a vulnerable fast-xml-parser). 0.54.0 emits a handful of caret ranges on current @aws-sdk/core and @smithy/core instead of ~40 packages. It is built against Smithy 1.73.0, so smithy-aws-traits (and the CLI used in CI) follows. The new schema-based serde reads error bodies itself and only surfaces a JSON SyntaxError for cloudserver's XML errors, so the custom error handler now sits inside the deserializer and maps XML/HTML error responses from the raw response. The generated *FilterSensitiveLog helpers are gone; nothing uses them. Issue: CLDSRVCLT-19
The package listed each typescript-codegen directory wholesale in `files`, so their node_modules got published too: ~400 MB installed, including build-only tools and an old @aws-sdk/core pulling a vulnerable fast-xml-parser. Consumers could not de-duplicate any of it, and yarn audit / osv did not see it either, only image scanners did. The generated clients now resolve their runtime dependencies from the root package.json, which declares them, and the package only ships each client's package.json and dist-* output. The build drops the nested node_modules once the clients are compiled so nothing resolves from there by accident. Issue: CLDSRVCLT-19
Packaging regressions have slipped through twice now: 1.0.10 shipped without the generated clients, 1.0.12 with their node_modules. Neither showed up in our tests, which run from the repository. CI now packs the build, rejects it if it contains node_modules, installs it in a scratch consumer with production dependencies only, and checks the package and each generated client load, can send a request and type-check. The release workflow runs the same check on the tarball it publishes. Issue: CLDSRVCLT-19
The generated clients load their dependencies from our package.json, and the set they need changes with the Smithy codegen version. A codegen bump that adds a dependency would otherwise only break consumers at runtime. The build now checks every dependency of the generated package.json files is declared at the root, and prints the `yarn add` line to fix it. Issue: CLDSRVCLT-19
Hello francoisferrand,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
a831e8c to
373cce1
Compare
The error middleware had to wrap the deserializer and rebuild exceptions by hand from the raw response. Parsing these bodies in the protocol instead hands them to the SDK's own error handling, so modeled errors come back as their generated classes with their header members, the same as for JSON responses. createCustomErrorMiddleware is removed: nothing outside this package uses it. Issue: CLDSRVCLT-19
373cce1 to
285f806
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
| npm install --omit=dev --ignore-scripts --no-audit --no-fund --silent "$TARBALL" | ||
| node smoke.js | ||
|
|
||
| npm install --no-save --ignore-scripts --no-audit --no-fund --silent typescript @types/node@20 |
There was a problem hiding this comment.
Should this be node@24 ? And so in package json also node >= 24
There was a problem hiding this comment.
the packge is usable from node@20, and used in both node@22 and node@24. So should not move package.json to >= 24 just yet.
Bumping to node22/24 will come in followup PR
SylvainSenechal
left a comment
There was a problem hiding this comment.
Should we consider node >= 24 instead of 20 ?
The last commit says release 1.1.13, but the code bumps to 1.0.13 and the targeted branch is dev/1.0, I think we wanna go with 1.1.13, right ?
Issue: CLDSRVCLT-19
285f806 to
fb6dd25
Compare
|
/approve |
|
I have successfully merged the changeset of this pull request
Please check the status of the associated issue CLDSRVCLT-19. Goodbye francoisferrand. The following options are set: approve |
1.0.12 publishes each Smithy
typescript-codegendirectory wholesale, including itsnode_modules. That comes to ~400 MB installed, with build-only tools and an old@aws-sdk/corethat brings a vulnerable fast-xml-parser. Consumers (cloudserver, backbeat) can't de-duplicate any of it, and only image scanners like trivy notice it.What changes:
@aws-sdk/coreand@smithy/core, instead of ~40 exact, outdated pins. The new serde no longer keeps error bodies, so the custom error handler now sits inside the deserializer. It turns cloudserver's XML errors and the S3C proxy's HTML errors into exceptions using the raw response.package.json, and the package only ships each client'spackage.jsonanddist-*. No morenode_modules.node_modulesin the tarball, and installs it into a scratch consumer with prod deps only. It then checks that the package and each generated client load, send a request and type-check. The release workflow runs the same check on the tarball it publishes.Local results:
trivy reports no findings on the installed consumer after the change.
The version isn't bumped here. Once this lands, releasing 1.0.13 and bumping it in cloudserver and backbeat will remove the nested trees from their images.
Issue: CLDSRVCLT-19