fix(conf): use published IP list for ChatGPT-User verification#19
Open
adri wants to merge 1 commit intocnlangzi:mainfrom
Open
fix(conf): use published IP list for ChatGPT-User verification#19adri wants to merge 1 commit intocnlangzi:mainfrom
adri wants to merge 1 commit intocnlangzi:mainfrom
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR updates the ChatGPT-User bot configuration to follow OpenAI’s official recommendation: instead of verifying via rDNS and domains, it uses the published ChatGPT-User IP range list JSON and sets the appropriate parser. Sequence diagram for ChatGPT-User verification using published IP listsequenceDiagram
actor User
participant EdgeProxy
participant BotFirewall
participant AIAssist_chatgpt_user as AIAssist_chatgpt_user
participant IPListCache
participant OpenAI_IP_JSON as OpenAI_chatgpt_user_json
User->>EdgeProxy: HTTP request with ua ChatGPT-User
EdgeProxy->>BotFirewall: Forward request and headers
BotFirewall->>AIAssist_chatgpt_user: Evaluate bot config
AIAssist_chatgpt_user->>IPListCache: Get IP ranges for ChatGPT_User
alt cache_hit
IPListCache-->>AIAssist_chatgpt_user: Return cached IP ranges
else cache_miss
IPListCache->>OpenAI_IP_JSON: GET https://openai.com/chatgpt-user.json
OpenAI_IP_JSON-->>IPListCache: JSON with IP ranges
IPListCache-->>AIAssist_chatgpt_user: Parsed IP ranges
end
AIAssist_chatgpt_user->>AIAssist_chatgpt_user: Check client IP in IP ranges
alt ip_matches
AIAssist_chatgpt_user-->>BotFirewall: Mark as verified ChatGPT_User
BotFirewall-->>EdgeProxy: Allow with bot metadata
EdgeProxy-->>User: Response
else ip_not_in_ranges
AIAssist_chatgpt_user-->>BotFirewall: Not verified
BotFirewall-->>EdgeProxy: Apply nonbot rules
EdgeProxy-->>User: Response
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider documenting in the config (or a code comment nearby) why the
googleparser is appropriate forchatgpt-user.json, since the choice isn’t obvious from the name and might confuse future maintainers. - If your config/bot framework supports it, consider specifying or verifying reasonable refresh/timeout behavior for the
https://openai.com/chatgpt-user.jsonURL so failures or format changes don’t inadvertently block or misclassify traffic.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider documenting in the config (or a code comment nearby) why the `google` parser is appropriate for `chatgpt-user.json`, since the choice isn’t obvious from the name and might confuse future maintainers.
- If your config/bot framework supports it, consider specifying or verifying reasonable refresh/timeout behavior for the `https://openai.com/chatgpt-user.json` URL so failures or format changes don’t inadvertently block or misclassify traffic.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #19 +/- ##
===========================================
- Coverage 72.76% 61.80% -10.97%
===========================================
Files 15 24 +9
Lines 661 1000 +339
===========================================
+ Hits 481 618 +137
- Misses 136 324 +188
- Partials 44 58 +14 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Switch from RDNS-based verification to OpenAI's published IP range
list. RDNS is unreliable for OpenAI bots — the official docs recommend
using the JSON IP list at openai.com/chatgpt-user.json.
The "google" parser is used because OpenAI's JSON uses the same format
as Google's IP range lists ({"prefixes": [{"ipv4Prefix": ...}]}).
Ref: https://developers.openai.com/api/docs/bots
a723a28 to
3444c1b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Switch from RDNS-based verification to OpenAI's published IP range list. RDNS is unreliable for OpenAI bots — the official docs recommend using the JSON IP list at openai.com/chatgpt-user.json.
Ref: https://developers.openai.com/api/docs/bots
Summary by Sourcery
Switch ChatGPT-User bot verification to use OpenAI’s published IP range list instead of reverse DNS checks.
Bug Fixes:
Enhancements: