fix: prevent query params leaking into typed session dict#857
Closed
temrjan wants to merge 1 commit intoAnswerDotAI:mainfrom
Closed
fix: prevent query params leaking into typed session dict#857temrjan wants to merge 1 commit intoAnswerDotAI:mainfrom
temrjan wants to merge 1 commit intoAnswerDotAI:mainfrom
Conversation
Move session name check before `anno is dict` in `_find_p` so that `session: dict` returns the actual session scope instead of the merged data dict (which includes query parameters). Fixes AnswerDotAI#845 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
9e714c2 to
c01c748
Compare
Author
Contributor
|
I don't think AI is going to be able to make effective PRs to this repo - sorry; will need careful human attention! |
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.
Summary
Fixes #845. Replaces #854 (closed — was editing
.pydirectly instead of the nbdev notebook).When a session parameter is type-hinted as
dict, query parameters leak into the session becauseif anno is dict: return datain_find_pfires before the session name check. Since_find_psmerges query params intodata, this returns contaminated data instead of the actual session.Fix
Add a session name check before
anno is dictin_find_p(innbs/api/00_core.ipynbCell 47):One line, same pattern used throughout
_find_p.Changes
nbs/api/00_core.ipynb— source notebook fixfasthtml/core.py— regenerated from notebooktests/test_toaster.py—test_get_toaster_with_typehintnow sets a toast before checking the typed endpointTest plan
test_get_toaster_with_typehintpasses (was failing on main)test_toaster.pypassdict-annotated params still getdata