To be clear I think there are two parts to that:
-
one is an API or snapctl feature to make the query, something like perhaps:
snapctl is-connected --pid PID|--security-tag SECTAG slot|plug
that would let the snap query whether there’s a snap connected to the slot/plug on the other side of that PID/security tag, it might also have to instead tell that PID is unconfined?
-
an interface that let a snap access that query capability for its plugs/slots for some set of interfaces, we could also separately decide though that some *-control or *-support interfaces come with the implicit permission for the control slot respectively support plug snap to make queries for the corresponding consumer interface