Skip to content

Add the name squatting dashboard view + required functionality/indexes - #2437

Open
autumnfound wants to merge 10 commits into
mainfrom
malowe/main/name-squatting-dashboard
Open

autumnfound wants to merge 10 commits into
mainfrom
malowe/main/name-squatting-dashboard

Conversation

@autumnfound

Copy link
Copy Markdown
Contributor

This PR adds the name squatting dashboard view and functionality with the below general changesets.

  1. 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.

  2. 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.

  3. 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.

changes pulled from Claude commit messages for simplicity + clarity

@autumnfound

Copy link
Copy Markdown
Contributor Author

Local live previews with fake data

image image

@gnugomez

Copy link
Copy Markdown
Member

looks pretty good so far, nice work!

if you don't mind I'll be doing some changes to the UI just to improve a bit the UX overall, but will be really minimal, also trying to be consistent.

@autumnfound

Copy link
Copy Markdown
Contributor Author

if you don't mind I'll be doing some changes to the UI just to improve a bit the UX overall, but will be really minimal, also trying to be consistent.

Sounds good! I tried to guide the AI to be somewhat consistent, but I do recognize there are still some bumps haha

@autumnfound
autumnfound force-pushed the malowe/main/name-squatting-dashboard branch from 4561db2 to eccd120 Compare November 11, 2026 20:15
@autumnfound
autumnfound added this pull request to stack #2448 November 12, 2026 16:32
@autumnfound
autumnfound force-pushed the malowe/main/name-squatting-dashboard branch from eccd120 to b2eb1c1 Compare November 12, 2026 18:21
@autumnfound
autumnfound requested a balanced review from Copilot November 19, 2026 16:44

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

The configuration baseline incorrectly lists documented properties, causing the configuration check to fail, and unresolved pagination, matching, and bulk-removal retry defects remain.

5 open issues
8 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/Public.java: Generated file
  • server/src/main/jooq-gen/org/eclipse/openvsx/jooq/Sequences.java: Generated file
  • server/src/main/jooq-gen/org/eclipse/openvsx/jooq/Tables.java: Generated file
  • server/src/main/jooq-gen/org/eclipse/openvsx/jooq/tables/ExtensionValidationFailure.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

Adds name-squatting review to Open VSX, connecting advisory publish-time similarity checks with an admin dashboard for reviewing collisions and managing allowed pairs.

Changes:

  • Adds trigram indexes, pair-allowlist storage, and a non-blocking NAME_SIMILARITY publish check.
  • Introduces permission-protected admin endpoints and dashboard actions to allow pairs or delete extensions.
  • Adds server and UI tests, configuration documentation, and upgrade notes.
