From 9335e095a92bf3ef83ec094dc884ec8fcea0aac6 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Fri, 19 Mar 2021 17:44:45 +0000 Subject: [PATCH] MIME type -> content type This matches the terminology used elsewhere --- java/ql/src/semmle/code/java/frameworks/JaxWS.qll | 10 +++++----- java/ql/src/semmle/code/java/security/XSS.qll | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/java/ql/src/semmle/code/java/frameworks/JaxWS.qll b/java/ql/src/semmle/code/java/frameworks/JaxWS.qll index a8c1478ed84..330124004c5 100644 --- a/java/ql/src/semmle/code/java/frameworks/JaxWS.qll +++ b/java/ql/src/semmle/code/java/frameworks/JaxWS.qll @@ -255,19 +255,19 @@ class MessageBodyReaderRead extends Method { } } -/** An `@Produces` annotation that describes which MIME types can be produced by this resource. */ +/** An `@Produces` annotation that describes which content types can be produced by this resource. */ class JaxRSProducesAnnotation extends JaxRSAnnotation { JaxRSProducesAnnotation() { getType().hasQualifiedName("javax.ws.rs", "Produces") } /** - * Gets a declared MIME type that can be produced by this resource. + * Gets a declared content type that can be produced by this resource. */ - string getADeclaredMimeType() { + string getADeclaredContentType() { result = getAValue().(CompileTimeConstantExpr).getStringValue() or exists(Field jaxMediaType | // Accesses to static fields on `MediaType` class do not have constant strings in the database - // so convert the field name to a mime type string + // so convert the field name to a content type string jaxMediaType.getDeclaringType().hasQualifiedName("javax.ws.rs.core", "MediaType") and jaxMediaType.getAnAccess() = getAValue() and // e.g. MediaType.TEXT_PLAIN => text/plain @@ -276,7 +276,7 @@ class JaxRSProducesAnnotation extends JaxRSAnnotation { } } -/** An `@Consumes` annotation that describes MIME types can be consumed by this resource. */ +/** An `@Consumes` annotation that describes content types can be consumed by this resource. */ class JaxRSConsumesAnnotation extends JaxRSAnnotation { JaxRSConsumesAnnotation() { getType().hasQualifiedName("javax.ws.rs", "Consumes") } } diff --git a/java/ql/src/semmle/code/java/security/XSS.qll b/java/ql/src/semmle/code/java/security/XSS.qll index e0a15753334..471dd8a9124 100644 --- a/java/ql/src/semmle/code/java/security/XSS.qll +++ b/java/ql/src/semmle/code/java/security/XSS.qll @@ -102,7 +102,7 @@ private class DefaultXssSink extends XssSink { | not exists(resourceMethod.getProducesAnnotation()) or - resourceMethod.getProducesAnnotation().getADeclaredMimeType() = "text/plain" + resourceMethod.getProducesAnnotation().getADeclaredContentType() = "text/plain" ) } }