A few of app extensions cannot make networks calls themselves, instead the OS makes the network call on behalf of the extension (such as the Message Filter Extension or Unwanted Communication extension).
As its not the extension itself making the network call in these situations, then does that affect the situation?
No, at least not in this case. The credentials the system is using come from the system keychain and they were inserted there by your app, presumably as part of an in-app configuration process controlled by your app.
Note that while the documentation there is structured as "user name/password", that doesn't necessarily need to be the direct credentials the user would actually use to "login" to your service. Your service could also issue back extension specific login credentials after it authenticates the user through their normal credentials (or whatever mechanism you normally use). Note that many VPN services use an approach similar to this- the user has an "account" which is used to login to the VPN services management interface (website/app/etc). That account can then create additional "login users" (which are used to authenticate the actual VPN service), but the two different account types can only be used within their respective "areas".
Returning to the original question here:
In other words, how can the server verify that the request is valid and coming from the iPhone and not from some spoofer?
The connection is authenticated to a particular user, which is how you'd normally limit the impact of any spoofer. However, I'll also so that the login architecture I sketched out above also means that you could use App Attest to perform security checks before you issue an extension account to that device.
__
Kevin Elliott
DTS Engineer, CoreOS/Hardware