File Description
webui/​test/​unit/​pages/​admin-dashboard/​name-squatting/​name-squatting.spec.tsx Tests tab navigation and linked tab selection.
webui/​test/​unit/​pages/​admin-dashboard/​name-squatting/​name-squatting-model.spec.ts Tests filtering, similarity formatting, and page merging.
webui/​test/​unit/​pages/​admin-dashboard/​name-squatting/​name-diff.spec.ts Tests character-difference highlighting.
webui/​test/​unit/​pages/​admin-dashboard/​name-squatting/​collisions-tab.spec.tsx Tests collision display, pagination, and admin actions.
webui/​test/​unit/​pages/​admin-dashboard/​name-squatting/​allowlist-tab.spec.tsx Tests allowlist filtering and removal flows.
webui/​test/​unit/​admin-name-squatting-request.spec.ts Tests endpoint URLs and mutation payloads.
webui/​src/​pages/​admin-dashboard/​name-squatting/​use-name-squatting.ts Adds query hooks, page merging, and mutations.
webui/​src/​pages/​admin-dashboard/​name-squatting/​remove-allows-dialog.tsx Adds confirmation for removing allowed pairs.
webui/​src/​pages/​admin-dashboard/​name-squatting/​name-squatting.tsx Adds the dashboard page and URL-backed tabs.
webui/​src/​pages/​admin-dashboard/​name-squatting/​name-squatting-styles.ts Defines shared dashboard layouts and table styles.
webui/​src/​pages/​admin-dashboard/​name-squatting/​name-squatting-parts.tsx Adds extension identities and name comparisons.
webui/​src/​pages/​admin-dashboard/​name-squatting/​name-squatting-model.ts Implements filtering and display helpers.
webui/​src/​pages/​admin-dashboard/​name-squatting/​name-diff.ts Computes case-insensitive character differences.
webui/​src/​pages/​admin-dashboard/​name-squatting/​delete-extension-dialog.tsx Adds confirmation for deleting extension versions.
webui/​src/​pages/​admin-dashboard/​name-squatting/​collisions-tab.tsx Displays collision groups, filters, and loading states.
webui/​src/​pages/​admin-dashboard/​name-squatting/​collision-group.tsx Renders grouped matches and resolution actions.
webui/​src/​pages/​admin-dashboard/​name-squatting/​allowlist-tab.tsx Displays grouped allows and removal controls.
webui/​src/​pages/​admin-dashboard/​name-squatting/​allow-dialog.tsx Adds pair approval with an optional reason.
webui/​src/​pages/​admin-dashboard/​admin-dashboard.tsx Registers permission-gated navigation and routing.
webui/​src/​pages/​admin-dashboard/​admin-dashboard-routes.ts Defines the name-squatting route.
webui/​src/​extension-registry-types.ts Defines dashboard request and response types.
webui/​src/​extension-registry-service.ts Adds name-squatting admin service methods.
webui/​CHANGELOG.md Documents the dashboard and client API additions.
server/​src/​test/​java/​org/​eclipse/​openvsx/​scanning/​NameSimilarityCheckServiceTest.java Tests advisory checks and allowed-pair exclusions.
server/​src/​test/​java/​org/​eclipse/​openvsx/​scanning/​NameSimilarityCheckConfigTest.java Tests configuration defaults, binding, and validation.
server/​src/​test/​java/​org/​eclipse/​openvsx/​repositories/​NameSimilarityJooqRepositoryTest.java Tests matching, indexes, candidate paging, and timeouts.
server/​src/​test/​java/​org/​eclipse/​openvsx/​repositories/​NameSimilarityAllowRepositoryTest.java Tests pair uniqueness and deletion behavior.
server/​src/​test/​java/​org/​eclipse/​openvsx/​repositories/​JooqOnlyTestConfig.java Registers the similarity repository for tests.
server/​src/​test/​java/​org/​eclipse/​openvsx/​admin/​NameSquattingServiceTest.java Tests collision grouping and allowlist operations.
server/​src/​main/​resources/​db/​migration/​V1_87__Name_Similarity_Indexes.sql Adds trigram and flagged-candidate indexes.
server/​src/​main/​resources/​db/​migration/​V1_86__Name_Similarity_Allowlist.sql Enables pg_trgm and creates allowlist storage.
server/​src/​main/​jooq-gen/​org/​eclipse/​openvsx/​jooq/​tables/​records/​NameSimilarityAllowRecord.java Adds the generated allowlist record mapping.
server/​src/​main/​jooq-gen/​org/​eclipse/​openvsx/​jooq/​tables/​NameSimilarityAllow.java Adds the generated allowlist table mapping.
server/​src/​main/​jooq-gen/​org/​eclipse/​openvsx/​jooq/​tables/​ExtensionValidationFailure.java Includes the new failure index in generated metadata.
server/​src/​main/​jooq-gen/​org/​eclipse/​openvsx/​jooq/​Tables.java Exposes the generated allowlist table reference.
server/​src/​main/​jooq-gen/​org/​eclipse/​openvsx/​jooq/​Sequences.java Adds the generated allowlist sequence reference.
server/​src/​main/​jooq-gen/​org/​eclipse/​openvsx/​jooq/​Public.java Registers generated schema additions.
server/​src/​main/​jooq-gen/​org/​eclipse/​openvsx/​jooq/​Keys.java Adds generated allowlist key metadata.
server/​src/​main/​jooq-gen/​org/​eclipse/​openvsx/​jooq/​Indexes.java Adds generated index references.
server/​src/​main/​java/​org/​eclipse/​openvsx/​scanning/​NameSimilarityCheckService.java Implements advisory similarity checks and allow exclusions.
server/​src/​main/​java/​org/​eclipse/​openvsx/​scanning/​NameSimilarityCheckConfig.java Defines and validates similarity settings.
server/​src/​main/​java/​org/​eclipse/​openvsx/​repositories/​NameSimilarityJooqRepository.java Implements similarity queries and candidate discovery.
server/​src/​main/​java/​org/​eclipse/​openvsx/​repositories/​NameSimilarityAllowRepository.java Provides allowlist queries and persistence operations.
server/​src/​main/​java/​org/​eclipse/​openvsx/​json/​NameSquattingJson.java Defines admin endpoint payloads.
server/​src/​main/​java/​org/​eclipse/​openvsx/​entities/​NameSimilarityField.java Defines comparable name fields.
server/​src/​main/​java/​org/​eclipse/​openvsx/​entities/​NameSimilarityAllow.java Models allowed pairs and decision details.
server/​src/​main/​java/​org/​eclipse/​openvsx/​admin/​NameSquattingService.java Coordinates live collision grouping and allowlist management.
server/​src/​main/​java/​org/​eclipse/​openvsx/​admin/​NameSquattingAPI.java Exposes permission-protected dashboard endpoints.
server/​src/​dev/​resources/​application.yml Adds development similarity settings.
server/​scripts/​config-properties-baseline.txt Adds similarity-property baseline entries.
server/​CHANGELOG.md Documents server behavior and migration considerations.
doc/​configuration.md Documents similarity settings and timeout behavior.

