-
Notifications
You must be signed in to change notification settings - Fork 10
Mcp improvements #189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mcp improvements #189
Changes from all commits
4116e7e
1786079
8599167
d9d4624
f065e81
5ad0f57
7d5ace6
c042ec9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,20 +31,27 @@ def is_non_loopback_http(redirect_uri: str) -> bool: | |
|
|
||
|
|
||
| def loopback_redirect_allowed(redirect_uri: str, allowed_uris) -> bool: | ||
| """RFC 8252 §7.3 — match a loopback redirect URI ignoring its port. | ||
| """RFC 8252 §7.3 — match a loopback ``http`` redirect URI ignoring its port. | ||
|
|
||
| Loopback hosts are treated as interchangeable (a client registered with | ||
| ``127.0.0.1`` may come back as ``localhost``); scheme, path and query must | ||
| still match a registered loopback URI exactly. | ||
| ``127.0.0.1`` may come back as ``localhost``); path and query must still | ||
| match a registered loopback URI exactly. | ||
|
|
||
| Port relaxation is confined to ``http`` — the only RFC 8252 §7.3 case and | ||
| the only scheme this validator deliberately permits for loopback hosts. | ||
| Custom/native schemes (``cursor://``, ``claude://``) stay on DOT's exact | ||
| match, which enforces ``ALLOWED_REDIRECT_URI_SCHEMES``; without this gate a | ||
| dynamically registered URI like ``javascript://localhost:1/callback`` could | ||
| slip past the scheme allowlist on a mere port mismatch. | ||
| """ | ||
| requested = urlsplit(redirect_uri) | ||
| if requested.hostname not in LOOPBACK_HOSTS: | ||
| if requested.scheme != "http" or requested.hostname not in LOOPBACK_HOSTS: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When an unauthenticated DCR request registers a non-http URI such as Useful? React with 👍 / 👎. |
||
| return False | ||
| for allowed in allowed_uris: | ||
| candidate = urlsplit(allowed) | ||
| if ( | ||
| candidate.hostname in LOOPBACK_HOSTS | ||
| and candidate.scheme == requested.scheme | ||
| candidate.scheme == "http" | ||
| and candidate.hostname in LOOPBACK_HOSTS | ||
| and candidate.path == requested.path | ||
| and candidate.query == requested.query | ||
| ): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a renamed group column's public name matches a derived aggregate alias, this initializes the slot with that group key and the later
slot[alias] = row[alias]assignment overwrites it. For example, an admin method namedcountbacked by@admin.display(ordering="id")withgroup_by=["count"]andaggregate=[{"fn": "count"}]now returns only the aggregate count undercount, losing the group value entirely; before this change the group value was at least kept under the ORM target. Please detect/reject these collisions or namespace one side before merging rows.Useful? React with 👍 / 👎.