Skip to content

Commit

Permalink
refactor language module (#1251)
Browse files Browse the repository at this point in the history
* refactor language module

* more refactor

* refactor in test cases

* remove deprecated module
  • Loading branch information
khemrajrathore authored Aug 19, 2024
1 parent dcd4b3d commit d2b9591
Show file tree
Hide file tree
Showing 86 changed files with 193 additions and 247 deletions.
2 changes: 1 addition & 1 deletion src/main/scala/ai/privado/audit/DataElementDiscovery.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ai.privado.cache.TaggerCache
import ai.privado.dataflow.Dataflow
import ai.privado.model.Language.Language
import ai.privado.model.{CatLevelOne, Constants, InternalTag, Language}
import ai.privado.semantic.Language.*
import ai.privado.semantic.language.*
import io.shiftleft.codepropertygraph.generated.Cpg
import io.shiftleft.codepropertygraph.generated.nodes.*
import io.shiftleft.semanticcpg.language.*
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/ai/privado/audit/DependencyReport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ai.privado.audit
import ai.privado.audit.DependencyReport.getClass
import ai.privado.languageEngine.java.cache.DependencyModuleCache
import ai.privado.languageEngine.java.cache.DependencyModuleCache.RuleCategoryInfo
import ai.privado.languageEngine.java.language.module.{NodeStarters, StepsForModule}
import ai.privado.semantic.language.*
import io.shiftleft.codepropertygraph.generated.Cpg
import io.shiftleft.codepropertygraph.generated.nodes.{Dependency, ModuleDependency}
import io.shiftleft.semanticcpg.language._
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/ai/privado/audit/LiteralReport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ai.privado.audit

import io.shiftleft.codepropertygraph.generated.Cpg

import ai.privado.languageEngine.java.language.NodeStarters
import ai.privado.semantic.language.*
import scala.collection.mutable.ListBuffer
import io.shiftleft.semanticcpg.language._
import org.slf4j.LoggerFactory
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/ai/privado/cache/DataFlowCache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import ai.privado.model.exporter.{
DataFlowSubCategoryPathIntermediateModel
}
import ai.privado.model.DataFlowPathModel
import ai.privado.semantic.Language.finder
import ai.privado.semantic.language.finder
import io.joern.dataflowengineoss.language.Path
import io.shiftleft.semanticcpg.language._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import ai.privado.model.exporter.{
AndroidPermissionModel,
DataFlowSubCategoryPathExcerptModel
}
import ai.privado.semantic.Language.NodeStarterForAndroidXmlPermissionNode
import ai.privado.semantic.language.*
import io.shiftleft.codepropertygraph.generated.nodes.*
import io.shiftleft.semanticcpg.language.*
import org.slf4j.LoggerFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import io.shiftleft.semanticcpg.language.*
import org.slf4j.LoggerFactory
import overflowdb.traversal.Traversal
import io.shiftleft.semanticcpg.language.*
import ai.privado.semantic.Language.*
import ai.privado.semantic.language.*

import scala.collection.mutable
import scala.collection.mutable.ListBuffer
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/ai/privado/exporter/ExporterUtility.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ import ai.privado.model.exporter.CollectionEncoderDecoder.*
import ai.privado.model.exporter.AndroidPermissionsEncoderDecoder.*
import ai.privado.model.exporter.SinkEncoderDecoder.*
import ai.privado.model.exporter.PropertyNodesEncoderDecoder.*
import ai.privado.semantic.Language.{NodeStarterForSqlQueryNode, finder}
import ai.privado.semantic.language.*
import io.shiftleft.codepropertygraph.generated.{Cpg, Languages, NodeTypes}
import ai.privado.utility.Utilities
import ai.privado.utility.Utilities.{dump, getTruncatedText}
import ai.privado.tagger.sink.SinkArgumentUtility
import io.shiftleft.codepropertygraph.generated.nodes.*
import ai.privado.languageEngine.java.language.*
import ai.privado.semantic.*
import better.files.File
import io.circe.Json
import io.circe.syntax.EncoderOps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
package ai.privado.exporter

import ai.privado.cache.{AppCache, RuleCache}
import ai.privado.semantic.Language.*
import ai.privado.languageEngine.java.language.*
import ai.privado.semantic.language.*
import ai.privado.semantic.*
import io.shiftleft.codepropertygraph.generated.Cpg
import org.slf4j.LoggerFactory
import ai.privado.model.{Constants, Language}
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/ai/privado/exporter/JSONExporter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ import scala.concurrent.*
import scala.language.postfixOps
import scala.util.{Failure, Success, Try}
import io.shiftleft.semanticcpg.language.*
import ai.privado.languageEngine.java.language.{NodeStarters, StepsForProperty}
import ai.privado.semantic.language.*
object JSONExporter {

private val logger = LoggerFactory.getLogger(getClass)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ai.privado.cache.RuleCache
import scala.collection.mutable
import io.shiftleft.codepropertygraph.generated.Cpg
import io.shiftleft.semanticcpg.language.*
import ai.privado.languageEngine.java.language.NodeStarters
import ai.privado.semantic.language.*
import ai.privado.model.Constants

import scala.collection.immutable.HashMap
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/ai/privado/exporter/SinkExporter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import ai.privado.entrypoint.{PrivadoInput, ScanProcessor}
import ai.privado.languageEngine.default.NodeStarters
import ai.privado.model.exporter.{DataFlowSubCategoryModel, SinkModel, SinkProcessingModel}
import ai.privado.model.exporter.DataFlowEncoderDecoder.*
import ai.privado.semantic.Language.*
import ai.privado.semantic.language.*
import ai.privado.model.{CatLevelOne, Constants, DatabaseDetails, InternalTag, NodeType}
import ai.privado.utility.Utilities
import io.shiftleft.codepropertygraph.generated.{Cpg, nodes}
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/ai/privado/exporter/SourceExporter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import ai.privado.tagger.utility.SourceTaggerUtility.getFilteredSourcesByTagging
import ai.privado.utility.Utilities
import io.shiftleft.codepropertygraph.generated.Cpg
import io.shiftleft.codepropertygraph.generated.nodes.{AstNode, Tag}
import ai.privado.semantic.Language.*
import ai.privado.semantic.language.*
import io.shiftleft.semanticcpg.language.*
import overflowdb.traversal.Traversal
import io.joern.dataflowengineoss.language.Path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import ai.privado.model.Constants.*
import ai.privado.model.Language.Language
import ai.privado.model.{CpgWithOutputMap, Language}
import ai.privado.passes.ExperimentalLambdaDataFlowSupportPass
import ai.privado.semantic.Language.*
import ai.privado.semantic.language.*
import ai.privado.tagger.PrivadoParallelCpgPass
import ai.privado.utility.{PropertyParserPass, StatsRecorder, UnresolvedReportUtility}
import io.circe.Json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import ai.privado.model.Constants.*
import ai.privado.model.Language.Language
import ai.privado.model.{CatLevelOne, Constants, CpgWithOutputMap, Language}
import ai.privado.passes.*
import ai.privado.semantic.Language.*
import ai.privado.semantic.language.*
import ai.privado.utility.Utilities.createCpgFolder
import ai.privado.utility.{PropertyParserPass, StatsRecorder}
import better.files.File
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ai.privado.cache.DataFlowCache
import ai.privado.model.{CatLevelOne, Constants, DataFlowPathModel, InternalTag, NodeType}
import io.joern.dataflowengineoss.language.Path
import io.shiftleft.codepropertygraph.generated.Cpg
import ai.privado.semantic.Language.*
import ai.privado.semantic.language.*
import ai.privado.languageEngine.default.*
import io.shiftleft.semanticcpg.language.*

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package ai.privado.languageEngine.default.passes

import ai.privado.cache.RuleCache
import ai.privado.languageEngine.java.language.NodeStarters
import ai.privado.semantic.language.*
import ai.privado.tagger.PrivadoParallelCpgPass
import io.shiftleft.codepropertygraph.generated.Cpg
import io.shiftleft.codepropertygraph.generated.nodes.JavaProperty
import overflowdb.traversal.ImplicitsTmp.toTraversalSugarExt
import ai.privado.languageEngine.java.language.StepsForProperty
import io.shiftleft.codepropertygraph.generated.traversal.{FileTraversalExtGen, toFileTraversalExtGen}

class PropertyVerificationPass(cpg: Cpg) extends PrivadoParallelCpgPass[JavaProperty](cpg) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import ai.privado.audit.AuditReportEntryPoint
import ai.privado.cache.*
import ai.privado.dataflow.Dataflow
import ai.privado.entrypoint.ScanProcessor.config
import ai.privado.entrypoint.{PrivadoInput}
import ai.privado.entrypoint.PrivadoInput
import ai.privado.languageEngine.base.processor.BaseProcessor
import ai.privado.languageEngine.go.passes.SQLQueryParser
import ai.privado.languageEngine.go.passes.config.GoYamlLinkerPass
import ai.privado.languageEngine.go.passes.orm.ORMParserPass
import ai.privado.languageEngine.go.semantic.Language.tagger
import ai.privado.languageEngine.java.language.*
import ai.privado.semantic.*
import ai.privado.model.Constants.*
import ai.privado.model.{CatLevelOne, Constants, CpgWithOutputMap, Language}
import ai.privado.passes.*
import ai.privado.semantic.Language.*
import ai.privado.semantic.language.*
import ai.privado.utility.Utilities.createCpgFolder
import ai.privado.utility.{PropertyParserPass, StatsRecorder}
import io.joern.gosrc2cpg.{Config, GoSrc2Cpg}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
package ai.privado.languageEngine.go.tagger.config

import ai.privado.cache.DatabaseDetailsCache
import ai.privado.languageEngine.java.language.NodeStarters
import ai.privado.semantic.language.*
import ai.privado.tagger.PrivadoDBConfigBaseTagger
import io.shiftleft.codepropertygraph.generated.Cpg
import org.slf4j.LoggerFactory
Expand Down

This file was deleted.

108 changes: 0 additions & 108 deletions src/main/scala/ai/privado/languageEngine/java/language/package.scala

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

package ai.privado.languageEngine.java.passes.config

import ai.privado.languageEngine.java.language.NodeStarters
import ai.privado.semantic.language.*
import ai.privado.tagger.PrivadoParallelCpgPass
import io.shiftleft.codepropertygraph.generated.nodes.*
import io.shiftleft.codepropertygraph.generated.{Cpg, EdgeTypes}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import ai.privado.model.Constants.*
import ai.privado.model.Language.Language
import ai.privado.model.{CatLevelOne, Constants, CpgWithOutputMap, Language}
import ai.privado.passes.*
import ai.privado.semantic.Language.*
import ai.privado.semantic.language.*
import ai.privado.tagger.PrivadoParallelCpgPass
import ai.privado.utility.Utilities.createCpgFolder
import ai.privado.utility.{PropertyParserPass, StatsRecorder, UnresolvedReportUtility}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ai.privado.languageEngine.java.tagger

import ai.privado.tagger.S3BaseTagger
import ai.privado.cache.{DatabaseDetailsCache, S3DatabaseDetailsCache}
import ai.privado.languageEngine.java.language.NodeStarters
import ai.privado.semantic.language.*
import ai.privado.model.DatabaseDetails
import io.shiftleft.codepropertygraph.generated.{Cpg, Languages, Operators}
import org.slf4j.LoggerFactory
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ai.privado.languageEngine.java.tagger.config

import ai.privado.cache.DatabaseDetailsCache
import ai.privado.languageEngine.java.language.NodeStarters
import ai.privado.semantic.language.*
import ai.privado.tagger.PrivadoDBConfigBaseTagger
import ai.privado.utility.Utilities.addDatabaseDetailsMultiple
import io.shiftleft.codepropertygraph.generated.Cpg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import ai.privado.cache.{AppCache, RuleCache}
import ai.privado.dataflow.DuplicateFlowProcessor
import ai.privado.entrypoint.{PrivadoInput, ScanProcessor}
import ai.privado.model.{Constants, RuleInfo}
import ai.privado.languageEngine.java.language.*
import ai.privado.semantic.language.*
import ai.privado.languageEngine.java.semantic.JavaSemanticGenerator
import ai.privado.utility.Utilities
import ai.privado.utility.Utilities.{addRuleTags, getDomainFromString, storeForTag}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ai.privado.model.{Constants, InternalTag, NodeType, RuleInfo}
import ai.privado.tagger.PrivadoParallelCpgPass
import io.shiftleft.codepropertygraph.generated.Cpg
import io.shiftleft.semanticcpg.language.*
import ai.privado.languageEngine.java.language.*
import ai.privado.semantic.*
import ai.privado.languageEngine.java.tagger.sink.api.Utility.tagAPICallByItsUrlMethod
import ai.privado.tagger.utility.APITaggerUtility.{
getLiteralCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ package ai.privado.languageEngine.java.tagger.sink.api

import ai.privado.cache.{AppCache, FileLinkingMetadata, RuleCache}
import ai.privado.entrypoint.{PrivadoInput, ScanProcessor}
import ai.privado.languageEngine.java.language.*
import ai.privado.semantic.language.*
import ai.privado.languageEngine.java.semantic.JavaSemanticGenerator
import ai.privado.languageEngine.java.tagger.Utility.{GRPCTaggerUtility, SOAPTaggerUtility}
import ai.privado.languageEngine.java.tagger.sink.FeignAPI
Expand Down
Loading

0 comments on commit d2b9591

Please sign in to comment.