Review effort: Balanced

@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 overall approach (non-enforced check, live re-probing, pair allowlist) looks good. A few things before this can go in:

Before merging

  • The branch conflicts with main (it is based on the pre-1.4.0 84f06f58), and no CI checks have run on the head commit. Please rebase so CI runs; the configuration-baseline issue Copilot flagged will otherwise fail the configuration check.
  • Copilot's other open items still apply: the match limit applied before the partner filter, the page offset when fetching an extra row, bulk-removal retries not skipping already removed IDs, and the duplicate doc anchors.

Load

  • One collisions request can run up to MAX_BATCHES x size candidates, each with several separately timed probes. statement-timeout bounds a single statement, not the request, so one request can hold a DB connection for minutes. Please bound the request as a whole (fewer batches, or an overall deadline).
  • withStatementTimeout reads and restores statement_timeout around every lookup, two extra round trips per probe. Setting it once per transaction would be enough, as SET LOCAL ends with it.

Deployment and docs

  • V1_87 builds the GIN indexes without CONCURRENTLY and blocks writes to extension_version and extension while doing so. That is fine as documented, we will build them out of band for open-vsx.org.
  • Per the repo's AGENTS.md, please trim the 20-line header of V1_87 to the non-obvious constraint (1-3 lines; the rest belongs in the PR or docs), keep the changelog entries to one line each, and link this PR from them.

