-
-
Notifications
You must be signed in to change notification settings - Fork 253
Open
Description
Responses to the /api/query endpoint are obfuscated when log privacy config option is enabled.
Minimal config
ports:
http: 8080
upstreams:
groups:
default:
- 1.1.1.1
log:
privacy: trueResult:
$ curl -s localhost:8080/api/query --data '{"query":"example.com","type":"A"}' | jq
{
"reason": "RESOLVED (tcp+udp:1.1.1.1)",
"response": "* (**.***.***.**), * (**.***.*.***), * (**.***.**.***), * (**.***.*.***), * (**.***.***.**), * (**.***.**.***)",
"responseType": "RESOLVED",
"returnCode": "NOERROR"
}This looks to be because the REST server implementation uses the same formatter as the logger
blocky/api/api_interface_impl.go
Line 180 in 257fe07
Response: util.AnswerToString(resp.Res.Answer), Lines 49 to 69 in 257fe07
// AnswerToString creates a user-friendly representation of an answer func AnswerToString(answer []dns.RR) string { answers := make([]string, len(answer)) for i, record := range answer { switch v := record.(type) { case *dns.A: answers[i] = fmt.Sprintf("A (%s)", v.A) case *dns.AAAA: answers[i] = fmt.Sprintf("AAAA (%s)", v.AAAA) case *dns.CNAME: answers[i] = fmt.Sprintf("CNAME (%s)", v.Target) case *dns.PTR: answers[i] = fmt.Sprintf("PTR (%s)", v.Ptr) default: answers[i] = record.String() } } return Obfuscate(strings.Join(answers, ", ")) }
Metadata
Metadata
Assignees
Labels
No labels