-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
BE: Make it possible to hide stacktraces in HTTP responses #536 #537
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi mrlittle113! 👋
Welcome, and thank you for opening your first PR in the repo!
Please wait for triaging by our maintainers.
Please take a look at our contributing guide.
@@ -19,3 +19,7 @@ logging: | |||
reactor.netty.http.server.AccessLog: INFO | |||
org.hibernate.validator: WARN | |||
|
|||
web: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than setting it to false here, let's define a default state for the property:
@Value("${web.exception.include.stacktrace:false}")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, look much better!
return ServerResponse | ||
.status(exception.getStatusCode()) | ||
.contentType(MediaType.APPLICATION_JSON) | ||
.bodyValue(response); | ||
} | ||
|
||
private String getStackTrace(Throwable exception) { | ||
if (!includeStacktraceInException) { | ||
return ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A dummy value like Redacted for security reasons
might be better, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, look much better!
@@ -35,6 +36,9 @@ | |||
@Order(Ordered.HIGHEST_PRECEDENCE) | |||
public class GlobalErrorWebExceptionHandler extends AbstractErrorWebExceptionHandler { | |||
|
|||
@Value("${web.exception.include.stacktrace}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add this property into our contracts, so it could be changed in UI via wizard?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you hind me where to put the config on.
I saw that DynamicConfigOperations load config from DYNAMIC_CONFIG_PATH_ENV_PROPERTY which will be overridden on each configuration submission through UI wizard.
And from README I saw that can enable the dynamic through DYNAMIC_CONFIG_ENABLED: 'true' on docker compose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @Haarolean, could you help me with this.
Can you hind me where to put the config on.
I saw that DynamicConfigOperations load config from DYNAMIC_CONFIG_PATH_ENV_PROPERTY which will be overridden on each configuration submission through UI wizard.
And from README I saw that can enable the dynamic through DYNAMIC_CONFIG_ENABLED: 'true' on docker compose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can put it temporarily wherever you wish for testing purposes, I like to put mine into /tmp
.
which will be overridden on each configuration submission through UI wizard
You have to pass it separately as an arg, like mentioned here: docker run -it -p 8080:8080 -e spring.config.additional-location=/tmp/config.yml -v /tmp/kui/config.yml:/tmp/config.yml ghcr.io/kafbat/kafka-ui
(or an equivalent for a jar file).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I will try it out
What changes did you make? (Give an overview)
Create a flag in application.yml to enable or disable stacktrace include in error responses
Is there anything you'd like reviewers to focus on?
Where to put the config on, this is my first PR so I am not familiar with the project structure!
How Has This Been Tested? (put an "x" (case-sensitive!) next to an item)
Checklist (put an "x" (case-sensitive!) next to all the items, otherwise the build will fail)
Check out Contributing and Code of Conduct
A picture of a cute animal (not mandatory but encouraged)