코딩하는 털보

21.10.18 TIL 본문

Diary/Today I Learned

21.10.18 TIL

이정인 2021. 11. 1. 16:31

XSS filter에서 사용한 HTMLCharacterEscapes와 이모지

사용하던 HTMLCharacterEscapes에 의해 이모지가 입력되면 데이터를 역직렬화 할 때 아래와 같은 에러가 발생했다.

Could not write JSON: Unmatched first part of surrogate pair (0xd83d)

getEscapeSequence 메서드에서 분기하여 우회할 수 있다.

@Override
public SerializableString getEscapeSequence(int ch) {
    SerializableString serializedString;
    char charAt = (char) ch;
    if (Character.isHighSurrogate(charAt) || Character.isLowSurrogate(charAt)) {
        StringBuilder sb = new StringBuilder();
        sb.append("\\u");
        sb.append(String.format("%04x",ch));
        serializedString = new SerializedString(sb.toString());
    } else {
        serializedString = new SerializedString(StringEscapeUtils.escapeHtml4(Character.toString(charAt)));
    }
    return serializedString;
}

Jmeter 사용해보기

Mac jmeter 설치

[/Users/ijeong-in]> brew install jmeter

실행

[/Users/ijeong-in]> jmeter
WARNING: package sun.awt.X11 not in java.desktop
================================================================================
Don't use GUI mode for load testing !, only for Test creation and Test debugging.
For load testing, use CLI Mode (was NON GUI):
   jmeter -n -t [jmx file] -l [results file] -e -o [Path to web report folder]
& increase Java Heap to meet your test requirements:
   Modify current env variable HEAP="-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m" in the jmeter batch file
Check : https://jmeter.apache.org/usermanual/best-practices.html
================================================================================
2021-10-22 15:11:35.353 java[62561:10761497] TSM AdjustCapsLockLEDForKeyTransitionHandling - _ISSetPhysicalKeyboardCapsLockLED Inhibit
Comments