Skip to content

Commit c6d5882

Browse files
authored
chore: remove secret scanner (microsoft#2048)
1 parent 8f794c8 commit c6d5882

File tree

2 files changed

+0
-51
lines changed

2 files changed

+0
-51
lines changed

core/src/test/scala/com/microsoft/azure/synapse/ml/Secrets.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,4 @@ object Secrets {
7171
lazy val ServiceConnectionSecret: String = getSecret("service-connection-secret")
7272
lazy val ServicePrincipalClientId: String = getSecret("service-principal-clientId")
7373

74-
lazy val SecretRegexpFile: String = getSecret("secret-regexp-file")
7574
}

src/test/scala/com/microsoft/azure/synapse/ml/core/test/fuzzing/FuzzingTest.scala

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -382,56 +382,6 @@ class FuzzingTest extends TestBase {
382382
}
383383
}
384384

385-
test("Scan codebase for secrets") {
386-
val excludedFiles = List(
387-
".png",
388-
".jpg",
389-
".jpeg")
390-
val excludedDirs = List(
391-
".git",
392-
".idea",
393-
"target",
394-
".docusaurus",
395-
"node_modules",
396-
s"website${File.separator}build"
397-
)
398-
399-
val regexps: List[Regex] = using(Source.fromURL(Secrets.SecretRegexpFile)) { s =>
400-
s.getLines().toList.map(_.r)
401-
}.get
402-
403-
val allFiles = Files.walk(BuildInfo.baseDirectory.getParentFile.toPath)
404-
.iterator().asScala.map(_.toFile)
405-
.filterNot(f => excludedDirs.exists(dir => f.toString.contains(dir)))
406-
.toList
407-
408-
val nameIssues = allFiles.flatMap {
409-
case f if regexps.flatMap(_.findFirstMatchIn(f.toString)).nonEmpty =>
410-
Some(s"Bad file name: ${f.toString}")
411-
case _ =>
412-
None
413-
}
414-
val contentsIssue = allFiles.filter(_.isFile)
415-
.filterNot(f => excludedFiles.exists(end => f.toString.endsWith(end)))
416-
.flatMap { f =>
417-
println(f)
418-
try {
419-
val lines = using(Source.fromFile(f)) { s => s.getLines().toList }.get
420-
lines.zipWithIndex.flatMap { case (l, i) =>
421-
if (regexps.flatMap(_.findFirstMatchIn(l)).nonEmpty) {
422-
Some(s"Line $i of file ${f.toString} contains secrets")
423-
} else {
424-
None
425-
}
426-
}
427-
} catch {
428-
case _: MalformedInputException => List()
429-
}
430-
}
431-
val allIssues = nameIssues ++ contentsIssue
432-
assert(allIssues.isEmpty, allIssues.mkString("\n"))
433-
}
434-
435385
private def assertOrLog(condition: Boolean, hint: String = "",
436386
disableFailure: Boolean = disableFailure): Unit = {
437387
if (disableFailure && !condition) println(hint)

0 commit comments

Comments
 (0)