Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,24 @@ abstract class JSVFA
}
}

trait CopyFromSessionTag extends RuleAction {

def apply(
sootMethod: SootMethod,
invokeStmt: jimple.Stmt,
localDefs: SimpleLocalDefs
) = {
/**
* TO-DO
* Implement logic here
*/
}
}

/**
* Core Code
*/

def createSceneTransform(): (String, Transform) =
("wjtp", new Transform("wjtp.svfa", new Transformer()))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ trait DSL {
rule sessionMethods =
if NamedMethodRule(className: "javax.servlet.http.HttpSession", methodName: "getAttribute")
then [
CopyFromMethodCallToLocal()
CopyFromMethodCallToLocal(),
CopyFromSessionTag()
]

rule skipNativeMethods = if NativeRule() then DoNothing()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,15 @@ class LanguageParser(val jsvfa: JSVFA) extends RegexParsers {
_.toString
}

def COPY_FROM_SESSION_TAG: Parser[String] =
"""CopyFromSessionTag""".r ^^ {
_.toString
}

def ACTIONS: Parser[String] =
DO_NOTHING | COPY_BETWEEN_ARGS |
COPY_FROM_METHOD_ARGUMENT_TO_BASE_OBJECT | COPY_FROM_METHOD_CALL_TO_LOCAL |
COPY_FROM_METHOD_ARGUMENT_TO_LOCAL ^^ {
COPY_FROM_METHOD_ARGUMENT_TO_LOCAL | COPY_FROM_SESSION_TAG ^^ {
_.toString
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class RuleFactory(val jsvfa: JSVFA) {
case "CopyFromMethodCallToLocal" =>
ruleActions =
ruleActions ++ List(new jsvfa.CopyFromMethodCallToLocal {})
case "CopyFromSessionTag" =>
ruleActions =
ruleActions ++ List(new jsvfa.CopyFromSessionTag {})
case _ =>
ruleActions = ruleActions ++ List(new DoNothing {})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@ class SecuribenchTestSuite extends FunSuite {
/** SESSION TESTs
*/

ignore(
test(
"in the class Session1 we should detect 1 conflict of a simple session test case"
) {
val testName = "Session1"
Expand All @@ -1191,6 +1191,7 @@ class SecuribenchTestSuite extends FunSuite {
val svfa =
new SecuribenchTest(s"securibench.micro.session.$testName", "doGet")
svfa.buildSparseValueFlowGraph()
// println(svfa.svgToDotModel())
assert(svfa.reportConflictsSVG().size == expectedConflicts)
}

Expand Down
Loading