Skip to content

[clientpython] fix(backend): no more cookies by default (#209)#210

Open
guzmud wants to merge 1 commit intomainfrom
fix/209-no-more-cookies
Open

[clientpython] fix(backend): no more cookies by default (#209)#210
guzmud wants to merge 1 commit intomainfrom
fix/209-no-more-cookies

Conversation

@guzmud
Copy link
Copy Markdown
Member

@guzmud guzmud commented Apr 21, 2026

Proposed changes

  • Setting the default cookie policy for RequestsBackend to allow only the following domains: []

Testing Instructions

>>> from pyoaev.backends.backend import RequestsBackend
>>> backend = RequestsBackend()
# this request will provide in answer the cookie that is supposed to be set
>>> backend .http_request("GET", 'https://httpbin.org/cookies/set/sessioncookie/123456789').content
b'{\n  "cookies": {\n    "sessioncookie": "123456789"\n  }\n}\n'
# this request will provide in answer the cookies that were sent by the request
>>> backend .http_request("GET", 'https://httpbin.org/cookies').content
b'{\n  "cookies": {}\n}\n'

Related issues

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality
  • I wrote test cases for the relevant uses case
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality
  • For bug fix -> I implemented a test that covers the bug

Further comments

Two technical suggestions for blocking cookies while keeping the shared Session object: either create a custom CookiePolicy that blocks everything or use the default one but have an empty list as the list of allowed domains.

The custom CookiePolicy seemed to have more potential side-effects + if we need to in the future we can turn the allowed_domains into a parameter that will configure the backend (while still having the empty list as default).

Screenshots

A new test was added to check the session's cookie policy, whether is was not at None (the default that would mean accepting all) but still a len(0) (so an empty set so accept nothing).

new test before fix

Screenshot 2026-04-21 161039

new test after fix

Screenshot 2026-04-21 161216

@guzmud guzmud added bug use for describing something not working as expected critical use to identify critical bug to fix ASAP labels Apr 21, 2026
@github-actions github-actions Bot added the filigran team use to identify PR from the Filigran team label Apr 21, 2026
@guzmud guzmud force-pushed the fix/209-no-more-cookies branch from 83ecc59 to 7f6fb45 Compare April 21, 2026 14:32
@guzmud guzmud changed the title [client-python] fix(backend): no more cookies by default (#209) [clientpython] fix(backend): no more cookies by default (#209) Apr 21, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.41%. Comparing base (db62aef) to head (7f6fb45).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #210      +/-   ##
==========================================
+ Coverage   70.39%   70.41%   +0.02%     
==========================================
  Files          58       58              
  Lines        2327     2329       +2     
==========================================
+ Hits         1638     1640       +2     
  Misses        689      689              
Flag Coverage Δ
connectors 70.41% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug use for describing something not working as expected critical use to identify critical bug to fix ASAP filigran team use to identify PR from the Filigran team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Injectors trigger the CSRF protection by sending cookies with requests

3 participants