Apache Groovy also has "undocumented features", e.g. from your scripts:
matchingSecret = secrets.find { secret -> secret.id == id }
can be written as: matchingSecret = secrets.find { it.id == id }
Those scripts look fairly basic, without any looping. Perhaps Java 8 with lambdas, or Kotlin could be used instead.