Skip to content

Commit

Permalink
Merge pull request Checkmarx#7057 from Checkmarx/AST-40742
Browse files Browse the repository at this point in the history
fix(query): implicit flow in oauth2 queries duplicated
  • Loading branch information
cx-andrep authored Jun 11, 2024
2 parents f384835 + ddfa8be commit e83ddfc
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 340 deletions.
11 changes: 0 additions & 11 deletions assets/queries/openAPI/3.0/implicit_flow_oauth2/metadata.json

This file was deleted.

21 changes: 0 additions & 21 deletions assets/queries/openAPI/3.0/implicit_flow_oauth2/query.rego

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

12 changes: 6 additions & 6 deletions assets/queries/openAPI/3.0/oauth2_with_implicit_flow/query.rego
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
package Cx

import data.generic.openapi as openapi_lib
import data.generic.common as common_lib

CxPolicy[result] {
doc := input.document[i]
openapi_lib.check_openapi(doc) == "3.0"

security_scheme := doc.components.securitySchemes[name]
security_scheme := doc.components.securitySchemes[key]
security_scheme.type == "oauth2"
flow := security_scheme.flows[flow_object]
flow_object == "implicit"
common_lib.valid_key(security_scheme.flows, "implicit")

result := {
"documentId": doc.id,
"searchKey": sprintf("components.securitySchemes.{{%s}}.flows.implicit", [name]),
"searchKey": sprintf("components.securitySchemes.{{%s}}.flows.implicit", [key]),
"issueType": "IncorrectValue",
"keyExpectedValue": sprintf("components.securitySchemes.{{%s}}.flows do not contain an 'implicit' flow", [name]),
"keyActualValue": sprintf("components.securitySchemes.{{%s}}.flows contain an 'implicit' flow", [name]),
"keyExpectedValue": sprintf("components.securitySchemes.{{%s}}.flows should not use 'implicit' flow", [key]),
"keyActualValue": sprintf("components.securitySchemes.{{%s}}.flows is using 'implicit' flow", [key]),
}
}
Loading

0 comments on commit e83ddfc

Please sign in to comment.