Skip to content

Fix TS builds, Lambda Runtime, Add Array input support, and fix tests#2

Open
deldrid1 wants to merge 9 commits into
kdy1:masterfrom
deldrid1:master
Open

Fix TS builds, Lambda Runtime, Add Array input support, and fix tests#2
deldrid1 wants to merge 9 commits into
kdy1:masterfrom
deldrid1:master

Conversation

@deldrid1

Copy link
Copy Markdown

Hi - I ran into some issues when attempting to use this with @trpc/server v11, and after digging in was impressed anything was working at all given the number of TypeScript issues!

I'm not 100% sure that I have everything exactly right, but tests are passing now and its working for my use case.

@socket-security

socket-security Bot commented Sep 12, 2024

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednext@​13.4.3 ⏵ 13.5.662 -22594 +15070
Updatedeslint@​8.41.0 ⏵ 8.57.09710010050100
Updatedeslint-config-next@​13.4.3 ⏵ 13.5.69910065 +198100
Updatedjest@​29.5.0 ⏵ 29.7.01001006889 -3100
Updated@​types/​uuid@​9.0.1 ⏵ 9.0.81001006981100
Updated@​typescript-eslint/​parser@​5.59.7 ⏵ 5.62.01001007098100
Updated@​types/​swagger-ui-express@​4.1.3 ⏵ 4.1.61001007080100
Updated@​types/​express@​4.17.17 ⏵ 4.17.211001007183100
Updatedeslint-config-prettier@​8.8.0 ⏵ 8.10.0100 +110072 +187100
Updated@​types/​jsonwebtoken@​9.0.2 ⏵ 9.0.61001007380100
Updated@​types/​node-fetch@​2.6.4 ⏵ 2.6.11100 +11007381100
Updated@​types/​react-dom@​18.2.4 ⏵ 18.3.0100 +110075 +185100
Updatedh3@​1.6.6 ⏵ 1.12.0987588 -1291100
Updated@​types/​jest@​29.5.1 ⏵ 29.5.121001007780100
Updated@​types/​aws-lambda@​8.10.115 ⏵ 8.10.145100 +11007889100
Updated@​typescript-eslint/​eslint-plugin@​5.59.7 ⏵ 5.62.099 +110079 +198100
Updated@​types/​react@​18.2.6 ⏵ 18.3.5100 +110079 +195100
Updated@​types/​co-body@​6.1.0 ⏵ 6.1.310010084 -280100
Updatednextjs-cors@​2.1.2 ⏵ 2.2.010010090 +180 +2100
Updated@​types/​swagger-ui-react@​4.18.0 ⏵ 4.18.310010087 -380100
Updated@​types/​cors@​2.8.13 ⏵ 2.8.1710010091 -180100
Updatedopenapi-schema-validator@​12.1.1 ⏵ 12.1.31001009680 +3100
Updatedopenapi-types@​12.1.1 ⏵ 12.1.31001008580100
Updatednode-mocks-http@​1.12.2 ⏵ 1.16.09910010080100
Updatedjsonwebtoken@​9.0.0 ⏵ 9.0.299100100 +181 -3100
Updated@​types/​node@​20.2.3 ⏵ 20.16.51001008196100
Updatedts-node@​10.9.1 ⏵ 10.9.29610010082100
Updatedfastify@​4.17.0 ⏵ 4.28.199 +18310090100
Updatedserverless@​3.31.0 ⏵ 3.39.083 -210010097 +5100
Updatedeslint-plugin-promise@​6.1.1 ⏵ 6.6.010010010083100
Updatedrimraf@​5.0.1 ⏵ 5.0.108710010083100
Updatedco-body@​6.1.0 ⏵ 6.2.01001009483100
Updatedeslint-plugin-import@​2.27.5 ⏵ 2.30.098 +1110010083100
See 16 more rows in the dashboard

View full report

@deldrid1

deldrid1 commented Sep 12, 2024

Copy link
Copy Markdown
Author

