Skip to content

Commit bf3af40

Browse files
committed
Remove the functionality to allow any user specified deserializer - it is pointed out that it may be possible for a properly constructed deserializer to execute arbitrary code. See https://github.com/stanfordnlp/CoreNLP/security/advisories/GHSA-wv35-hv9v-526p
1 parent 346259c commit bf3af40

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/edu/stanford/nlp/pipeline/StanfordCoreNLPServer.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,10 @@ private Annotation getDocument(Properties props, HttpExchange httpExchange) thro
333333
return annotation;
334334
case "serialized":
335335
String inputSerializerName = props.getProperty("inputSerializer", ProtobufAnnotationSerializer.class.getName());
336-
AnnotationSerializer serializer = MetaClass.create(inputSerializerName).createInstance();
336+
if (!inputSerializerName.equals(ProtobufAnnotationSerializer.class.getName())) {
337+
throw new IOException("Specifying an inputSerializer other than ProtobufAnnotationSerializer is now deprecated for security reasons. See https://github.com/stanfordnlp/CoreNLP/security/advisories/GHSA-wv35-hv9v-526p If you have need for a different class, please post about your use case on the CoreNLP github.");
338+
}
339+
AnnotationSerializer serializer = new ProtobufAnnotationSerializer();
337340
Pair<Annotation, InputStream> pair = serializer.read(httpExchange.getRequestBody());
338341
return pair.first;
339342
default:

0 commit comments

Comments
 (0)