temporary-containers
temporary-containers copied to clipboard
Per domain isolation pattern effeciency
When specifying domain patterns for per domain isolation, one can specify patterns as literals, wildcards, or regexes. See https://github.com/stoically/temporary-containers/wiki/Per-Domain-Isolation
To prevent leakage, I find it best to isolate domains whether or not a host is specified. Thus, there are 2 choices:
- Specifying 2 domain patterns (1 literal and 1 wildcard):
example.comand*.example.com - Specifying a single regex pattern:
/^https?://(?:[^.]+\.|)example\.com/
Both options should match the same URLs. Based on how TC processes per-domain isolation patterns, which will be more efficient, the 1st or the 2nd?
Looking closely at the code, I'm thinking the second option may be more efficient, because it looks like all globs/wildcards are converted to regex and then reprocessed: https://github.com/stoically/temporary-containers/blob/d66d9b601d44c36a57b7a91e7cc6db67f6c047f8/src/background/utils.ts#L40
Is that correct?