Skip to content

Add a prototype namespace squatting dashboard view - #2447

Open
autumnfound wants to merge 7 commits into
malowe/main/name-squatting-dashboardfrom
malowe/main/namespace-squatting
Open

autumnfound wants to merge 7 commits into
malowe/main/name-squatting-dashboardfrom
malowe/main/namespace-squatting

Conversation

@autumnfound

Copy link
Copy Markdown
Contributor

This request builds on top of the existing name squatting dashboard to add a third tab for namespaces and add support for allows alongside the existing extension allowances for name squatting. Below are a more thorough description of the various commits for more easy comparison.

  1. Adds a lookup of namespace pairs whose names are within an edit distance
    that grows with their length, or differ only in separators, with each
    side's active extension downloads and whether they share a member. A
    trigram index on namespace names prefilters the pairs. name_similarity_allow
    now also holds allowed namespace pairs, marked by the NAMESPACE field, so
    both kinds share one table. Groundwork for a namespaces view of the name
    squatting admin dashboard.

  2. List pairs of namespaces whose names resemble each other, with the namespace
    with more downloads as target, filtered to popular targets by default so
    admins can switch to the full list to catch quiet, niche squatting. Admins
    can allow a pair or remove the allow. The lookup reads every namespace, so
    its pairs are reused for a minute per instance; allows are read on every
    request and apply at once.

  3. Lists namespace pairs whose names differ by a typo or only in separators,
    the more downloaded namespace as target, with a popular-targets switch (on
    by default) and a sort by downloads or newest look-alike, both kept in the
    URL. Admins can allow a pair; the Allowlist tab gains a toggle to list and
    remove allowed namespace pairs.

changeset descriptions pulled from Claude commit comments, beep boop

Adds pg_trgm, a pair allowlist table and trigram indexes on extension
and display names, with a repository that probes one extension's names
against active extensions and finds display names shared across
namespaces. Groundwork for the name squatting admin dashboard.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
@autumnfound
autumnfound added this pull request to stack #2448 November 12, 2026 16:32
@autumnfound

Copy link
Copy Markdown
Contributor Author

Screenshot of local sample with fake data:

image

@autumnfound

Copy link
Copy Markdown
Contributor Author

@gnugomez once you finish with the first PR in the stack, I can look at getting this updated based on your change sets to be more compliant with the updates! I kept this separate in case we want to refine this more separately from the base dashboard along with use cases.

Adds the non-enforced NAME_SIMILARITY publish check, which flags
versions whose name or display name resembles another namespace's
active extension, and admin endpoints that re-probe flagged extensions
and shared display names live and manage the pair allowlist. Lookups
run under a transaction-local statement timeout so a slow probe cannot
tie up the database.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Adds a Name Squatting admin page with a Collisions tab, listing
look-alike extensions against the one published first with actions to
allow the pair or delete the look-alike, and an Allowlist tab grouped
by the allowed extension. Backed by new admin service methods for the
name squatting endpoints.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Adds a lookup of namespace pairs whose names are within an edit distance
that grows with their length, or differ only in separators, with each
side's active extension downloads and whether they share a member. A
trigram index on namespace names prefilters the pairs. name_similarity_allow
now also holds allowed namespace pairs, marked by the NAMESPACE field, so
both kinds share one table. Groundwork for a namespaces view of the name
squatting admin dashboard.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
List pairs of namespaces whose names resemble each other, with the namespace
with more downloads as target, filtered to popular targets by default so
admins can switch to the full list to catch quiet, niche squatting. Admins
can allow a pair or remove the allow. The lookup reads every namespace, so
its pairs are reused for a minute per instance; allows are read on every
request and apply at once.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Lists namespace pairs whose names differ by a typo or only in separators,
the more downloaded namespace as target, with a popular-targets switch (on
by default) and a sort by downloads or newest look-alike, both kept in the
URL. Admins can allow a pair; the Allowlist tab gains a toggle to list and
remove allowed namespace pairs.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
@autumnfound
autumnfound force-pushed the malowe/main/namespace-squatting branch from a35d3ed to 8bd45a1 Compare November 12, 2026 18:21
- Select pairs with checkboxes and allow them from one bar
- Allow a single row or a whole group from a round check button
- Group the pairs in the allow dialog under what they resemble
- Use the round bin for deletes, as on tokens and trusted publishers
- Checkbox filters, secondary toggle groups and search first, as on Extension Scans
- Link the display name to the public page and the identifier to the admin page
- Refresh collisions and namespace pairs every minute, showing when they were updated
- Drop the ellipsis from button labels

Signed-off-by: Jordi Gómez <jordi.gomez@eclipse-foundation.org>
@gnugomez

Copy link
Copy Markdown
Member

@autumnfound I just pushed the changes I wanted to make, in regards to the UI

at some point I would like to refactor a bit the admin dashboard since every time we add a new view we re-invent the wheel, the scans view looks completely different from others despite having similar features.

@autumnfound

Copy link
Copy Markdown
Contributor Author

@gnugomez thanks! It looks like you've updated both PRs which I appreciate. I'll load it up today and take a peek and let you know if I have any feedback.

at some point I would like to refactor a bit the admin dashboard since every time we add a new view we re-invent the wheel, the scans view looks completely different from others despite having similar features.

+1 from me! I think that makes a lot of sense rather than creating bespoke elements every time.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Allowlist pagination skips entries at page boundaries, similarity filtering misses valid matches, and UI handling can duplicate pairs or show empty results after failed requests.

5 open issues
4 files not reviewed
  • server/src/main/jooq-gen/org/eclipse/openvsx/jooq/Indexes.java: Generated file
  • server/src/main/jooq-gen/org/eclipse/openvsx/jooq/Keys.java: Generated file
  • server/src/main/jooq-gen/org/eclipse/openvsx/jooq/tables/NameSimilarityAllow.java: Generated file
  • server/src/main/jooq-gen/org/eclipse/openvsx/jooq/tables/records/NameSimilarityAllowRecord.java: Generated file
What changed in this PR

Extends the existing name-squatting admin dashboard with namespace similarity review and namespace-pair allowances.

Changes:

  • Adds namespace similarity lookup, cached results, popularity filtering, sorting, and admin endpoints.
  • Adds a Namespaces tab and namespace allowlist, plus shared selection and refresh controls.
  • Updates database mappings, configuration documentation, changelogs, and server/UI tests.
File Description
webui/​test/​unit/​pages/​admin-dashboard/​name-squatting/​namespaces-tab.spec.tsx Tests namespace filtering, sorting, pagination, and allowances.
webui/​test/​unit/​pages/​admin-dashboard/​name-squatting/​name-squatting.spec.tsx Tests namespace-tab navigation.
webui/​test/​unit/​pages/​admin-dashboard/​name-squatting/​name-squatting-model.spec.ts Tests namespace-page merging.
webui/​test/​unit/​pages/​admin-dashboard/​name-squatting/​collisions-tab.spec.tsx Tests refresh and selection behavior.
webui/​test/​unit/​pages/​admin-dashboard/​name-squatting/​allowlist-tab.spec.tsx Tests namespace allowance listing and removal.
webui/​test/​unit/​admin-name-squatting-request.spec.ts Tests namespace API requests.
webui/​src/​pages/​admin-dashboard/​name-squatting/​use-name-squatting.ts Adds namespace query hooks, mutations, and polling.
webui/​src/​pages/​admin-dashboard/​name-squatting/​namespaces-tab.tsx Implements namespace-pair review controls and results.
webui/​src/​pages/​admin-dashboard/​name-squatting/​namespace-allowlist.tsx Displays and removes namespace allowances.
webui/​src/​pages/​admin-dashboard/​name-squatting/​name-squatting.tsx Adds the Namespaces tab and descriptions.
webui/​src/​pages/​admin-dashboard/​name-squatting/​name-squatting-styles.ts Adds shared toggle styling.
webui/​src/​pages/​admin-dashboard/​name-squatting/​name-squatting-parts.tsx Adds namespace links, grouped pairs, and shared errors.
webui/​src/​pages/​admin-dashboard/​name-squatting/​name-squatting-controls.tsx Adds shared search, selection, and refresh controls.
webui/​src/​pages/​admin-dashboard/​name-squatting/​collisions-tab.tsx Adds filtered bulk selection and shared controls.
webui/​src/​pages/​admin-dashboard/​name-squatting/​collision-group.tsx Adds group and row selection actions.
webui/​src/​pages/​admin-dashboard/​name-squatting/​allowlist-tab.tsx Switches between extension and namespace allowances.
webui/​src/​pages/​admin-dashboard/​name-squatting/​allow-namespaces-dialog.tsx Confirms namespace allowances with optional reasons.
webui/​src/​pages/​admin-dashboard/​name-squatting/​allow-dialog.tsx Supports selected extension pairs across groups.
webui/​src/​extension-registry-types.ts Defines namespace dashboard request and response types.
webui/​src/​extension-registry-service.ts Adds namespace dashboard API methods.
webui/​CHANGELOG.md Documents namespace review and bulk selection.
server/​src/​test/​java/​org/​eclipse/​openvsx/​scanning/​NameSimilarityCheckServiceTest.java Adapts fixtures to nullable extension IDs.
server/​src/​test/​java/​org/​eclipse/​openvsx/​scanning/​NameSimilarityCheckConfigTest.java Tests popularity settings and validation.
server/​src/​test/​java/​org/​eclipse/​openvsx/​repositories/​NamespaceSimilarityJooqRepositoryTest.java Tests namespace matching, statistics, and query behavior.
server/​src/​test/​java/​org/​eclipse/​openvsx/​repositories/​NameSimilarityAllowRepositoryTest.java Tests namespace allowance persistence and constraints.
server/​src/​test/​java/​org/​eclipse/​openvsx/​repositories/​JooqOnlyTestConfig.java Registers the namespace similarity repository.
server/​src/​test/​java/​org/​eclipse/​openvsx/​admin/​NameSquattingServiceTest.java Tests namespace ordering, filtering, pagination, and allowances.
server/​src/​main/​resources/​db/​migration/​V1_88__Namespace_Similarity.sql Adds namespace allowances and similarity indexes.
server/​src/​main/​jooq-gen/​org/​eclipse/​openvsx/​jooq/​tables/​records/​NameSimilarityAllowRecord.java Updates generated allowance record fields.
server/​src/​main/​jooq-gen/​org/​eclipse/​openvsx/​jooq/​tables/​NameSimilarityAllow.java Updates generated table mappings and constraints.
server/​src/​main/​jooq-gen/​org/​eclipse/​openvsx/​jooq/​Keys.java Adds generated namespace foreign keys.
server/​src/​main/​jooq-gen/​org/​eclipse/​openvsx/​jooq/​Indexes.java Adds generated namespace allowance indexes.
server/​src/​main/​java/​org/​eclipse/​openvsx/​scanning/​NameSimilarityCheckConfig.java Defines and validates popularity thresholds.
server/​src/​main/​java/​org/​eclipse/​openvsx/​repositories/​NamespaceSimilarityJooqRepository.java Implements namespace similarity lookup and comparison.
server/​src/​main/​java/​org/​eclipse/​openvsx/​repositories/​NameSimilarityJooqRepository.java Shares timeout and trigram helpers.
server/​src/​main/​java/​org/​eclipse/​openvsx/​repositories/​NameSimilarityAllowRepository.java Adds namespace allowance queries.
server/​src/​main/​java/​org/​eclipse/​openvsx/​json/​NameSquattingJson.java Adds namespace API payloads.
server/​src/​main/​java/​org/​eclipse/​openvsx/​entities/​NameSimilarityAllow.java Supports extension and namespace allowance records.
server/​src/​main/​java/​org/​eclipse/​openvsx/​admin/​NameSquattingService.java Adds cached namespace review and allowance management.
server/​src/​main/​java/​org/​eclipse/​openvsx/​admin/​NameSquattingAPI.java Exposes namespace review and allowance endpoints.
server/​src/​dev/​resources/​application.yml Adds development popularity settings.
server/​CHANGELOG.md Documents namespace endpoints and migration requirements.
doc/​configuration.md Documents namespace popularity controls.

Review effort: Balanced

// One more than asked tells whether there is a next page.
var found = allows.findByFieldOrderByDecidedAtDescIdDesc(
NameSimilarityField.NAMESPACE,
PageRequest.of(page, size + 1));
* Trigram similarity a pair needs before its edit distance is computed, low enough to lose no pair
* within the allowed edits: it only spares the edit distance of every pair of namespaces.
*/
static final float PREFILTER_THRESHOLD = 0.3f;
</Box>
);
}
if (visible.length === 0) {
</Box>
);
}
if (!data || data.pairs.length === 0) {
Comment on lines +98 to +99
export const namespacePairKey = (pair: NameSquattingNamespacePair): string =>
`${pair.target.name}/${pair.lookalike.name}`;

@netomi netomi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the namespaces view is a useful addition. Since this builds on #2437, the rebase and the points raised there carry over; besides the inline comments:

Paging and selection (Namespaces tab)

  • Pages are fetched by offset from a list that changes between requests (the 1-minute server cache, and allows applying at once), so a shrinking list silently skips pairs; mergeNamespacePairPages only handles duplicates.
  • namespacePairKey is built from target/look-alike, but which side is the target depends on live download counts, so a pair whose counts swap appears as both a/b and b/a and loses its selection after a refetch. An order-independent key (sorted names) avoids that.
  • The namespace allowlist search only filters loaded pages and shows "No allowed namespaces match this filter" while more pages remain.

Minor

  • useAllowNameSquattingNamespaces invalidates nameSquattingKeys.all, refetching every loaded collisions page with live probes although a namespace allow cannot change them; the namespaces prefix is enough.
  • The Javadoc of NameSimilarityField (and of NAMESPACE, "only ever reported alongside another field") no longer holds now that NAMESPACE marks namespace-pair allows.
  • forgetNamespacePairs() exists only for tests; an injectable cache or clock would avoid the extra method in the service.

* Trigram similarity a pair needs before its edit distance is computed, low enough to lose no pair
* within the allowed edits: it only spares the edit distance of every pair of namespaces.
*/
static final float PREFILTER_THRESHOLD = 0.3f;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.3 does lose pairs within the allowed edits: abcdefghi and abxdefxhi are 2 substitutions apart (allowed at 9 characters), but share only 4 of 16 pg_trgm trigrams, a similarity of 0.25. Two spread-out edits in a 9-10 character name break up to 6 trigrams, so such pairs are never found, and since compare() uses the same cutoff they cannot be allowed either. Either lower the threshold for the lengths that allow 2 edits (and measure the cost), or correct the Javadoc to state what is traded away.

select: mergeCollisionPages,
retry: false
retry: false,
refetchInterval: REFRESH_INTERVAL_MS

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Polling the collisions query refetches every loaded page of the infinite query, each running live trigram lookups for its candidates, every minute per open tab. That is a steady load on the database for an admin page left open; I would drop the interval here (a manual refresh is enough), or at least not poll infinite queries. It is also not mentioned in the changelog.

try {
pairs = namespacePairs.get(
Boolean.TRUE,
key -> namespaceSimilarity.findSimilarPairs(check.getStatementTimeout()));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The full pair lookup reuses the per-publish statement timeout (10 s by default), and a timed-out lookup is not cached, so on a large registry every 60 s refetch from each open Namespaces tab, and every "Try again", starts another full scan that fails with 503. This needs its own (larger) timeout, and the failure should be remembered for a while instead of retried on every request.

allow.setReason(reason);
allow.setDecidedById(admin.getId());
allow.setDecidedAt(TimeUtil.getCurrentUTC());
allows.save(allow);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same check-then-insert race as in allow() (see #2437): two concurrent allows of the same pair both pass the check, and the second violates name_similarity_allow_namespace_pair_idx with a 500 instead of "Already allowed".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants