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

[exception] v3 - do not serialize stack by default #873

Merged
merged 6 commits into from
Jan 6, 2024

Conversation

belgattitude
Copy link
Owner

@belgattitude belgattitude commented Jan 6, 2024

Stack traces won't be serialized anymore by default as they might contain sensitive information in production.

For development or logging, it's possible to opt-in stack serialization selectively in convertToSerializable, createFromSerializable, toJson and fromJson functions thanks to the SerializerParams.includeStack param.

import { fromJson, toJson } from '@httpx/exception';

const json = toJson(new HttpException(500), {
  includeStack: process.env.NODE_ENV === 'development',
});

const e = fromJson(json, {
  includeStack: process.env.NODE_ENV === 'development',
});

Copy link

changeset-bot bot commented Jan 6, 2024

🦋 Changeset detected

Latest commit: a09327d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@httpx/exception Major
@examples/nextjs-app Patch
prisma-exception Patch
@httpx/json-api Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ghost
Copy link

ghost commented Jan 6, 2024

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

Copy link

codecov bot commented Jan 6, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (6a5dd98) 93.13% compared to head (a09327d) 92.90%.
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #873      +/-   ##
==========================================
- Coverage   93.13%   92.90%   -0.23%     
==========================================
  Files          96       96              
  Lines         670      677       +7     
  Branches      188      193       +5     
==========================================
+ Hits          624      629       +5     
- Misses         40       42       +2     
  Partials        6        6              
Flag Coverage Δ
httpx-assert-unit 91.47% <ø> (ø)
httpx-dsn-parser-unit 100.00% <ø> (ø)
httpx-exception-unit 95.51% <94.44%> (-0.49%) ⬇️
httpx-json-api-unit 65.30% <ø> (ø)
Files Coverage Δ
packages/exception/src/serializer/json/fromJson.ts 71.42% <100.00%> (ø)
packages/exception/src/serializer/json/toJson.ts 75.00% <100.00%> (ø)
...ion/src/serializer/mapper/convertToSerializable.ts 95.65% <100.00%> (+0.19%) ⬆️
...on/src/serializer/mapper/createFromSerializable.ts 88.37% <92.85%> (-3.52%) ⬇️

@belgattitude belgattitude merged commit 62332de into main Jan 6, 2024
10 of 11 checks passed
@belgattitude belgattitude deleted the feat-do-not-serialize-stack-by-default branch January 6, 2024 13:44
@belgattitude belgattitude mentioned this pull request Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant