Leaking your XPUB is a privacy risk. Whoever gets that knows every address that belongs to your wallet: past, present and future. They donāt necessarily know those addresses belong to *you* personally, but they know the addresses go together.
The most likely way youāll leak your XPUBs is by connecting to an Electrum server, or a vendorās wallet that collects this data.
When you start up Sparrow, itāll ask how you want to connect to your node. Options include Bitcoin Core, private Electrum server, and public Electrum server. For maximum privacy and speed, itās best to run your own Electrum server. Iāve used ElectrumX and Fulcrum. Iāve heard good things about electrs but I havenāt tried it.
If your wallet has previously been connected to some other service, like, say, your hardware vendorās app, then your XPUB has in all likelihood already been leaked. The only way to keep this private is to set up your own wallet from scratch and ensure that your wallet software (Sparrow) only connects to a private Electrum server (preferred self-hosted).