Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP egress type validation #1989

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

cjus
Copy link
Collaborator

@cjus cjus commented Jan 10, 2025

No description provided.

Copy link

vercel bot commented Jan 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
framework-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 22, 2025 7:49pm
framework-landing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 22, 2025 7:49pm
moose-logs-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 22, 2025 7:49pm
moose-product-analytics ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 22, 2025 7:49pm

@cjus cjus marked this pull request as draft January 10, 2025 05:22
}

res.setHeader("Content-Type", "application/json");
res.end(JSON.stringify(response));

Check warning

Code scanning / CodeQL

Information exposure through a stack trace Medium

This information exposed to the user depends on
stack trace information
.

Copilot Autofix AI about 1 month ago

To fix the problem, we need to ensure that stack trace information is not exposed to the client, even in a development environment. Instead, we should log the stack trace on the server and send a generic error message to the client. This can be achieved by modifying the error handling code to exclude the stack trace from the response and only include a generic error message.

Suggested changeset 1
packages/ts-moose-lib/src/consumption-apis/runner.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/ts-moose-lib/src/consumption-apis/runner.ts b/packages/ts-moose-lib/src/consumption-apis/runner.ts
--- a/packages/ts-moose-lib/src/consumption-apis/runner.ts
+++ b/packages/ts-moose-lib/src/consumption-apis/runner.ts
@@ -310,3 +310,3 @@
               details:
-                process.env.NODE_ENV === "development" ? error : undefined,
+                process.env.NODE_ENV === "development" ? error.message : undefined,
             },
@@ -319,2 +319,3 @@
         logToConsole(`apiHandler: Response: ${JSON.stringify(response)}`);
+        logToConsole(`Stack trace: ${error instanceof Error ? error.stack : String(error)}`);
         return;
EOF
@@ -310,3 +310,3 @@
details:
process.env.NODE_ENV === "development" ? error : undefined,
process.env.NODE_ENV === "development" ? error.message : undefined,
},
@@ -319,2 +319,3 @@
logToConsole(`apiHandler: Response: ${JSON.stringify(response)}`);
logToConsole(`Stack trace: ${error instanceof Error ? error.stack : String(error)}`);
return;
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
…eUsers?limit=1'

{"success":true,"data":[{"date":"2024-04-02","dailyActiveUsers":"1"}]}%
➜  test-typia git:(main) ✗ curl 'localhost:4000/consumption/dailyActiveUsers?limit=asdf'
{"success":false,"error":{"code":"INTERNAL_ERROR","message":"LIMIT numeric constant expression is not representable as UInt64. "}}%                                                                             ➜  test-typia git:(main) ✗
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.

2 participants