The above was the question.
The reply below is interesting but it is not actually directly related to the original question, to be honest:
The question was about adding entries in resolve.conf if the name server was "belonging to someone else".... was a security risk, but maybe I am misunderstanding this "generic" question?
There is no general scenario where adding a name server of belonging to someone else in resolver will cause a problem unless the name server is misconfigured or a malicious name server, etc.
Of course, if the nameserver has a bunch of fake entries; and is configured in a way which knows the domains you will resolve and will then hijack those domains to point to another IP address, of course this is a kind of hack which is possible but I ask you, who enters nameserver into into their resolver of untrusted sources?
Here are some real work examples. On my mac:
# macOS Notice
#
# This file is not consulted for DNS hostname resolution, address
# resolution, or the DNS query routing mechanism used by most
# processes on this system.
#
# To view the DNS configuration used by this system, use:
# scutil --dns
#
# SEE ALSO
# dns-sd(1), scutil(8)
#
# This file is automatically generated.
#
nameserver 192.168.2.1
The above is the IP address of the router provided by an ISP. This technically "belongs" to someone else, but we are OK (trustworthy) because that nameserver further resolves to the ISP . So, we "trust" that our ISP is running name services correctly. If we do not trust them, we can resolve to another name server, including running our own.
Here is another example, a linux server:
nameserver 69.64.XX.20
nameserver 69.64.XX.50
options rotate
options timeout:3
search zzzz.com
This server resolves to the hosting provider's name servers. This is another example of using "someone else's" name server. We "trust" this ISP to run name services, etc.
Of course, if someone compromised the ISP and poisoned the name space and redirected the FQDN to another server, and make the site look and feel like the "real address" and faked the domain to be very close to the intended domain, it would be possible to compromise a user, etc.
But in practice, this rarely happens; and the original question was not about "hacking" or some kind of "attack" on the DNS or on resolver, but was more about "using someone else's name server" and we all use "someone else's name server" in resolver as a matter of practice (from time-to-time, or daily).
What is the "issue" you are talking about? Name servers all run the same basic protocol and follow the same rules, TTL, etc; so you need to be very specific about the issue and avoid very generic statements, in my view as long running cybersecurity "person".
An IP address in resolver is supposed to point to a name server. You should point to trusted name servers; but that is normally not an issue, as in the two examples above. You should not be "hunting" for name servers, as either your ISP will provide this service or you can run your own or use another 3rd party name server.
HTH
If you have a very specific security or configuration scenarios, please post it; because if we abstract "issue" out to 10,000 feet, the snow and the snowmen all look the same and we are doing what is called "hand waving", talking about a level of abstraction which is not specific enough to have any "real" meaning.
Please note, I do not use Google's nameservers..... as I think we are already providing too much private information to Google; and since Google has a solid model for surveillance capitalism (creating and selling behavior models based on the info they collect from network activity), there is no "good reasons" to be sending all our domain queries to Google!!