Socket
Socket
Sign inDemoInstall

ad-block

Package Overview
Dependencies
15
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.1.2 to 4.1.3

context_domain.cc

2

package.json
{
"name": "ad-block",
"main": "./build/Release/ad-block",
"version": "4.1.2",
"version": "4.1.3",
"description": "Ad block engine used in the Brave browser for ABP filter syntax based lists like EasyList.",

@@ -6,0 +6,0 @@ "directories": {

@@ -157,3 +157,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

it('exception rule returned', function () {
const queryResult = this.client.findMatchingFilters('https://www.scrumpoker.online/js/angular-google-analytics.js', FilterOptions.script, 'www.brianbondy.com')
const queryResult = this.client.findMatchingFilters('https://www.scrumpoker.online/js/angular-google-analytics.js', FilterOptions.script, 'www.scrumpoker.online')
assert.equal(queryResult.matchingExceptionOrigRule, '@@||www.scrumpoker.online^$~third-party')

@@ -305,2 +305,156 @@ })

})
describe('domain filtered rules', function () {
describe('All exclude domain rules', function() {
before(function () {
this.client = new AdBlockClient()
this.client.parse('wp-content/$domain=~aaaaa.com|~bbbbb.com|~ccccc.com')
})
it('filter has all anti domains but with different input domain should block', function () {
assert(this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'www.brianbondy.com'))
})
it('filter has all anti domains and with a same input domain should not block', function () {
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'aaaaa.com'))
})
})
describe('All include domain rules', function() {
before(function () {
this.client = new AdBlockClient()
this.client.parse('wp-content/$domain=aaaaa.com|bbbbb.com|ccccc.com')
})
it('filter has all anti=false domains but with different input domain should not block', function () {
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'www.brianbondy.com'))
})
it('filter has all anti=false domains and with a same domain should not block', function () {
assert(this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'aaaaa.com'))
})
})
describe('Rule with blocking parent domain and subdomain which is allowed', function() {
before(function () {
this.client = new AdBlockClient()
this.client.parse('wp-content/$domain=example.com|~foo.example.com|x.com|y.com|z.com')
})
it('for test URL of unrelated domain should not match', function () {
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'brianbondy.com'))
})
it('for test URL of parent should block', function () {
assert(this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'example.com'))
})
it('for test URL of subdomain should allow', function () {
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'foo.example.com'))
})
it('for test URL of deeper subdomain should allow', function () {
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'boo.foo.example.com'))
})
it('for test URL of subdomain of top level rule should block', function () {
assert(this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'boo.example.com'))
})
})
describe('Rule with anti-block parent domain and subdomain which is blocked', function() {
before(function () {
this.client = new AdBlockClient()
this.client.parse('wp-content/$domain=~example.com|foo.example.com|x.com|z.com|y.com')
})
it('for test URL of unrelated domain should not match', function () {
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'brianbondy.com'))
})
it('for test URL of parent should not block', function () {
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'example.com'))
})
it('for test URL of subdomain should block', function () {
assert(this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'foo.example.com'))
})
it('for test URL of deeper subdomain should block', function () {
assert(this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'boo.foo.example.com'))
})
it('for test URL of subdomain of top level rule should allow', function () {
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'boo.example.com'))
})
})
describe('Three level deep rules', function() {
before(function () {
this.client = new AdBlockClient()
this.client.parse('wp-content/$domain=example.com|~brave.example.com|foo.brave.example.com')
})
it('for test URL of unrelated domain should not match', function () {
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'brianbondy.com'))
})
it('for test URL of parent should block', function () {
assert(this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'example.com'))
})
it('for test URL of exception subdomain should allow', function () {
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'brave.example.com'))
})
it('for test URL of deeper subdomain should block', function () {
assert(this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'foo.brave.example.com'))
})
})
describe('Three level deep rules reversed', function() {
before(function () {
this.client = new AdBlockClient()
this.client.parse('wp-content/$domain=~example.com|brave.example.com|~foo.brave.example.com')
})
it('for test URL of unrelated domain should not match since there is a blocking domain', function () {
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'brianbondy.com'))
})
it('for test URL of parent should allow', function () {
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'example.com'))
})
it('for test URL of exception subdomain should block', function () {
assert(this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'brave.example.com'))
})
it('for test URL of deeper subdomain should allow', function () {
assert(!this.client.matches('https://www.sportsnet.ca/wp-content/plugins',
FilterOptions.image, 'foo.brave.example.com'))
})
})
describe('first-party host', function() {
before(function () {
this.client = new AdBlockClient()
this.client.parse('analytics.brave.com^\n@@https://analytics.*/piwik.$~third-party')
})
it('for same host finds exception', function () {
assert(!this.client.matches('https://analytics.brave.com/piwik.js',
FilterOptions.image, 'analytics.brave.com'))
})
it('for same diff host does not find exception', function () {
assert(this.client.matches('https://analytics.brave.com/piwik.js',
FilterOptions.image, 'batcommunity.org'))
})
it('findMatchingFilters for same host finds exception', function () {
const queryResult = this.client.findMatchingFilters('https://analytics.brave.com/piwik.js', FilterOptions.script, 'analytics.brave.com')
assert.equal(queryResult.matches, false)
assert.equal(queryResult.matchingFilter, 'analytics.brave.com^')
assert.equal(queryResult.matchingExceptionFilter, 'https://analytics.*/piwik.')
})
it('findMatchingFilters for same diff host does not find exception', function () {
const queryResult = this.client.findMatchingFilters('https://analytics.brave.com/piwik.js', FilterOptions.script, 'batcommunity.org')
assert.equal(queryResult.matches, true)
assert.equal(queryResult.matchingFilter, 'analytics.brave.com^')
})
})
})
})

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc