zotero / zotero-connectors

Chrome, Firefox, Edge, and Safari extensions for Zotero
https://www.zotero.org/download/connectors
Other
480 stars 119 forks source link

Proxies: add more sophisticated proxy redirection loop prevention #421

Closed adomasven closed 1 year ago

adomasven commented 1 year ago

Regression from 13c45cb6 Reports in https://forums.zotero.org/discussion/102507/zotero-causing-continuous-article-download-request-loop

Changes in 13c45cb6 made us redirect to ezproxy resources via the /login?url= links which is the appropriate way to redirect via proxy instead of manually rewriting urls to their final form however this type of redirection causes multiple requests and so the unsophisticated single-request proxy loop prevention code was no longer sufficient.

This commit adds a more sophisticated system that watches tabs after redirection to ensure they don't end up navigating back to the original URL for a set number of navigation events. If the tab ends up looping we add a temporary block to proxy redirection and show a message in preferences with a button to reenable automatic redirection.

image

I'm slightly worried this will cause false postives. Monitoring is per-tab so following a bunch of unproxied links in new tabs won't cause the block, but copying and pasting unproxied links to the same tab multiple times will. I'm not sure this is a very common workflow at all.

You may force the proxy redirection blocking by navigating to some website that has automatic proxy redirection, causing Zotero to redirect, then navigating back to that same domain manually (by typing/pasting URL). Pressing back won't force the block since that would cause accidental false-positives.