@@ -64,6 +64,12 @@ void forceQuitRaw(String error) {
6464 void openNativeModuleDialogRaw (String moduleUrl , String moduleId , String installTitle , String checksum , boolean canInstall ) {
6565 if (BuildConfig .DEBUG )
6666 Timber .d ("ModuleDialog, downloadUrl: " + AndroidacyUtil .hideToken (moduleUrl ) + ", moduleId: " + moduleId + ", installTitle: " + installTitle + ", checksum: " + checksum + ", canInstall: " + canInstall );
67+ // moduleUrl should be a valid URL, i.e. in the androidacy.com domain
68+ // if it is not, do not proceed
69+ if (!AndroidacyUtil .isAndroidacyFileUrl (moduleUrl )) {
70+ Timber .e ("ModuleDialog, invalid URL: %s" , moduleUrl );
71+ return ;
72+ }
6773 this .downloadMode = false ;
6874 RepoModule repoModule = AndroidacyRepoData .getInstance ().moduleHashMap .get (installTitle );
6975 String title , description ;
@@ -381,8 +387,10 @@ public boolean isAndroidacyModule(String moduleId) {
381387 */
382388 @ JavascriptInterface
383389 public String getAndroidacyModuleFile (String moduleId , String moduleFile ) {
390+ moduleId = moduleId .replaceAll ("\\ ." , "" ).replaceAll ("/" , "" );
384391 if (moduleFile == null || this .consumedAction || !this .isAndroidacyModule (moduleId ))
385392 return "" ;
393+ moduleFile = moduleFile .replaceAll ("\\ ." , "" ).replaceAll ("/" , "" );
386394 File moduleFolder = new File ("/data/adb/modules/" + moduleId );
387395 File absModuleFile = new File (moduleFolder , moduleFile ).getAbsoluteFile ();
388396 if (!absModuleFile .getPath ().startsWith (moduleFolder .getPath ()))
@@ -401,6 +409,7 @@ public String getAndroidacyModuleFile(String moduleId, String moduleFile) {
401409 */
402410 @ JavascriptInterface
403411 public boolean setAndroidacyModuleMeta (String moduleId , String content ) {
412+ moduleId = moduleId .replaceAll ("\\ ." , "" ).replaceAll ("/" , "" );
404413 if (content == null || this .consumedAction || !this .isAndroidacyModule (moduleId ))
405414 return false ;
406415 File androidacyMetaFile = new File ("/data/adb/modules/" + moduleId + "/.androidacy" );
0 commit comments