[*] Security: use AuCodepointsReplaceAll instead of AuReplaceAll under the loggers mitigations
This commit is contained in:
parent
ba36ea4ef1
commit
30b89f1bd7
@ -300,14 +300,17 @@ namespace Aurora::Logging
|
|||||||
{
|
{
|
||||||
if (this->bEnableMitigations)
|
if (this->bEnableMitigations)
|
||||||
{
|
{
|
||||||
|
// Nuke \r and \x1b / \33 / \e sequences using UTF-8 aware replaceall
|
||||||
|
// \r -> dont let a bad actor override cat and unformatted console logs
|
||||||
|
// \e -> dont let a bad actor communicate with a potentially vulnerable TTY emulator
|
||||||
if (msg.line.find('\r') != AuString::npos) [[unlikely]]
|
if (msg.line.find('\r') != AuString::npos) [[unlikely]]
|
||||||
{
|
{
|
||||||
AuReplaceAll(msg.line, "\r", "\\r");
|
AuCodepointsReplaceAll(msg.line, "\r", "\\r");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.line.find('\33') != AuString::npos) [[unlikely]]
|
if (msg.line.find('\33') != AuString::npos) [[unlikely]]
|
||||||
{
|
{
|
||||||
AuReplaceAll(msg.line, "\33", "\\e");
|
AuCodepointsReplaceAll(msg.line, "\33", "\\e");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user