Commit 9a5b16f2 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Ignore CNAME cloaking when the initial question is whitelisted anyways

parent d80e58fe
Pipeline #5952 passed with stage
in 3 minutes and 4 seconds
......@@ -240,7 +240,10 @@ class DnsRuleResolver(context: Context) : LocalResolver(false) {
// Handle CNAME Cloaking
// Does not need to handle whitelist as the query has already been forwarded
override suspend fun mapResponse(message: DnsMessage): DnsMessage {
if(ruleCount == 0 || (ruleCount != null && ruleCount == whitelistCount)) return message // No rules or only whitelist rules present
if(ruleCount == 0 || (ruleCount != null && ruleCount == whitelistCount) || message.questions.size == 0) return message // No rules or only whitelist rules present
else if(whitelistCount != 0 && hashHost(message.question.name.toString().replace(wwwRegex, "").toLowerCase(Locale.ROOT), message.question.type).let {
cachedWildcardWhitelisted.contains(it) || cachedNonWildcardWhitelisted.contains(it)
}) return message
else if(!message.answerSection.any {
it.type == Record.TYPE.CNAME
}) return message
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment