← Back to team overview

ubuntu-phone team mailing list archive

Xmlhttprequest (XHR) from qt/qml

 

hello everyone

I was working on an app that makes use of xmlhttp requests. xmlhttprequest
(XHR) is supported in qt qml since way back when. Both GET and POST.  I
have a working testapp that runs fine on the desktop. But it fails when it
is deployed to my phone. It seems apparmor does not allow it:

Loading module: 'libubuntu_application_api_touch_mirclient.so.3.0.0'
QNetworkManagerInterface::QNetworkManagerInterface(QObject*) propsReply "An
AppArmor policy prevents this sender from sending this message to this
recipient; type="method_call", sender=":1.862" (uid=32011 pid=23829
comm="/usr/lib/arm-linux-gnueabihf/qt5/bin/qmlscene Main")
interface="org.freedesktop.DBus.Properties" member="GetAll" error
name="(unset)" requested_reply="0"
destination="org.freedesktop.NetworkManager" (uid=0 pid=1698
comm="NetworkManager ")"
QNetworkManagerInterface::QNetworkManagerInterface(QObject*) nmReply "An
AppArmor policy prevents this sender from sending this message to this
recipient; type="method_call", sender=":1.862" (uid=32011 pid=23829
comm="/usr/lib/arm-linux-gnueabihf/qt5/bin/qmlscene Main")
interface="org.freedesktop.NetworkManager" member="GetDevices" error
name="(unset)" requested_reply="0"
destination="org.freedesktop.NetworkManager" (uid=0 pid=1698
comm="NetworkManager ")"
"Object path cannot be empty"

syslog, however does not show any apparmor=DENIED lines, but contains this
for my app:

Feb  3 03:10:07 ubuntu-phablet kernel: [56478.996203] type=1400
audit(1454465407.330:1757): apparmor="STATUS" operation="profile_replace"
profile="unconfined" name="tstxhttp.matv1_tstxhttp_0.1" pid=27998
comm="apparmor_parser"

not sure what that means exactly though.


On irc I was advised to do a bug report. However, knowing that this has
been a known issue for quite some time and at least one longstanding lp-bug
exists, I thought I would ask here first what I ought to do.

- On this mailinglist a previous discussion is here:
https://lists.launchpad.net/ubuntu-phone/msg14407.html

But it is left unconcluded.


-the only related bug that I know of is this:
https://bugs.launchpad.net/ubuntu/+source/qtbase-opensource-src/+bug/1404188

Now I do not know much about apparmor but I far as I understand the
discussion, jdstrand is basically saying that the phone trust model makes
it so that for an app like mine to work, it would have to expose
networkmanager directly to 'untrusted' apps, which could also expose
unwanted things like mac address and such things to those apps.

It is suggested that using connectivity-api could help. But I dont quite
see how, in scenario's like mine. Also, that bug is still marked as
unresolved.


So my question is: Whats the status of this? Should I or should I not be
expecting XHR to work (now or in the future) on the phone? (Somehow, it
seems kinda weird that an app on 'touch' can not use such a common api when
any app on any desktop can).

Should I perhaps do a new bug report?


Please advise,

cheers

Mathijs

Follow ups