Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix QLDoc
  • Loading branch information
am0o0 committed Sep 19, 2023
commit da864bf7f7f7094306f1e76455c518636a49c8f6
27 changes: 26 additions & 1 deletion go/ql/lib/semmle/go/security/JWT.qll
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import go

/**
* A class that contains the following function and method:
*
* func (p *Parser) Parse(tokenString string, keyFunc Keyfunc)
*
* func Parse(tokenString string, keyFunc Keyfunc)
*/
class GolangJwtParse extends Function {
Expand Down Expand Up @@ -33,7 +36,10 @@ class GolangJwtParse extends Function {
}

/**
* A class that contains the following function and method:
*
* func (p *Parser) Parse(tokenString string, keyFunc Keyfunc)
*
* func Parse(tokenString string, keyFunc Keyfunc)
*/
class GolangJwtValidField extends DataFlow::FieldReadNode {
Expand All @@ -48,7 +54,10 @@ class GolangJwtValidField extends DataFlow::FieldReadNode {
}

/**
* A class that contains the following function and method:
*
* func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc)
*
* func ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc)
*/
class GolangJwtParseWithClaims extends Function {
Expand Down Expand Up @@ -80,6 +89,8 @@ class GolangJwtParseWithClaims extends Function {
}

/**
* A class that contains the following method:
*
* func (p *Parser) ParseUnverified(tokenString string, claims Claims)
*/
class GolangJwtParseUnverified extends Function {
Expand All @@ -97,6 +108,8 @@ class GolangJwtParseUnverified extends Function {
}

/**
* A class that contains the following function:
*
* func ParseFromRequest(req *http.Request, extractor Extractor, keyFunc jwt.Keyfunc, options ...ParseFromRequestOption)
*/
class GolangJwtParseFromRequest extends Function {
Expand All @@ -117,6 +130,8 @@ class GolangJwtParseFromRequest extends Function {
}

/**
* A class that contains the following function:
*
* func ParseFromRequestWithClaims(req *http.Request, extractor Extractor, claims jwt.Claims, keyFunc jwt.Keyfunc)
*/
class GolangJwtParseFromRequestWithClaims extends Function {
Expand All @@ -137,6 +152,8 @@ class GolangJwtParseFromRequestWithClaims extends Function {
}

/**
* A class that contains the following method:
*
*func (t *JSONWebToken) Claims(key interface{}, dest ...interface{})
*/
class GoJoseClaims extends Function {
Expand All @@ -159,7 +176,9 @@ class GoJoseClaims extends Function {
}

/**
* func (t *JSONWebToken) UnsafeClaimsWithoutVerification(dest ...interface{})
* A class that contains the following method:
*
* func (t *JSONWebToken) UnsafeClaimsWithoutVerification(dest ...interface{})
*/
class GoJoseUnsafeClaims extends Function {
GoJoseUnsafeClaims() {
Expand All @@ -176,6 +195,9 @@ class GoJoseUnsafeClaims extends Function {
}
}

/**
* Holds if there are additioanl steps related to parsing the secret keys
*/
predicate golangJwtIsAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
exists(DataFlow::Function f, DataFlow::CallNode call |
f.hasQualifiedName([
Expand Down Expand Up @@ -213,6 +235,9 @@ predicate golangJwtIsAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node
)
}

/**
* Holds if there are additioanl steps related to parsing the secret keys
*/
predicate goJoseIsAdditionalFlowStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
exists(DataFlow::Function f, DataFlow::CallNode call |
f.hasQualifiedName([
Expand Down