Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Prev Previous commit
Next Next commit
clean tests
  • Loading branch information
am0o0 committed Sep 19, 2023
commit 21369291646feda459ff4b588a3560f6e6186599
25 changes: 9 additions & 16 deletions go/ql/lib/semmle/go/security/JWT.qll
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ class GolangJwtParseFromRequest extends Function {
exists(DataFlow::Function f |
f.hasQualifiedName([
"github.com/golang-jwt/jwt/request", "github.com/golang-jwt/jwt/v4/request",
"github.com/dgrijalva/jwt-go/request", "github.com/golang-jwt/jwt/v4/request",
"github.com/dgrijalva/jwt-go/v5/request"
"github.com/dgrijalva/jwt-go/request", "github.com/dgrijalva/jwt-go/v4/request"
], "ParseFromRequest")
|
this = f
Expand All @@ -125,8 +124,7 @@ class GolangJwtParseFromRequestWithClaims extends Function {
exists(DataFlow::Function f |
f.hasQualifiedName([
"github.com/golang-jwt/jwt/request", "github.com/golang-jwt/jwt/v4/request",
"github.com/dgrijalva/jwt-go/request", "github.com/golang-jwt/jwt/v4/request",
"github.com/dgrijalva/jwt-go/v5/request"
"github.com/dgrijalva/jwt-go/request", "github.com/dgrijalva/jwt-go/v4/request"
], "ParseFromRequestWithClaims")
|
this = f
Expand Down Expand Up @@ -181,13 +179,17 @@ class GoJoseUnsafeClaims extends Function {
predicate golangJwtIsAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
exists(DataFlow::Function f, DataFlow::CallNode call |
f.hasQualifiedName([
"github.com/golang-jwt/jwt", "github.com/golang-jwt/jwt/v4", "github.com/golang-jwt/jwt/v5",
"github.com/dgrijalva/jwt-go", "github.com/dgrijalva/jwt-go/v4"
"github.com/golang-jwt/jwt", "github.com/golang-jwt/jwt/v4", "github.com/golang-jwt/jwt/v5"
],
[
"ParseECPrivateKeyFromPEM", "ParseECPublicKeyFromPEM", "ParseEdPrivateKeyFromPEM",
"ParseEdPublicKeyFromPEM", "ParseRSAPrivateKeyFromPEM", "ParseRSAPublicKeyFromPEM",
"RegisterSigningMethod"
]) or
f.hasQualifiedName(["github.com/dgrijalva/jwt-go", "github.com/dgrijalva/jwt-go/v4"],
[
"ParseECPrivateKeyFromPEM", "ParseECPublicKeyFromPEM", "ParseRSAPrivateKeyFromPEM",
"ParseRSAPrivateKeyFromPEMWithPassword", "ParseRSAPublicKeyFromPEM"
])
Comment thread
am0o0 marked this conversation as resolved.
Outdated
|
call = f.getACall() and
Expand All @@ -211,15 +213,6 @@ predicate golangJwtIsAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node
)
}

predicate test(DataFlow::Function f, DataFlow::CallNode call) {
f.hasQualifiedName([
"gopkg.in/square/go-jose/jwt", "gopkg.in/square/go-jose.v2/jwt",
"gopkg.in/square/go-jose.v3/jwt", "github.com/go-jose/go-jose/jwt",
"github.com/go-jose/go-jose/v3/jwt"
], ["ParseEncrypted", "ParseSigned",]) and
call = f.getACall().getArgument(0)
}

predicate goJoseIsAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
exists(DataFlow::Function f, DataFlow::CallNode call |
f.hasQualifiedName([
Expand Down Expand Up @@ -253,7 +246,7 @@ predicate goJoseIsAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nod
"gopkg.in/square/go-jose.v2/jwt.NestedJSONWebToken",
"gopkg.in/square/go-jose.v3/jwt.NestedJSONWebToken",
"github.com/go-jose/go-jose/jwt.NestedJSONWebToken",
"github.com/go-jose/go-jose/v3/jw.NestedJSONWebTokent"
"github.com/go-jose/go-jose/v3/jw.NestedJSONWebToken"
], "Decrypt")
|
call = f.getACall() and
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading