diff --git a/core/src/test/scala/com/microsoft/azure/synapse/ml/Secrets.scala b/core/src/test/scala/com/microsoft/azure/synapse/ml/Secrets.scala index cac166f64f..9ede008c58 100644 --- a/core/src/test/scala/com/microsoft/azure/synapse/ml/Secrets.scala +++ b/core/src/test/scala/com/microsoft/azure/synapse/ml/Secrets.scala @@ -71,5 +71,4 @@ object Secrets { lazy val ServiceConnectionSecret: String = getSecret("service-connection-secret") lazy val ServicePrincipalClientId: String = getSecret("service-principal-clientId") - lazy val SecretRegexpFile: String = getSecret("secret-regexp-file") } diff --git a/src/test/scala/com/microsoft/azure/synapse/ml/core/test/fuzzing/FuzzingTest.scala b/src/test/scala/com/microsoft/azure/synapse/ml/core/test/fuzzing/FuzzingTest.scala index e9a9ba0354..23e9dba612 100644 --- a/src/test/scala/com/microsoft/azure/synapse/ml/core/test/fuzzing/FuzzingTest.scala +++ b/src/test/scala/com/microsoft/azure/synapse/ml/core/test/fuzzing/FuzzingTest.scala @@ -382,56 +382,6 @@ class FuzzingTest extends TestBase { } } - test("Scan codebase for secrets") { - val excludedFiles = List( - ".png", - ".jpg", - ".jpeg") - val excludedDirs = List( - ".git", - ".idea", - "target", - ".docusaurus", - "node_modules", - s"website${File.separator}build" - ) - - val regexps: List[Regex] = using(Source.fromURL(Secrets.SecretRegexpFile)) { s => - s.getLines().toList.map(_.r) - }.get - - val allFiles = Files.walk(BuildInfo.baseDirectory.getParentFile.toPath) - .iterator().asScala.map(_.toFile) - .filterNot(f => excludedDirs.exists(dir => f.toString.contains(dir))) - .toList - - val nameIssues = allFiles.flatMap { - case f if regexps.flatMap(_.findFirstMatchIn(f.toString)).nonEmpty => - Some(s"Bad file name: ${f.toString}") - case _ => - None - } - val contentsIssue = allFiles.filter(_.isFile) - .filterNot(f => excludedFiles.exists(end => f.toString.endsWith(end))) - .flatMap { f => - println(f) - try { - val lines = using(Source.fromFile(f)) { s => s.getLines().toList }.get - lines.zipWithIndex.flatMap { case (l, i) => - if (regexps.flatMap(_.findFirstMatchIn(l)).nonEmpty) { - Some(s"Line $i of file ${f.toString} contains secrets") - } else { - None - } - } - } catch { - case _: MalformedInputException => List() - } - } - val allIssues = nameIssues ++ contentsIssue - assert(allIssues.isEmpty, allIssues.mkString("\n")) - } - private def assertOrLog(condition: Boolean, hint: String = "", disableFailure: Boolean = disableFailure): Unit = { if (disableFailure && !condition) println(hint)