Repository navigation
Conversation
|
Thanks for the pull requests. The tests typically mock the authentication API provider, check existing tests for inspiration. Documentation should be added to https://github.com/python-social-auth/social-docs/. |
|
@codex review |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1986 +/- ##
==========================================
- Coverage 97.04% 97.03% -0.01%
==========================================
Files 371 373 +2
Lines 22455 22515 +60
Branches 1354 1356 +2
==========================================
+ Hits 21791 21847 +56
- Misses 468 470 +2
- Partials 196 198 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for the adjustment, but this still lacks tests and documentation. |
|
Yes, I'm currently very busy. It will come at some point. |
6739556 to
ae3f781
Compare
8763ef7 to
40dd2f3
Compare
|
Ok, hopefully all lints will pass now |
6a44647 to
11680ea
Compare
This commit introduce support for the CAS protocol using python-cas library.
|
I think this is good to merge now (will trigger AI review now to confirm that) besides the missing documentation. Please create a matching pull request against https://github.com/python-social-auth/social-docs. @codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00dda2fc1c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ticket = self.strategy.request_data().get("ticket") | ||
| user, attributes, _pgtiou = client.verify_ticket(ticket) |
There was a problem hiding this comment.
Correlate CAS tickets with the initiating session
auth_complete accepts any ticket that validates for the shared static redirect_uri, without checking that this browser started the flow. An attacker can stop the redirect for a ticket issued to their own CAS account and send that callback URL to a victim; an anonymous victim is logged into the attacker's account, and an authenticated victim in an integration that passes the current user to do_complete can associate a fresh attacker CAS identity with the victim's local account. Put a session nonce in the CAS service URL and validate it before accepting the ticket.
AGENTS.md reference: AGENTS.md:L96-L98
Useful? React with 👍 / 👎.
| def auth_complete(self, *args, **kwargs): | ||
| client = self.get_cas_client() | ||
| ticket = self.strategy.request_data().get("ticket") | ||
| user, attributes, _pgtiou = client.verify_ticket(ticket) |
There was a problem hiding this comment.
Route CAS ticket validation through the shared HTTP client
python-cas performs verify_ticket with its own requests call, so every callback bypasses BaseAuth.request: REQUESTS_TIMEOUT, PROXIES, VERIFY_SSL, the configured user agent, and structured HTTP error mapping are ignored. This makes proxy-only deployments fail and lets an unresponsive CAS validation endpoint tie up workers past the configured timeout; perform the validation via the backend's request helper while retaining the CAS response parsing.
AGENTS.md reference: AGENTS.md:L49-L51
Useful? React with 👍 / 👎.
| client = self.get_cas_client() | ||
| ticket = self.strategy.request_data().get("ticket") | ||
| user, attributes, _pgtiou = client.verify_ticket(ticket) | ||
| if user is None or attributes is None: |
There was a problem hiding this comment.
Accept successful CAS 1 responses without attributes
When SOCIAL_AUTH_CAS_VERSION is 1, python-cas's CASClientV1 returns (user, None, None) on successful validation because CAS 1 has no attributes, so this condition rejects every valid V1 ticket even though get_cas_client advertises and constructs that client. Treat a non-null user as success and normalize missing attributes to an empty mapping before merging.
Useful? React with 👍 / 👎.
| cas = [ | ||
| "python-cas>=1.7.2" | ||
| ] |
There was a problem hiding this comment.
Record the new CAS backend in Unreleased
This adds a user-visible backend and installation extra, but CHANGELOG.md has no corresponding entry under Unreleased, so the next release would ship support without the repository's required release record. Add a concise Added entry before merging.
AGENTS.md reference: AGENTS.md:L80-L82
Useful? React with 👍 / 👎.
This commit introduces support for the CAS protocol using python-cas library.
It is tested using zulip (for the client) and django-cas-server (for the cas server).
I'm not very confident about how to write the test for this. I'm interested to know if you recommend any code or documentation interesting to get that task done