
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Typed Cloudflare DNS Over HTTPS Resolver
This lib is a type safe resolver that uses cloudflare's DNS Over HTTP service to resolve DNS records. It is primarily useful in contexts that do not have access to libc's dns resolver (e.g. non-node javascript like v8 isolates or the browser).
npm --save install cf-doh
import {}
If you have access to the node stdlib, you probably want to use node's dns
library rather than this one, as it will use the system's native resolver. If you explicitly want to use cloudflare's DoH resolver, you can still use this library in node, but you'll need to provide a fetch implementation. JakeChampion's fetch polyfill is the preferred implmementation.
Install it in your local package.json
npm install whatwg-fetch --save
Then provide it to this library:
import { queryDNS, setFetch } from "cf-doh";
import { fetch } from "whatwg-fetch";
setFetch(fetch);
// Use queryDNS normally
queryDNS(hostname: string, recordType: DNSRecordType | keyof typeof DNSRecordType): Promise<string[]>
Queries Cloudflare DoH for the provided hostname. If you want to query a named record, pass the hostname including it.
recordType may be a DNS record type (e.g. CNAME
, TXT
) or the numeric value of a type as per the spec (e.g. 5, 16).
This returns an array of all values of that type found at this hostname.
If cloudflare returns a non-200 response or a Status other than NoError, this will throw with a status message or the response from cloudflare.
import { queryDNS } from "cf-doh";
const records = await queryDNS("_verification.jesseditson.com", "TXT");
records.forEach((r) => console.log(r));
queryDNSRecords(hostname: string, recordType: DNSRecordType | keyof typeof DNSRecordType): Promise<DOHResponse>
Queries Cloudflare DoH for the provided hostname. If you want to query a named record, pass the hostname including it.
recordType may be a DNS record type (e.g. CNAME
, TXT
) or the numeric value of a type as per the spec (e.g. 5, 16).
This returns a DOHResponse, which is a typed version of the JSON returned from cloudflare: https://developers.cloudflare.com/1.1.1.1/encryption/dns-over-https/make-api-requests/dns-json/
If cloudflare returns a non-200 response, this will throw.
import { queryDNSRecords, DOHStatus } from "cf-doh";
const response = await queryDNS("_verification.jesseditson.com", "TXT");
if (response.status === DOHStatus.NoError) {
const records = r.Answer.map((r) => r.data);
}
FAQs
Typed Cloudflare DNS Over HTTP Resolver
The npm package cf-doh receives a total of 46 weekly downloads. As such, cf-doh popularity was classified as not popular.
We found that cf-doh demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.