Wildcard subdomains - prevent duplicate wildcard mappings
This commit is contained in:
parent
6ab8da3b3a
commit
8f5a7e6d39
1 changed files with 21 additions and 0 deletions
|
@ -112,6 +112,9 @@ window.assignManager = {
|
|||
this.setExempted(pageUrlorUrlKey, tabId);
|
||||
});
|
||||
}
|
||||
if (data.wildcardHostname) {
|
||||
await this.removeDuplicateWildcardHostname(data.wildcardHostname, siteStoreKey);
|
||||
}
|
||||
await this.removeWildcardLookup(siteStoreKey);
|
||||
// eslint-disable-next-line require-atomic-updates
|
||||
data.identityMacAddonUUID =
|
||||
|
@ -157,6 +160,24 @@ window.assignManager = {
|
|||
}
|
||||
},
|
||||
|
||||
// Must not set the same wildcardHostname property on multiple sites.
|
||||
// E.g. 'google.com' on both 'www.google.com' and 'mail.google.com'.
|
||||
//
|
||||
// Necessary because the stored wildcardLookup map is 1-to-1, i.e. either
|
||||
// 'google.com' => 'www.google.com', or
|
||||
// 'google.com' => 'mail.google.com', but not both!
|
||||
async removeDuplicateWildcardHostname(wildcardHostname, expectedSiteStoreKey) {
|
||||
const wildcardStoreKey = this.getWildcardStoreKey(wildcardHostname);
|
||||
const siteStoreKey = await this.getByUrlKey(wildcardStoreKey);
|
||||
if (siteStoreKey && siteStoreKey !== expectedSiteStoreKey) {
|
||||
const siteSettings = await this.getByUrlKey(siteStoreKey);
|
||||
if (siteSettings && siteSettings.wildcardHostname === wildcardHostname) {
|
||||
delete siteSettings.wildcardHostname;
|
||||
await this.set(siteStoreKey, siteSettings); // Will cause wildcard mapping to be cleared
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
async deleteContainer(userContextId) {
|
||||
const sitesByContainer = await this.getAssignedSites(userContextId);
|
||||
this.area.remove(Object.keys(sitesByContainer));
|
||||
|
|
Loading…
Add table
Reference in a new issue