I did have to remove the nuxt example due to some peer dependency issues (I think the @next branch of @trpc/client isn't up to date with the fact that trpc-nuxt has a v11 beta which is frustrating...)

@socket-security

socket-security Bot commented Sep 12, 2024

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn Critical
Critical CVE: npm fast-xml-parser has an entity encoding bypass via regex injection in DOCTYPE entity names

CVE: GHSA-m7jm-9gc2-mpf2 fast-xml-parser has an entity encoding bypass via regex injection in DOCTYPE entity names (CRITICAL)

Affected versions: >= 5.0.0 < 5.3.5; >= 4.1.3 < 4.5.4

Patched version: 4.5.4

From: package-lock.jsonnpm/serverless@3.39.0npm/serverless-offline@12.0.4npm/fast-xml-parser@4.4.1

ℹ Read more on: This package | This alert | What is a critical CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/fast-xml-parser@4.4.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm @aws-sdk/client-lambda is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: package-lock.jsonnpm/serverless@3.39.0npm/serverless-offline@12.0.4npm/@aws-sdk/client-lambda@3.650.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@aws-sdk/client-lambda@3.650.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm @emnapi/runtime is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: ?npm/nuxt@3.21.8npm/@emnapi/runtime@1.11.1

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@emnapi/runtime@1.11.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm @swagger-api/apidom-parser-adapter-openapi-json-2 is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: package-lock.jsonnpm/swagger-ui-react@4.19.1npm/@swagger-api/apidom-parser-adapter-openapi-json-2@1.0.0-alpha.9

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@swagger-api/apidom-parser-adapter-openapi-json-2@1.0.0-alpha.9. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm @ungap/structured-clone is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: package-lock.jsonnpm/eslint@8.57.0npm/@ungap/structured-clone@1.2.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@ungap/structured-clone@1.2.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm aws-sdk is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: package-lock.jsonnpm/serverless@3.39.0npm/aws-lambda@1.0.7npm/aws-sdk@2.1691.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/aws-sdk@2.1691.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm axios is 82.0% likely obfuscated

Confidence: 0.82

Location: Package overview

From: package-lock.jsonnpm/serverless@3.39.0npm/swagger-ui-react@4.19.1npm/axios@1.7.7

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/axios@1.7.7. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm css-tree is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: ?npm/nuxt@3.21.8npm/css-tree@3.2.1

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/css-tree@3.2.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Protestware or unwanted behavior: npm es5-ext

Note: The script attempts to run a local post-install script, which could potentially contain malicious code. The error handling suggests that it is designed to fail silently, which is a common tactic in malicious scripts.

From: package-lock.jsonnpm/serverless@3.39.0npm/serverless-offline@12.0.4npm/es5-ext@0.10.64

ℹ Read more on: This package | This alert | What is protestware?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Consider that consuming this package may come along with functionality unrelated to its primary purpose.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/es5-ext@0.10.64. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm eslint-plugin-react is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: package-lock.jsonnpm/eslint-config-next@13.5.6npm/eslint-plugin-react@7.36.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/eslint-plugin-react@7.36.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm node-fetch-native is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: ?npm/nuxt@3.21.8npm/node-fetch-native@1.6.7

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/node-fetch-native@1.6.7. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm node-forge is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: ?npm/nuxt@3.21.8npm/node-forge@1.4.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/node-forge@1.4.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm powershell-utils is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: ?npm/nuxt@3.21.8npm/powershell-utils@0.1.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/powershell-utils@0.1.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm rimraf is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: package-lock.jsonnpm/rimraf@5.0.10

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/rimraf@5.0.10. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm seroval is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: ?npm/nuxt@3.21.8npm/seroval@1.5.5

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/seroval@1.5.5. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

Comment thread package.json
"examples/with-interop",
"examples/with-serverless",
"examples/with-fastify",
"examples/with-nuxtjs"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is removal of with-nuxtjs intentional?

@deldrid1 deldrid1 Sep 13, 2024

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with-fastify wasn't, but nuxt was. See the comment up above

Unfortunately, there are some peer dependency issues that prevented me from getting that one going. Rather than have npm install problems, I opted to just take it out here for the time being.

@kdy1 kdy1 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Thank you!

Comment thread src/adapters/node-http/input.ts Outdated
path: queryPath,
procedure,
});
if(procedure._def.type === "mutation" || procedure._def.type === "query" ){

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to exclude subscriptions from the cache. Is it your intention?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some comments about the intention?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think WebSockets or Server-sent Events (SSE) are being properly handled by openapi-trpc? Happy to revert this if you don't think its a valid change.

Comment thread src/types.ts
import type { RootConfig } from '@trpc/server/dist/core/internals/config';
import { TRPC_ERROR_CODE_KEY } from '@trpc/server/rpc';
import type { RouterDef } from '@trpc/server/src/core/router';
import type { APIGatewayProxyEvent, APIGatewayProxyEventV2 } from 'aws-lambda';

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an import of aws-lambda should be moved to non-shared file.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its a type import so nothing runtime is affected - its only used during TypeScript builds of the project and is a devDependency. Can you justify the additional complexity of simply not listing it here?

deldrid1 and others added 2 commits September 18, 2024 16:33
Co-authored-by: Donny/강동윤 <kdy1997.dev@gmail.com>
@deldrid1 deldrid1 changed the title Fix TS builds, Lambda Runtime, and tests Fix TS builds, Lambda Runtime, Add Array input support, and fix tests Sep 18, 2024
@kdy1 kdy1 closed this Sep 21, 2024
@kdy1 kdy1 reopened this Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants