Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dollar sign not supported in password injection #127

Open
elenigen opened this issue Aug 11, 2021 · 0 comments
Open

Dollar sign not supported in password injection #127

elenigen opened this issue Aug 11, 2021 · 0 comments

Comments

@elenigen
Copy link
Contributor

Describe the bug
I noticed that a password containing a dollar sign $ would break the injection.

Expected behavior
Any character should be allowed.

To Reproduce
In the input file:

"password": "inlinesecret{{\"secretstore\": \"aws_secrets_manager\", \"secretname\": \"datapull/my-app\", \"secretkeyname\": \"MY_SERCRET\"}}",

MY_SERCRET = 'abc$123'

Errorlog

Exception in thread "main" java.lang.IllegalArgumentException: Illegal group reference
	at java.util.regex.Matcher.appendReplacement(Matcher.java:857)
	at scala.util.matching.Regex$Replacement$class.replace(Regex.scala:804)
	at scala.util.matching.Regex$MatchIterator$$anon$1.replace(Regex.scala:782)
	at scala.util.matching.Regex$$anonfun$replaceAllIn$1.apply(Regex.scala:473)
	at scala.util.matching.Regex$$anonfun$replaceAllIn$1.apply(Regex.scala:473)
	at scala.collection.Iterator$class.foreach(Iterator.scala:891)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
	at scala.util.matching.Regex.replaceAllIn(Regex.scala:473)
	at helper.Helper.ReplaceInlineExpressions(Helper.scala:389)
	at core.DataPull$$anonfun$main$1.apply$mcV$sp(DataPull.scala:163)
	at scala.util.control.Breaks.breakable(Breaks.scala:38)
	at core.DataPull$.main(DataPull.scala:154)
	at core.DataPull.main(DataPull.scala)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.spark.deploy.JavaMainApplication.start(SparkApplication.scala:52)
	at org.apache.spark.deploy.SparkSubmit.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:853)
	at org.apache.spark.deploy.SparkSubmit.doRunMain$1(SparkSubmit.scala:161)
	at org.apache.spark.deploy.SparkSubmit.submit(SparkSubmit.scala:184)
	at org.apache.spark.deploy.SparkSubmit.doSubmit(SparkSubmit.scala:86)
	at org.apache.spark.deploy.SparkSubmit$$anon$2.doSubmit(SparkSubmit.scala:928)
	at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:937)
	at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)

DataPull line 54:

    breakable {
      while (json.has("jsoninputfile")) {
        val jsonMap = jsonObjectPropertiesToMap(json.getJSONObject("jsoninputfile"))
        if (listOfS3Path.contains(jsonMap("s3path"))) {
          throw new Exception("New json is pointing to same json.")
        }
        listOfS3Path += jsonMap("s3path")
        setAWSCredentials(sparkSession, jsonMap)
        json = new JSONObject(
          helper.ReplaceInlineExpressions(
            helper.InputFileJsonToString(
              sparkSession = sparkSession,
              jsonObject = json,
              inputFileObjectKey = "jsoninputfile"
            ).getOrElse(""), sparkSession
          )
        )
      }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant