Skip to content
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

Use proxy requests #175

Merged
merged 1 commit into from
Feb 19, 2024
Merged

Use proxy requests #175

merged 1 commit into from
Feb 19, 2024

Conversation

ruihildt
Copy link
Member

@ruihildt ruihildt commented Jul 21, 2023

This PR replace the custom proxy implementation which is browser wide with a targeted approach, where each requests is intercepted and proxied according to the user choice.

Fixes #8 #25 #188 #183 #179

@ruihildt ruihildt force-pushed the use-proxy-requests branch 2 times, most recently from d9e888c to 438b356 Compare August 15, 2023 08:50
@ruihildt ruihildt force-pushed the use-proxy-requests branch 3 times, most recently from 00ffe9a to 26c9aef Compare August 22, 2023 11:12
@ruihildt ruihildt self-assigned this Feb 2, 2024
@ruihildt ruihildt added the proxy This is related to the socks proxy feature label Feb 2, 2024
@ruihildt ruihildt force-pushed the use-proxy-requests branch 3 times, most recently from 72c50f2 to 372518d Compare February 5, 2024 14:33
@ruihildt ruihildt requested a review from hankolsen February 7, 2024 15:00
@ruihildt ruihildt marked this pull request as ready for review February 7, 2024 15:01
@ruihildt
Copy link
Member Author

ruihildt commented Feb 7, 2024

@hankolsen There are still some little ajustements to be made, but the bulk of the feature change (allow setting proxy per site) is implemented.

I realize this is is a bigger change than usual, so if I can help in any way, please let me know.

src/components/CurrentProxyDetails.vue Outdated Show resolved Hide resolved
@ruihildt ruihildt force-pushed the use-proxy-requests branch 2 times, most recently from f467664 to e7f46dc Compare February 8, 2024 15:14
@BionicBison05
Copy link

One thing I noticed while test-driving a build of this branch in Mullvad Browser after temporarily disabling extension signing so it would persist across browser restarts is that whenever the extension is opened on a new website, it saves a "socks disabled" config entry for that URL into local storage which persists across browser restarts. While Mullvad Browser no doubt targets a lower threat model than Tor Browser, I'd say this could still be a concern for users who are under the impression that their history is completely wiped each time the browser is closed. While it's pretty obvious that a website URL must be saved in order to make a specific proxy configuration for it, it's less obvious that this is happening even when the extension is simply opened but no configuration change is made. I'd propose only storing the website when the user makes a change to its configuration, and possibly wiping a website from storage when its proxy setting is disabled, at least once the current session ends so there's no cross-session history being saved if there doesn't have to be.

@ruihildt
Copy link
Member Author

Historically, we created this config automatically so that you could connect to the current server proxy directly (which was the only thing that you could do with OpenVPN).

But since we don't support OpenVPN anymore, it indeed make sense to get rid of that behavior.

I'd propose only storing the website when the user makes a change to its configuration, and possibly wiping a website from storage when its proxy setting is disabled, at least once the current session ends so there's no cross-session history being saved if there doesn't have to be.

This is at odds with the current Frequent/Recent feature. I imagine that having a custom list similarly as the Mullvad VPN app does would partially alleviate that concern, since having a proxy listed doesn't mean that you have connected at a specific point in time. It would probably have the same benefits.

@ruihildt
Copy link
Member Author

@BionicBison05 I realize I have misunderstood the issue you noted. I confused the proxy history entries with the host proxy entry, which reveals the visited websites.

Working on a fix.

@BionicBison05
Copy link

Fix appears to be working on my end regarding autogeneration of host-based configs. I'm still a little concerned about the lack of ability to wipe a host-based config once it is created, short of reinstalling the extension or wiping local browser data the manual way. Maybe some sort of delete button could be implemented to give users the option to manage this themselves, sort of like this rough mockup:

4273472B-8C1D-4D71-AA6E-A51FE441C44F

Ultimately up to you how far this risk should be mitigated, though.

@ruihildt
Copy link
Member Author

ruihildt commented Feb 16, 2024

In a future version, it is planned to add a page to deal with all domain specific proxies, and a button to delete them will be added.

const currentHostProxyDNSEnabled = computed(() => currentHostProxyDetails.value?.proxyDNS ?? false);

const setProxyDetails = (proxyDetails: Ref<ProxyDetails>, enabled: boolean) => {
proxyDetails.value = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you just do proxyDetails.value.socksEnabled = enabled instead of spreading the current value?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably old React/Redux immutability remnants from the past resurfacing.^^"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems I can get rid of this setProxyDetails function entirely actually.

setProxyDetails(globalProxyDetails, !globalProxyDetails.value.socksEnabled);
};
const toggleCurrentHostProxy = () => {
hostProxiesDetails.value[activeTabHost.value] = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you just do hostProxiesDetails.value[activeTabHost.value].socksEnabled = !currentHostProxyEnabled.value instead of spreading the current value?


await updateConnection();
globalProxyDetails.value = { ...globalProxyDetails.value, proxyDNS: updatedGlobalProxyDNS };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, do you need to spread here?


await updateConnection();
globalProxyDetails.value = { ...globalProxyDetails.value, proxyDNS: updatedGlobalProxyDNS };
globalProxy.value = { ...globalProxy.value, proxyDNS: updatedGlobalProxyDNS };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, do you need to spread here?

socksDetails.value = {
socksEnabled: false,
hostProxiesDetails.value[activeTabHost.value] = {
...hostProxiesDetails.value[activeTabHost.value],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, do you need to spread here?

proxyDNS: updatedCurrentHostProxyDNS,
};
hostProxies.value[activeTabHost.value] = {
...hostProxies.value[activeTabHost.value],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, do you need to spread here?

proxiedHosts.includes(currentHost) &&
hostProxiesDetailsParsed[currentHost].socksEnabled
) {
// console.log(`host proxy "${currentHost}" used for :`, details.url);
Copy link
Collaborator

@hankolsen hankolsen Feb 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove stuff that is not used?

src/helpers/socksProxy.ts Show resolved Hide resolved
This is a major refactor of the way proxy work in the extension.
Instead of a proxy config being used for the whole browser,
each requests are intercepted and can use a specific proxy config
based on arbitrary rules.

The use of the pageAction is removed, because it is non-standard and will eventually be removed by Firefox.

Finally, the interface has been adapted and improved.
@ruihildt ruihildt merged commit de538a7 into main Feb 19, 2024
1 check passed
@ruihildt ruihildt deleted the use-proxy-requests branch February 19, 2024 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proxy This is related to the socks proxy feature
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Ability to set different socks per domain/ip
3 participants