浏览代码

SONAR-12370 Prevent potential vulnerability with web API api/l10n/index

tags/8.0
Simon Brandhof 4 年前
父节点
当前提交
09534faa71

+ 1
- 1
server/sonar-server/src/main/java/org/sonar/server/platform/ws/IndexAction.java 查看文件

@@ -71,7 +71,7 @@ public class IndexAction implements WsAction {
}
String localeParam = request.mandatoryParam(LOCALE_PARAM);
Locale locale = Locale.forLanguageTag(localeParam);
checkArgument(!locale.getISO3Language().isEmpty(), "'%s' cannot be parsed as a BCP47 language tag", localeParam);
checkArgument(!locale.getISO3Language().isEmpty(), "Locale cannot be parsed as a BCP47 language tag");

try (JsonWriter json = response.newJsonWriter()) {
json.beginObject();

+ 1
- 1
server/sonar-server/src/test/java/org/sonar/server/platform/ws/IndexActionTest.java 查看文件

@@ -134,7 +134,7 @@ public class IndexActionTest {
when(i18n.getEffectiveLocale(UK)).thenReturn(UK);

expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("'en_GB' cannot be parsed as a BCP47 language tag");
expectedException.expectMessage("Locale cannot be parsed as a BCP47 language tag");
call("en_GB", null);
}


正在加载...
取消
保存