This PR fixes an issue allowing any payload to be sent as message to the remote logging system.
This is mostly related to the fact that rejected promises can contain any value, thus by blindly logging the event.reason of the PromiseRejectionEvent we risk to push non-string values to the remote logging system
This could also occur in the future, by logging values that have been typed as any (which would defeat the type checking), therefore the guard is place inside the RemoteLogger
Changes
log stacktraces when Errors are logged
stringify non-string messages before pushing them
handle undefined messages
How Has This Been Tested?
manually
unit tests
Log entry to be sent to the remote logging system, in case of an uncaught axios error:
PR Quality Checklist
[x] I added tests to new or existing code
[ ] I removed hardcoded strings and used our i18n solution instead (see here)
[ ] I made sure no sensitive info gets logged at any time in the codebase (see here) (e.g. no user info or details, no stacktraces, etc.)
[ ] I checked that infrastructure/update_infrastructure.sh runs without any error
[x] I checked that npm run build builds without any error
[x] I checked that clusters are listed correctly
[ ] I checked that a new cluster can be created (config is produced and dry run passes)
[ ] I checked that login and logout work as expected
Description
This PR fixes an issue allowing any payload to be sent as message to the remote logging system.
This is mostly related to the fact that rejected promises can contain any value, thus by blindly logging the
event.reason
of thePromiseRejectionEvent
we risk to push non-string values to the remote logging systemThis could also occur in the future, by logging values that have been typed as
any
(which would defeat the type checking), therefore the guard is place inside theRemoteLogger
Changes
How Has This Been Tested?
Log entry to be sent to the remote logging system, in case of an uncaught axios error:
PR Quality Checklist
i18n
solution instead (see here)npm run build
builds without any errorIn order to increase the likelihood of your contribution being accepted, please make sure you have read both the Contributing Guidelines and the Project Guidelines
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.