You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In darwin.ts, the addDomainToHostFileIfMissing function will falsely decide that the provided domains name is already part of the hosts file if the word provided as domain occurs within the file. Here's an excerpt of the current code:
// Inside darwin.tsasyncaddDomainToHostFileIfMissing(domain: string){// This line only checks if the word appears within the fileif(!hostsFileContents.includes(domain)){// ...}}
This leads to plenty of false positives.
For example, consider this scenario:
We have a hosts file:
##
# Host Database
##
127.0.0.1 my-app.test
Now, we want to generate a certficate for just app.test. Because the hosts file already includes the string app.test, addDomainToHostFileIfMissing will decide that it is already included and skip adding the domain to the hosts file.
An example of a more robust solution would be to split the key-value pairs and perform strict equality checks between the two domain names
The text was updated successfully, but these errors were encountered:
alias-mac
pushed a commit
to alias-mac/devcert
that referenced
this issue
Feb 8, 2024
In
darwin.ts
, theaddDomainToHostFileIfMissing
function will falsely decide that the provided domains name is already part of thehosts
file if the word provided as domain occurs within the file. Here's an excerpt of the current code:This leads to plenty of false positives.
For example, consider this scenario:
We have a
hosts
file:Now, we want to generate a certficate for just
app.test
. Because thehosts
file already includes the stringapp.test
,addDomainToHostFileIfMissing
will decide that it is already included and skip adding the domain to the hosts file.An example of a more robust solution would be to split the key-value pairs and perform strict equality checks between the two domain names
The text was updated successfully, but these errors were encountered: