URL Filter not blocking specified keywords

I have been playing around with the new URL Filtering API. I have successfully installed and configured the sample code, Installed the example app to my iPhone, and am also running the PIR server locally on my Mac.

In my input.txtpb file, I simply have 2 endpoints:

rows: [{
        keyword: "instagram.com",
        value: "1"
    },  
    {
        keyword: "youtube.com/shorts",
        value: "1"
    }]

Neither of these are blocked when I attempt to load them from either a browser, or their dedicated apps.

Are there any debugging tips I should know about?

Additionally, I have also noticed a few times I have left the filter running on my phone, after leaving my LAN (where the PIR server is running), suddenly throughout the day I'm having random, completely unrelated endpoints blocked on my phone. I thought this API was never supposed to produce false positives (without calling back to the PIR server for confirmation).

Answered by DTS Engineer in 860331022

It’s better to reply as a reply, rather than in the comments; see Quinn’s Top Ten DevForums Tips for this and other titbits.

I thought the Bloom filter was downloaded by the device from the server?

That depends on your perspective (-:

The system calls the fetchPrefilter(existingPrefilterTag:) method on your provider to fetch the Bloom filter. In a real product, it’s expected that your list of filtered URLs would update regularly, and thus your implementation of that method would fetch the latest Bloom filter from your server. However, that’s not how the Filtering traffic by URL sample code works. It embeds a copy of the Bloom filter into the extension (bloom_filter.plist) and the fetchPrefilter(existingPrefilterTag:) method just returns that.

So, if you’re working with the sample and you update the list of filtered URLs on the server, you have to update the embedded Bloom filter to match. Or rework the sample to fetch the Bloom filter from your server and then write server-side code to update it there.

Updating the Bloom filter is not without its challenges. Another developer has posted some useful tips in Getting a basic URL Filter to work.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Did you update your Bloom filter to match the URLs you’re trying to block?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

It’s better to reply as a reply, rather than in the comments; see Quinn’s Top Ten DevForums Tips for this and other titbits.

I thought the Bloom filter was downloaded by the device from the server?

That depends on your perspective (-:

The system calls the fetchPrefilter(existingPrefilterTag:) method on your provider to fetch the Bloom filter. In a real product, it’s expected that your list of filtered URLs would update regularly, and thus your implementation of that method would fetch the latest Bloom filter from your server. However, that’s not how the Filtering traffic by URL sample code works. It embeds a copy of the Bloom filter into the extension (bloom_filter.plist) and the fetchPrefilter(existingPrefilterTag:) method just returns that.

So, if you’re working with the sample and you update the list of filtered URLs on the server, you have to update the embedded Bloom filter to match. Or rework the sample to fetch the Bloom filter from your server and then write server-side code to update it there.

Updating the Bloom filter is not without its challenges. Another developer has posted some useful tips in Getting a basic URL Filter to work.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

URL Filter not blocking specified keywords
 
 
Q