Skip to content

Commit 350cbb4

Browse files
committed
Polish qhelp and libraries
1 parent f9b244e commit 350cbb4

File tree

5 files changed

+9
-15
lines changed

5 files changed

+9
-15
lines changed

python/ql/src/experimental/Security/CWE-347/JWTEmptyKeyOrAlgorithm.qhelp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ empty key. Both examples leave the payload insecurely encoded.
2727
<li>Python-Jose: <a href="https://github.com/mpdavis/python-jose">Documentation</a>.</li>
2828
<li>Auth0 Blog: <a href="https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/#Meet-the--None--Algorithm">Meet the "None" Algorithm</a>.</li>
2929
</references>
30-
</qhelp>
30+
</qhelp>

python/ql/src/experimental/Security/CWE-347/JWTMissingSecretOrPublicKeyVerification.qhelp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ argument set to <code>False</code>.
2727
<li>Authlib JWT: <a href="https://docs.authlib.org/en/latest/specs/rfc7519.html">Documentation</a>.</li>
2828
<li>Python-Jose: <a href="https://github.com/mpdavis/python-jose">Documentation</a>.</li>
2929
</references>
30-
</qhelp>
30+
</qhelp>

python/ql/src/experimental/semmle/python/libraries/Authlib.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ private import semmle.python.ApiGraphs
44
private import experimental.semmle.python.frameworks.JWT
55

66
private module Authlib {
7-
/** Gets a reference to `authlib.jose` */
8-
private API::Node authlib() { result = API::moduleImport("authlib.jose") }
9-
107
/** Gets a reference to `authlib.jose.(jwt|JsonWebToken)` */
118
private API::Node authlibJWT() {
12-
result in [authlib().getMember("jwt"), authlib().getMember("JsonWebToken").getReturn()]
9+
result in [
10+
API::moduleImport("authlib.jose").getMember("jwt"),
11+
API::moduleImport("authlib.jose").getMember("JsonWebToken").getReturn()
12+
]
1313
}
1414

1515
/** Gets a reference to `jwt.encode` */

python/ql/src/experimental/semmle/python/libraries/PyJWT.qll

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ private import semmle.python.ApiGraphs
44
private import experimental.semmle.python.frameworks.JWT
55

66
private module PyJWT {
7-
/** Gets a reference to `jwt` */
8-
private API::Node pyjwt() { result = API::moduleImport("jwt") }
9-
107
/** Gets a reference to `jwt.encode` */
11-
private API::Node pyjwtEncode() { result = pyjwt().getMember("encode") }
8+
private API::Node pyjwtEncode() { result = API::moduleImport("jwt").getMember("encode") }
129

1310
/** Gets a reference to `jwt.decode` */
14-
private API::Node pyjwtDecode() { result = pyjwt().getMember("decode") }
11+
private API::Node pyjwtDecode() { result = API::moduleImport("jwt").getMember("decode") }
1512

1613
// def encode(self, payload, key, algorithm="HS256", headers=None, json_encoder=None)
1714
private class PyJWTEncodeCall extends DataFlow::CallCfgNode, JWTEncoding::Range {

python/ql/src/experimental/semmle/python/libraries/PythonJose.qll

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ private import semmle.python.ApiGraphs
44
private import experimental.semmle.python.frameworks.JWT
55

66
private module PythonJose {
7-
/** Gets a reference to `jose` */
8-
private API::Node jose() { result = API::moduleImport("jose") }
9-
107
/** Gets a reference to `jwt` */
11-
private API::Node joseJWT() { result = jose().getMember("jwt") }
8+
private API::Node joseJWT() { result = API::moduleImport("jose").getMember("jwt") }
129

1310
/** Gets a reference to `jwt.encode` */
1411
private API::Node joseJWTEncode() { result = joseJWT().getMember("encode") }

0 commit comments

Comments
 (0)