private NameSquattingJson.Collisions lookUpCollisions(int offset, int size) {
var pairs = new LinkedHashMap<Long, Pair>();
var probed = new HashSet<Long>();
var cursor = offset;

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.

Paging by numeric offset into a list ordered most recently flagged first shifts with every new flag: extensions flagged between two "Load more" calls push already shown candidates into the next page (repeats), and allowlist changes reorder the shared-display-name tail (skips). A keyset cursor (detected_at, scan_id), which the new index already supports, would keep pages stable.

autumnfound and others added 9 commits November 24, 2026 13:36
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>
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>
Removed undocumented properties related to name similarity scanning.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Martin Lowe <mtlowe@live.ca>
Look-alikes are now grouped under the earliest extension they resemble
whichever page finds them: lookups keep the earliest published matches
within the limit and exclude allowed partners in SQL, and look-alikes
found only from their anchor's side are looked up from their own.

Allow looks up the requested partner alone, from either side, so the
match limit can no longer reject a pair that still resembles.

The allowlist pages through a Slice, which no longer skips a group at
every page boundary.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Add error handling for removeNameSquattingAllow mutation

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Martin Lowe <mtlowe@live.ca>
Collision lookups stop starting new candidates once a request has run
for one statement timeout, and resume from the returned cursor. Extensions
sharing a display name page by id, so removals no longer skip one.

Allowing probes outside any transaction, maps a statement timeout to 503,
and inserts with ON CONFLICT DO NOTHING so a concurrent allow answers
"Already allowed". Each lookup sets its timeout and threshold in one
statement.

The dashboard takes allowed pairs off the loaded collisions instead of
refetching every page, retries bulk removals past allows already gone,
and keys match rows by their values.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Moves the CONCURRENTLY instructions for V1_87 into doc/deployment.md,
cuts the migration header to its constraints, and keeps the changelog
entries to one line each with a link to the pull request.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
The request budget now only limits starting candidate lookups: the
look-alikes found are always anchored at their earliest match, so a
page that runs out of time can no longer list one under two anchors.

Allowing a pair cancels a collisions batch still loading, which would
otherwise write the allowed pair back when it lands.

Nested records in the name similarity repository, service and tests
move to the end of their classes, and the walk constants join the
others at the top.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
@autumnfound
autumnfound force-pushed the malowe/main/name-squatting-dashboard branch from b968d20 to 0ec30e0 Compare November 25, 2026 14:19
@autumnfound
autumnfound requested a balanced review from Copilot November 25, 2026 14:19

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

Filtering allowed partners after query limits and skipping explicit display names can miss collisions, while asymmetric matching can place the same extension in multiple paginated groups.

3 open issues
5 resolved since last review
8 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/Public.java: Generated file
  • server/src/main/jooq-gen/org/eclipse/openvsx/jooq/Sequences.java: Generated file
  • server/src/main/jooq-gen/org/eclipse/openvsx/jooq/Tables.java: Generated file
  • server/src/main/jooq-gen/org/eclipse/openvsx/jooq/tables/ExtensionValidationFailure.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

Review effort: Balanced

Comment on lines +258 to +259
var candidate = new Candidate(lookalikeId, pairs.get(lookalikeId).flaggedAt());
found.addAll(lookUp(candidate, lookalikeNames, allowed.getOrDefault(lookalikeId, Set.of())));
Comment on lines +104 to +106
var displayNames = displayName == null || displayName.equals(extensionName)
? List.<String>of()
: List.of(displayName);
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Martin Lowe <mtlowe@live.ca>
@autumnfound
autumnfound force-pushed the malowe/main/name-squatting-dashboard branch from 42c0db7 to 9e33000 Compare November 25, 2026 20:29
@autumnfound

Copy link
Copy Markdown
Contributor Author

One collisions request can run up to MAX_BATCHES x size candidates, each with several separately timed probes. statement-timeout bounds a single statement, not the request, so one request can hold a DB connection for minutes. Please bound the request as a whole (fewer batches, or an overall deadline).

  • NameSquattingService.java:112-133: findCollisions now gets a time budget equal to the statement timeout and builds two deadlines:
    • Candidates: no new candidate lookups after half the budget.
    • Anchoring: anchorAtTheEarliest stops after the full budget.
  • :161-163: no new batch starts after the candidate deadline. The first batch always runs.
  • :211-231 (collectPairs): checks the deadline before each candidate. !probed.isEmpty() guarantees at least one candidate per request, so paging always moves forward. It returns how many candidates it handled (lookedUp). Inactive or missing candidates still count, so they get skipped rather than retried forever.
  • :170-182: the cursor advances only past the candidates actually handled. When the deadline cut a batch short (lookedUp < candidates.size()), it sets hasMore = true and breaks, and the next page resumes there.
  • :260-262: look-alikes not re-anchored before the deadline stay under the anchor they were found from.
  • doc/configuration.md:931 documents this.

withStatementTimeout reads and restores statement_timeout around every lookup, two extra round trips per probe. Setting it once per transaction would be enough, as SET LOCAL ends with it.

  • NameSimilarityJooqRepository.java:686-697: withStatementTimeout is gone. The new setLocal(tx, timeout, threshold) sends both set_config(..., true) calls in one SELECT and doesn't restore anything. A transaction-local setting ends with its transaction anyway.
  • :231 (findSimilar) and :247-252 (applySettings, formerly applyThreshold): set timeout and threshold together.
  • :412 (findCandidates): sets only the timeout.
  • :52-54: the class Javadoc now says callers must not share the transaction, because the setting stays in place.

Copilot's other open items still apply: the match limit applied before the partner filter, the page offset when fetching an extra row, bulk-removal retries not skipping already removed IDs, and the duplicate doc anchors.

These should all be resolved with my earlier patches as well.

Per the repo's AGENTS.md, please trim the 20-line header of V1_87 to the non-obvious constraint (1-3 lines; the rest belongs in the PR or docs), keep the changelog entries to one line each, and link this PR from them.

  • V1_87__Name_Similarity_Indexes.sql:1-3: the 20-line header becomes 3 lines with the two real constraints:

    • why it isn't CONCURRENTLY;
    • that the display-name expression must match the repository's query, or the planner falls back to a sequential scan.

    The comment on the third index (:17) shrinks to one line. Editing the comment is fine because the migration hasn't shipped in a release.

  • doc/deployment.md:160-183: new section "Building the Name Similarity Indexes Without a Write Pause". The removed header text lives here now: why CONCURRENTLY hangs inside Flyway, the 5 s lock_timeout, ready-to-run CREATE INDEX CONCURRENTLY IF NOT EXISTS SQL, and the warning to drop an invalid index after a failed build. This matches netomi's note that open-vsx.org will build the indexes out of band.

  • server/CHANGELOG.md:12-14: three one-line entries, each linking Add the name squatting dashboard view + required functionality/indexes #2437. The upgrade entry links the new deployment section instead of telling readers to look in V1_87.

  • webui/CHANGELOG.md:10: the same trim and PR link.

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