Safe to run
Search
⌃K

Verify - Getting started

Safe to run verify protects your application from input that hackers can manipulate - whether intents sent to your application, redirects within WebViews to malicious sites or downloaded files
Gradle:
implementation "com.safetorun:inputverification:$latest_version"
Sample for URL verification
val url = intent?.extras?.getString("url")
val isUrlOk = url?.urlVerification {
"safetorun.com".allowHost()
allowParameter {
allowedType = AllowedType.String
parameterName = "a_token"
}
}
if (isUrlOk != true) {
throw RuntimeException("Failed validation!!")
}
And a sample for intent verification
intent.verify {
urlConfiguration {
"safetorun.com".allowHost()
}
actionOnSuccess = {
intent?.extras?.getString("url")?.let {
"${it}?sensitive_token=pleasekeepmesecret"
}?.let(webView::loadUrl)
}
}