GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Refactor CWE-502/UnsafeDeserialization · github/codeql@e5f11d0

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • java/ql
    • lib/semmle/code/java
      • frameworks
        • JsonIo.qll
      • security
        • UnsafeDeserializationQuery.qll
    • src/Security/CWE/CWE-502
      • UnsafeDeserialization.ql
    • test/query-tests/security/CWE-502
      • UnsafeDeserialization.ql
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎java/ql/lib/semmle/code/java/frameworks/JsonIo.qll‎

Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/java/frameworks/JsonIo.qll
+33-2Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@ class JsonIoUseMapsSetter extends MethodAccess {
4242
}
4343
}
4444

45-
/** A data flow configuration tracing flow from JsonIo safe settings. */
46-
class SafeJsonIoConfig extends DataFlow2::Configuration {
45+
/**
46+
* DEPRECATED: Use `SafeJsonIoFlow` instead.
47+
*
48+
* A data flow configuration tracing flow from JsonIo safe settings.
49+
*/
50+
deprecated class SafeJsonIoConfig extends DataFlow2::Configuration {
4751
SafeJsonIoConfig() { this = "UnsafeDeserialization::SafeJsonIoConfig" }
4852

4953
override predicate isSource(DataFlow::Node src) {
@@ -65,3 +69,30 @@ class SafeJsonIoConfig extends DataFlow2::Configuration {
6569
)
6670
}
6771
}
72+
73+
/**
74+
* A data flow configuration tracing flow from JsonIo safe settings.
75+
*/
76+
module SafeJsonIoConfig implements DataFlow::ConfigSig {
77+
predicate isSource(DataFlow::Node src) {
78+
exists(MethodAccess ma |
79+
ma instanceof JsonIoUseMapsSetter and
80+
src.asExpr() = ma.getQualifier()
81+
)
82+
}
83+
84+
predicate isSink(DataFlow::Node sink) {
85+
exists(MethodAccess ma |
86+
ma.getMethod() instanceof JsonIoJsonToJavaMethod and
87+
sink.asExpr() = ma.getArgument(1)
88+
)
89+
or
90+
exists(ClassInstanceExpr cie |
91+
cie.getConstructor().getDeclaringType() instanceof JsonIoJsonReader and
92+
sink.asExpr() = cie.getArgument(1)
93+
)
94+
}
95+
}
96+
97+
/** Tracks flow from JsonIo safe settings. */
98+
module SafeJsonIoFlow = DataFlow::Global<SafeJsonIoConfig>;

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.