Skip to content

Fix LeetCode detection via GraphQL API - #3069

Open
siddharthaasal wants to merge 1 commit into
sherlock-project:masterfrom
siddharthaasal:fix/leetcode-graphql-detection
Open

Fix LeetCode detection via GraphQL API#3069
siddharthaasal wants to merge 1 commit into
sherlock-project:masterfrom
siddharthaasal:fix/leetcode-graphql-detection

Conversation

@siddharthaasal

Copy link
Copy Markdown

Problem

LeetCode is currently reported as not found for every username. Two things changed on LeetCode's side:

  1. Profiles moved from https://leetcode.com/{} to https://leetcode.com/u/{}/.
  2. Direct profile requests now return HTTP 403 for everyone (bot protection), so status_code detection can never succeed.

Fix

Switch LeetCode to its public GraphQL API (matchedUser query) and detect the "That user does not exist." error message returned for missing users. This mirrors the existing Anilist entry, which already uses a POST + GraphQL urlProbe + request_payload pattern. The display url is also updated to the new /u/{}/ path.

"LeetCode": {
  "errorMsg": "That user does not exist.",
  "errorType": "message",
  "request_method": "POST",
  "request_payload": {
    "query": "query getUserProfile($username: String!) { matchedUser(username: $username) { username } }",
    "variables": { "username": "{}" }
  },
  "url": "https://leetcode.com/u/{}/",
  "urlMain": "https://leetcode.com/",
  "urlProbe": "https://leetcode.com/graphql",
  "username_claimed": "blue"
}

Testing

  • test_manifest.py schema validation — passes
  • test_validate_targets.py false-negative (LeetCode) — passes (known user → Claimed)
  • test_validate_targets.py false-positive (LeetCode) — passes (random users → Available)

Verified manually:

  • sherlock siddharthaasal --site LeetCode → found
  • random/nonexistent username → not found

LeetCode moved profiles to /u/{username}/ and now serves 403 for all
direct profile requests, breaking status_code detection (every username
reported as not found).

Switch to LeetCode's GraphQL API (matchedUser query) and detect the
"That user does not exist." error message, mirroring the existing
Anilist entry. Also updates the display url to the new /u/{}/ path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Automatic validation of changes

Target F+ Check F- Check
LeetCode ✔️   Pass ✔️   Pass

@siddharthaasal

Copy link
Copy Markdown
Author

hi, any updates on this? is there anything on my end that I can offer help with?

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.

1 participant