medic/cht-gateway

Special chars don't work in password

alxndrsn opened this issue · 2 comments

Seen on medic flavor, including # in the password prevents polling from happening.

Error: must be a valid URL

03-15 11:33:29.494 29040 29343 I MedicGateway: java.net.MalformedURLException: java.lang.IllegalArgumentException: invalid port: -1
03-15 11:33:29.494 29040 29343 I MedicGateway: 	at java.net.URL.<init>(URL.java:190)
03-15 11:33:29.494 29040 29343 I MedicGateway: 	at java.net.URL.<init>(URL.java:125)
03-15 11:33:29.494 29040 29343 I MedicGateway: 	at medic.gateway.alert.SimpleJsonClient2.get(SimpleJsonClient2.java:35)
03-15 11:33:29.494 29040 29343 I MedicGateway: 	at medic.gateway.alert.WebappUrlVerifier.verify(WebappUrlVerifier.java:26)
03-15 11:33:29.494 29040 29343 I MedicGateway: 	at medic.gateway.alert.SettingsDialogActivity$1.doInBackground(SettingsDialogActivity.java:156)
03-15 11:33:29.494 29040 29343 I MedicGateway: 	at medic.gateway.alert.SettingsDialogActivity$1.doInBackground(SettingsDialogActivity.java:154)
03-15 11:33:29.494 29040 29343 I MedicGateway: 	at android.os.AsyncTask$2.call(AsyncTask.java:307)
03-15 11:33:29.494 29040 29343 I MedicGateway: 	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
03-15 11:33:29.494 29040 29343 I MedicGateway: 	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:246)
03-15 11:33:29.494 29040 29343 I MedicGateway: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
03-15 11:33:29.494 29040 29343 I MedicGateway: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
03-15 11:33:29.494 29040 29343 I MedicGateway: 	at java.lang.Thread.run(Thread.java:833)

Some characters are not allowed by java.net.URL in basic auth passwords:

Illegal char: # (35)
Illegal char: / (47)
Illegal char: ? (63)
Illegal char: @ (64)

These should be checked by the SettingsDialog (in medic flavour) and warned against.

Should also check username, and additionally disallow :