Skip to content

Fix social URL host matching - #1172

Closed
anirudh5harma wants to merge 1 commit into
supermemoryai:mainfrom
anirudh5harma:codex/code-scan-genuine-fixes
Closed

Fix social URL host matching#1172
anirudh5harma wants to merge 1 commit into
supermemoryai:mainfrom
anirudh5harma:codex/code-scan-genuine-fixes

Conversation

@anirudh5harma

@anirudh5harma anirudh5harma commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Parse social links as URLs before classifying Twitter/X and LinkedIn profile URLs
  • Match social domains by hostname instead of substring search
  • Add regression tests for spoofed LinkedIn paths and non-Twitter domains containing x.com/twitter.com text

Closes #1173

Tests

  • bun test apps/web/lib/url-helpers.test.ts
  • bun test apps/web/lib/*.test.ts
  • bunx biome check apps/web/lib/url-helpers.ts apps/web/lib/url-helpers.test.ts
  • bunx turbo run check-types --filter='@supermemory/ai-sdk' --filter='@supermemory/memory-graph'

Session Details

@vorflux

vorflux Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Vorflux skipped this auto review because this account has reached its Auto Review daily review limit (20/20). You can change this in Auto Review Settings: https://us1.vorflux.com/supermemory/settings?section=pull-requests

@vorflux vorflux Bot 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.

Found one edge-case regression in the social URL filtering.


Review with Vorflux

*/
export const isTwitterUrl = (url: string): boolean => {
const normalizedUrl = url.toLowerCase()
const parsed = parseWebUrl(url)

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.

This hostname-based check works for raw uppercase-scheme inputs, but collectValidUrls calls normalizeUrl before this helper. Because normalizeUrl("HTTP://x.com/foo") becomes https://HTTP://x.com/foo, this helper sees hostname http and collectValidUrls("", ["HTTP://x.com/foo"]) now keeps the Twitter link instead of filtering it. Making normalizeUrl detect http(s):// case-insensitively, plus a regression case through collectValidUrls, should preserve the intended behavior.

@anirudh5harma
anirudh5harma deleted the codex/code-scan-genuine-fixes branch June 27, 2026 21:29
@anirudh5harma

Copy link
Copy Markdown
Contributor Author

Superseded by #1174 after renaming the head branch to match issue #1173. GitHub closed this cross-repo PR when the fork branch was renamed.

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.

Social URL detection matches domains by substring

1 participant