mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-10-20 07:11:28 +02:00
Target correlation returned nothing for every target in a real project, and three of its four signals could not have worked. A registrant is matched on what two records must share to be the same party: case, punctuation and the company suffix are stripped by `registrant_key`, whose SQL half sits beside it (`registrant_key_sql`) because a match invisible to one half is a relation that never appears. Both halves refuse a redacted name, so "Redacted for Privacy" cannot group every privacy-protected domain in the instance into one false cluster. Measured on shopify.com and shopifycloud.com: one relation, on the registrant, and nothing between the four unrelated estates beside them. A registrar is dropped as a correlation. MarkMonitor registers for thousands of unrelated brands, so "same registrar" asserts nothing - shopify.com and uber.com share it and are not related. It stays available as a deliberate lookup in the correlation dialog, which is a question the operator asks, not a relation reNgine claims. The case-sensitive exact match it used would have missed those two anyway: `MarkMonitor Inc.` against `Markmonitor Inc.`. A nameserver is the one strong signal here - `a.ns.hackerone.com` is identifying, `gold.foundationdns.com` is Cloudflare's enterprise DNS and identifies nothing. Fifteen managed providers join the suppression list, foundationdns and markmonitor among them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YYop31s6BqDUt4TBs5mbwa
49 lines
1.3 KiB
Python
49 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
import pytest
|
|
from sqlalchemy import literal, select
|
|
|
|
from shared.utils.infra import is_shared_nameserver
|
|
from shared.utils.privacy import registrant_key, registrant_key_sql
|
|
|
|
pytestmark = pytest.mark.api
|
|
|
|
NAMES = [
|
|
"Shopify Inc.",
|
|
"Domains By Proxy, LLC",
|
|
"Redacted for Privacy",
|
|
"Shopify, Inc",
|
|
"SHOPIFY INC",
|
|
"Uber Technologies, Inc.",
|
|
"Bugcrowd Inc",
|
|
"Gandi SAS",
|
|
"Foo Holdings Ltd",
|
|
"Acme",
|
|
"Acme Co.",
|
|
" Spaced Name Corp ",
|
|
"REDACTED FOR PRIVACY",
|
|
"",
|
|
]
|
|
|
|
|
|
@pytest.mark.parametrize("name", NAMES)
|
|
async def test_the_sql_key_and_the_python_key_agree(session, name):
|
|
row = await session.scalar(select(registrant_key_sql(literal(name))))
|
|
assert row == registrant_key(name)
|
|
|
|
|
|
def test_one_registrant_spelled_three_ways_is_one_party():
|
|
spellings = ["Shopify Inc.", "Shopify, Inc", "SHOPIFY INC"]
|
|
assert len({registrant_key(n) for n in spellings}) == 1
|
|
|
|
|
|
def test_a_redacted_registrant_is_nobody():
|
|
assert registrant_key("REDACTED FOR PRIVACY") == ""
|
|
assert registrant_key("Domains By Proxy, LLC") == ""
|
|
|
|
|
|
def test_a_managed_nameserver_is_the_provider():
|
|
assert is_shared_nameserver("gold.foundationdns.com")
|
|
assert is_shared_nameserver("ns1.markmonitor.com")
|
|
assert not is_shared_nameserver("a.ns.hackerone.com")
|