Signal 4.39.2 - Crash when sending pin.it link
- [X] I have searched open and closed issues for duplicates
- [X] I am submitting a bug report for existing functionality that does not work as intended
- [X] I have read https://github.com/signalapp/Signal-Android/wiki/Submitting-useful-bug-reports
- [X] This isn't a feature request or a discussion topic
This is a more formal report of a bug found by user Leibi on the forums. See the Signal Comunity Forum
Bug description
App crashes when posting a pin.it link
Steps to reproduce
- open Signal
- open Note to Self
- paste link
- without sending, Signal crashes
Link in question is:
https://pin.it/utq6l5d5xcyytd
whis is the short version of
https://www.pinterest.de/pin/293156256971627598/sent/?sfo=1&sender=848717629685238381&invite_code=e3ff71c05d9c4f1d82efb1a9a50f6d31
However for me it only crashes with the short one.
Actual result: The current view crashes. Not the whole app. And I'm back at the main Signal page. Expected result: Send the link without failure
Screenshots
Device info
Device: OnePlus ONEPLUS A6003 (OnePlus6) Android version: OxygenOS 9.0.5 Signal version: 4.39.2
Link to debug log
https://debuglogs.org/8194c9515d6b8c5df6355fba22f76be22fa82e37d30f6dcef275dd3a3c5e9011
@cmswalker Hi Michael, can you get a full list of pinterest domains that pin.it might redirect to.
In this case the whitelist gets checked twice, once for pin.it and then for www.pinterest.de which causes the crash.
In addition we may also prevent redirects causing the crash incase we miss any/pinterest or another service adds more domains in future.
It's possible to make the bug worse, somehow I managed to get Signal to save a draft of the link and now I cannot go back into that conversation without it attempting to resolve and causing the crash.
Does it happen for .com? pin.it can redirect to any pinterest.* TLDs but didn't want to add 20 things to the whitelist so I'm betting only .com isn't crashing? Is it possible to match on host instead, that way we'd get all TLD supported without manually maintaining a list
On Mon, May 6, 2019, 8:19 AM Alan Evans [email protected] wrote:
@cmswalker https://github.com/cmswalker Hi Michael, can you get a full list of pinterest domains that pin.it might redirect to.
In this case the whitelist gets checked twice, once for pin.it and then for www.pinterest.de which causes the crash.
In addition we may also prevent redirects causing the crash incase we miss any/pinterest or another service adds more domains in future.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/signalapp/Signal-Android/issues/8796#issuecomment-489659667, or mute the thread https://github.com/notifications/unsubscribe-auth/ACATGIVXOWJ5IGW7FYA3ZZDPUBD7VANCNFSM4HKYGULA .
I found 16 (+1) Pinterest domains: https://www.pinterest.at/ https://www.pinterest.ca/ https://www.pinterest.cl/ https://www.pinterest.com/ https://www.pinterest.de/ https://www.pinterest.dk/ https://www.pinterest.es/ https://www.pinterest.fr/ https://www.pinterest.ie/ https://www.pinterest.it/ https://www.pinterest.jp/ https://www.pinterest.mx/ (redirects to https://www.pinterest.com.mx/) https://www.pinterest.ph/ https://www.pinterest.pt/ https://www.pinterest.ru/ https://www.pinterest.se/
I'm happy to add all of those to the list but it seems matching on hostname would help long-term, that way new domains are automatically supported, does that sound realistic to you?
On Mon, May 6, 2019, 9:10 AM aleb2000 [email protected] wrote:
I found 16 (+1) Pinterest domains: https://www.pinterest.at/ https://www.pinterest.ca/ https://www.pinterest.cl/ https://www.pinterest.com/ https://www.pinterest.de/ https://www.pinterest.dk/ https://www.pinterest.es/ https://www.pinterest.fr/ https://www.pinterest.ie/ https://www.pinterest.it/ https://www.pinterest.jp/ https://www.pinterest.mx/ (redirects to https://www.pinterest.com.mx/) https://www.pinterest.ph/ https://www.pinterest.pt/ https://www.pinterest.ru/ https://www.pinterest.se/
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/signalapp/Signal-Android/issues/8796#issuecomment-489678007, or mute the thread https://github.com/notifications/unsubscribe-auth/ACATGIRL4VYLPQQX7BBVBSLPUBKALANCNFSM4HKYGULA .
Crash for reference:
2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: java.lang.IllegalArgumentException: Tried to proxy a non-whitelisted domain.
2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at org.thoughtcrime.securesms.net.ContentProxySelector.select(ContentProxySelector.java:47)
2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at okhttp3.internal.connection.RouteSelector.resetNextProxy(RouteSelector.java:129)
2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at okhttp3.internal.connection.RouteSelector.(RouteSelector.java:63)
2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at okhttp3.internal.connection.StreamAllocation.(StreamAllocation.java:101)
2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:186)
2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:254)
2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:200)
2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at java.lang.Thread.run(Thread.java:764)
We have checks to prevent accidentally attempting proxying a non-whitelisted domain when you make a request, but we also have this final check by our ProxySelector implementation. It appears that the pin.it domains is redirecting to a domain not on the whiteliest. I wonder if the same thing would happen with the other shortened URLs?
Also, it doesn't matter if we support the additional endings on the client: the proxy itself maintains the same whitelist. We might be able to decide to be less crash-y about it though on the client.
What if someone buys a pinterest.something domain? A fix for crashes and the update list seem to me a reasonable fix for 4.39 release. Maybe a pinterest.* whitelist for redirect could do the job, but preview wouldn't work with other Pinterest domain. A support for regex in the links' whitelist could reduce the number of domains' line in these cases.
For now the quickest solution would be to just expand the whitelist with the additional domains listed above. I'll put up a PR and test case
On Mon, May 6, 2019, 9:38 AM Greyson Parrelli [email protected] wrote:
Crash for reference:
2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: java.lang.IllegalArgumentException: Tried to proxy a non-whitelisted domain.2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at org.thoughtcrime.securesms.net.ContentProxySelector.select(ContentProxySelector.java:47)2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at okhttp3.internal.connection.RouteSelector.resetNextProxy(RouteSelector.java:129)2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at okhttp3.internal.connection.RouteSelector.(RouteSelector.java:63)2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at okhttp3.internal.connection.StreamAllocation.(StreamAllocation.java:101)2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:186)2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:254)2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:200)2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)2019-05-04 08:01:31.376 GMT+02:00 E UncaughtExceptionLogger: at java.lang.Thread.run(Thread.java:764)
We have checks to prevent accidentally attempting proxying a non-whitelisted domain when you make a request, but we also have this final check by our ProxySelector implementation. It appears that the pin.it domains is redirecting to a domain not on the whiteliest. I wonder if the same thing would happen with the other shortened URLs?
Also, it doesn't matter if we support the additional endings on the client: the proxy itself maintains the same whitelist. We might be able to decide to be less crash-y about it though on the client.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/signalapp/Signal-Android/issues/8796#issuecomment-489686853, or mute the thread https://github.com/notifications/unsubscribe-auth/ACATGITWVPD6GHHF3Z33E7TPUBNI3ANCNFSM4HKYGULA .
this should do it 🤞 https://github.com/signalapp/Signal-Android/pull/8800, i feel bad taking up most of the real estate in the whitelist, so hopefully at some point there can be support for host matching
I also found https://cl.pinterest.com/ -> https://www.pinterest.cl/ https://cz.pinterest.com/ https://fr.pinterest.com/ -> https://www.pinterest.fr/ https://gr.pinterest.com/ https://in.pinterest.com/ https://no.pinterest.com/ https://pt.pinterest.com/ -> https://www.pinterest.pt/ https://sk.pinterest.com/ https://www.pinterest.co.at/ -> https://www.pinterest.at/ https://www.pinterest.co.in/ -> https://in.pinterest.com/ https://www.pinterest.co.kr/ https://www.pinterest.co.nz/ -> https://www.pinterest.nz/ https://www.pinterest.com.au/ https://www.pinterest.com.pe/ -> https://www.pinterest.com/ Maybe there are others. I think a more solid fix is needed. Is a wildcard for subdomain possible?
@aleb2000 i'd prefer that too but am not comfortable with making that change myself, it would need to be baked into the core behavior first. @greyson-signal @alan-signal thoughts on allowing for host or subdomain matching? If not I can just add these extra host + domain combos @aleb2000 has posted
Also, the subdomains are less of a concern as they just redirect to the domains clients will actually access, so pin.it links should never get embedded with https://fr.pinterest.com/ as they'll only be created on domain that is using https://pinterest.fr . Hostname matching regardless of TLD would be ideal but that sounds like the proxy itself (not android client) would also need to reflect that requested behavior. I have updated with the additional TLDs that were missing that don't just redirect to .com and swap subdomain to tld
For now, I've prevented redirects from non-whitelisted domains from getting to our final whitelist check that crashes the app. This means that links that redirect to non-.com pinterest domains will silently fail, and you just won't get a preview. We'll continue to think about what the safest and most-sustainable way is to support other countries' TLD's in the future.
@greyson-signal thank you! Unfortunately it seems that Pinterest is the first site in the list that actually supports full web experiences on multiple domains as opposed to redirecting to .com with lang headers. We have to do this in order to support localized SEO much like google, etc. whereas other sites in the whitelist can get away with just .com support as they require logins.
@alan-signal @greyson-signal what is the user-agent that is sent for the signal crawler? I was able to find the ios one but cannot find the android one https://github.com/signalapp/Signal-iOS/blob/e0bba32505896cdfd41c1a5c1a16bb22e4222f32/SignalServiceKit/src/Network/ContentProxy.swift#L56
@alan-signal @greyson-signal any update on that ^ I can't seem to find it anywhere