From 0420d25c13ebe80bf267ed9b7cd8d698c68ff4d9 Mon Sep 17 00:00:00 2001 From: Kevin Stubbings Date: Mon, 26 Aug 2024 22:09:24 -0700 Subject: [PATCH] refactor --- python/ql/lib/semmle/python/Concepts.qll | 2 +- .../lib/semmle/python/frameworks/FastApi.qll | 32 ++++++++++--------- .../semmle/python/frameworks/Starlette.qll | 22 ++++++------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/python/ql/lib/semmle/python/Concepts.qll b/python/ql/lib/semmle/python/Concepts.qll index 5d9ac3d9e126..d981f82c1bcd 100644 --- a/python/ql/lib/semmle/python/Concepts.qll +++ b/python/ql/lib/semmle/python/Concepts.qll @@ -1425,7 +1425,7 @@ module Http { string middleware_name() { result = super.middleware_name() } /** - * Gets the dataflow node corresponding to the allowed CORS origins + * Gets the dataflow node corresponding to the allowed CORS origins */ DataFlow::Node allowed_origins() { result = super.allowed_origins() } diff --git a/python/ql/lib/semmle/python/frameworks/FastApi.qll b/python/ql/lib/semmle/python/frameworks/FastApi.qll index c3bf25d43e96..24a25b867519 100644 --- a/python/ql/lib/semmle/python/frameworks/FastApi.qll +++ b/python/ql/lib/semmle/python/frameworks/FastApi.qll @@ -43,30 +43,32 @@ module FastApi { * A call to `app.add_middleware` adding CORSMiddleware. */ class AddCorsMiddlewareCall extends Http::Server::CorsMiddleware::Range, AddMiddlewareCall { - /** - * Gets the string corresponding to the middleware - */ + /** + * Gets the string corresponding to the middleware + */ override string middleware_name() { result = this.getArg(0).asExpr().(Name).toString() } /** - * Gets the dataflow node corresponding to the allowed CORS origins - */ + * Gets the dataflow node corresponding to the allowed CORS origins + */ override DataFlow::Node allowed_origins() { result = this.getArgByName("allow_origins") } - /** - * Gets the boolean value corresponding to if CORS credentials is enabled - * (`true`) or disabled (`false`) by this node. - */ + + /** + * Gets the boolean value corresponding to if CORS credentials is enabled + * (`true`) or disabled (`false`) by this node. + */ override DataFlow::Node allowed_credentials() { result = this.getArgByName("allow_credentials") } - /** - * Gets the dataflow node corresponding to the allowed CORS methods - */ + + /** + * Gets the dataflow node corresponding to the allowed CORS methods + */ DataFlow::Node allowed_methods() { result = this.getArgByName("allow_methods") } - /** - * Gets the dataflow node corresponding to the allowed CORS headers - */ + /** + * Gets the dataflow node corresponding to the allowed CORS headers + */ DataFlow::Node allowed_headers() { result = this.getArgByName("allow_headers") } } diff --git a/python/ql/lib/semmle/python/frameworks/Starlette.qll b/python/ql/lib/semmle/python/frameworks/Starlette.qll index 404084c3e369..bd963fa7fe29 100644 --- a/python/ql/lib/semmle/python/frameworks/Starlette.qll +++ b/python/ql/lib/semmle/python/frameworks/Starlette.qll @@ -27,8 +27,6 @@ private import semmle.python.frameworks.data.ModelsAsData module Starlette { /** * Provides models for the `starlette.app` class - * - * */ module App { /** Gets import of `starlette.app`. */ @@ -53,10 +51,9 @@ module Starlette { * A call to any of the execute methods on a `app.add_middleware` with CORSMiddleware. */ class AddCorsMiddlewareCall extends AddMiddlewareCall, Http::Server::CorsMiddleware::Range { - - /** - * Gets the string corresponding to the middleware - */ + /** + * Gets the string corresponding to the middleware + */ override string middleware_name() { result = this.getArg(0).asExpr().(Name).toString() } override DataFlow::Node allowed_origins() { result = this.getArgByName("allow_origins") } @@ -64,14 +61,15 @@ module Starlette { override DataFlow::Node allowed_credentials() { result = this.getArgByName("allow_credentials") } - /** - * Gets the dataflow node corresponding to the allowed CORS methods - */ + + /** + * Gets the dataflow node corresponding to the allowed CORS methods + */ DataFlow::Node allowed_methods() { result = this.getArgByName("allow_methods") } - /** - * Gets the dataflow node corresponding to the allowed CORS headers - */ + /** + * Gets the dataflow node corresponding to the allowed CORS headers + */ DataFlow::Node allowed_headers() { result = this.getArgByName("allow_headers") } }