Skip to content

Commit

Permalink
Remove irrelevant vulnerabilities from ifds output (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
volivan239 authored Jul 28, 2023
1 parent 3030af2 commit c5aa437
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ class IfdsResult(
}
is PredecessorKind.Unknown -> {
addEdge(pred.predEdge.v, lastVertex)
if (pred.predEdge.u == pred.predEdge.v && !stopAtMethodStart) {
sources.add(pred.predEdge.v)
} else { // Turning point
if (pred.predEdge.u != pred.predEdge.v) {
// TODO: ideally, we should analyze the place from which the edge was given to ifds,
// for now we just go to method start
dfs(IfdsEdge(pred.predEdge.u, pred.predEdge.u), pred.predEdge.v, stopAtMethodStart)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ val defaultBannedPackagePrefixes: List<String> = listOf(
"java.",
"jdk.internal.",
"sun.",
"javax.",
)
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ private class NpeForwardFunctions(

val thisInstance = method.thisInstance

// Possibly null fields
// Possibly null public non-final fields
result += method.enclosingClass.fields
.filter { it.isNullable != false && !it.isStatic }
.filter { it.isNullable != false && !it.isStatic && it.isPublic && !it.isFinal }
.map {
NpeTaintNode(
AccessPath.fromOther(AccessPath.fromLocal(thisInstance), listOf(FieldAccessor(it)))
Expand Down
4 changes: 2 additions & 2 deletions jacodb-cli/src/main/kotlin/org/jacodb/cli/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import org.jacodb.api.JcClassOrInterface
import org.jacodb.api.JcClassProcessingTask
import org.jacodb.api.JcMethod
import org.jacodb.api.analysis.JcApplicationGraph
import org.jacodb.api.ext.methods
import org.jacodb.impl.features.InMemoryHierarchy
import org.jacodb.impl.features.Usages
import org.jacodb.impl.jacodb
Expand Down Expand Up @@ -144,8 +145,7 @@ fun main(args: Array<String>) {
}
}
}).get()
val startJcMethods = startJcClasses.flatMap { it.declaredMethods }

val startJcMethods = startJcClasses.flatMap { it.methods }.filter { it.isPublic }

val graph = runBlocking {
cp.newApplicationGraphForAnalysis()
Expand Down

0 comments on commit c5aa437

Please sign in to comment.