Skip to content

Commit

Permalink
Fix formatting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Dattaprasad Mundada authored and Dattaprasad Mundada committed Mar 26, 2024
1 parent 22ecd13 commit 0a8e4e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/main/scala/ai/privado/exporter/ProbableSinkExporter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ProbableSinkExporter(cpg: Cpg, ruleCache: RuleCache, repoPath: String, rep
getProbableSinkForJavascript(repoPath)
} else if (isRuby) {
getProbableSinkForRuby(repoPath)
} else if (isPHP){
} else if (isPHP) {
val composerDep = getProbableSinkForPHP(repoPath)
composerDep ++ getProbableSinkBasedOnTaggedMethods(isPython, isGoLang)
} else {
Expand Down Expand Up @@ -64,8 +64,8 @@ class ProbableSinkExporter(cpg: Cpg, ruleCache: RuleCache, repoPath: String, rep

for (path <- packageJsonFilePaths) {
val packageJsonStr = scala.io.Source.fromFile(path).mkString
val json = parse(packageJsonStr).getOrElse(Json.Null)
val dependencies = json.hcursor.downField("require").as[Map[String, String]].getOrElse(Map.empty)
val json = parse(packageJsonStr).getOrElse(Json.Null)
val dependencies = json.hcursor.downField("require").as[Map[String, String]].getOrElse(Map.empty)
uniqueDeps ++= dependencies.keySet
}
uniqueDeps.toList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ import scala.jdk.CollectionConverters.CollectionHasAsScala
import java.util.Calendar

class APITagger(cpg: Cpg, ruleCache: RuleCache, privadoInput: PrivadoInput)
extends PrivadoParallelCpgPass[RuleInfo](cpg) {
private val logger = LoggerFactory.getLogger(this.getClass)
val cacheCall: List[Call] = cpg.call.where(_.nameNot(Operators.ALL.asScala.toSeq: _*)).l
extends PrivadoParallelCpgPass[RuleInfo](cpg) {
private val logger = LoggerFactory.getLogger(this.getClass)
val cacheCall: List[Call] = cpg.call.where(_.nameNot(Operators.ALL.asScala.toSeq: _*)).l
val constructNameCall: List[Call] = cacheCall.where(_.name("__construct")).l

val APISINKS_REGEX: String = ruleCache.getSystemConfigByKey(Constants.apiSinks)

val apis: List[Call] = cacheCall.name("(?i)" + APISINKS_REGEX).l
val constructApis: List[Call] = constructNameCall.where(_.methodFullName("(?i).*" + APISINKS_REGEX + "(->)__construct")).l
val constructApis: List[Call] =
constructNameCall.where(_.methodFullName("(?i).*" + APISINKS_REGEX + "(->)__construct")).l

MetricHandler.metricsData("apiTaggerVersion") = Json.fromString("Common HTTP Libraries Used")
implicit val engineContext: EngineContext = Utilities.getEngineContext(privadoInput, 4)
Expand Down

0 comments on commit 0a8e4e2

Please sign in to comment.