Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor Browser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Applications
Tor Browser
Commits
b6249f7f
Verified
Commit
b6249f7f
authored
Mar 30, 2023
by
Pier Angelo Vendrame
Browse files
Options
Downloads
Patches
Plain Diff
fixup! Bug 3455: Add DomainIsolator, for isolating circuit by domain.
Manage NEWNYM here.
parent
2a56f627
Branches
Branches containing commit
No related tags found
1 merge request
!694
Bug 41796: Rebased on top of FIREFOX_ESR_115_BASE
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
toolkit/components/tor-launcher/TorDomainIsolator.jsm
+23
-1
23 additions, 1 deletion
toolkit/components/tor-launcher/TorDomainIsolator.jsm
with
23 additions
and
1 deletion
toolkit/components/tor-launcher/TorDomainIsolator.jsm
+
23
−
1
View file @
b6249f7f
...
...
@@ -18,6 +18,12 @@ XPCOMUtils.defineLazyServiceGetters(lazy, {
],
});
ChromeUtils.defineModuleGetter(
lazy,
"TorProtocolService",
"resource://gre/modules/TorProtocolService.jsm"
);
const logger = new ConsoleAPI({
prefix: "TorDomainIsolator",
maxLogLevel: "warn",
...
...
@@ -31,6 +37,9 @@ const CATCHALL_DOMAIN = "--unknown--";
// disabled.
const NON_TOR_PROXY_PREF = "extensions.torbutton.use_nontor_proxy";
// The topic of new identity, to observe to cleanup all the nonces.
const NEW_IDENTITY_TOPIC = "new-identity-requested";
class TorDomainIsolatorImpl {
// A mutable map that records what nonce we are using for each domain.
#noncesForDomains = new Map();
...
...
@@ -58,6 +67,7 @@ class TorDomainIsolatorImpl {
this.#setupProxyFilter();
Services.prefs.addObserver(NON_TOR_PROXY_PREF, this);
Services.obs.addObserver(this, NEW_IDENTITY_TOPIC);
}
/**
...
...
@@ -65,6 +75,7 @@ class TorDomainIsolatorImpl {
*/
uninit() {
Services.prefs.removeObserver(NON_TOR_PROXY_PREF, this);
Services.obs.removeObserver(this, NEW_IDENTITY_TOPIC);
}
enable() {
...
...
@@ -152,13 +163,24 @@ class TorDomainIsolatorImpl {
this.#catchallDirtySince = 0;
}
observe(subject, topic, data) {
async
observe(subject, topic, data) {
if (topic === "nsPref:changed" && data === NON_TOR_PROXY_PREF) {
if (Services.prefs.getBoolPref(NON_TOR_PROXY_PREF)) {
this.disable();
} else {
this.enable();
}
} else if (topic === NEW_IDENTITY_TOPIC) {
logger.info(
"New identity has been requested, clearing isolation tokens."
);
this.clearIsolation();
try {
await lazy.TorProtocolService.newnym();
} catch (e) {
logger.error("Could not send the newnym command", e);
// TODO: What UX to use here? See tor-browser#41708
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment