New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dnslint

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dnslint - npm Package Compare versions

Comparing version 1.1.23 to 1.1.24

src/types/html-validator.d.ts

2

dnslint.json
{
"$schema": "./src/schema/dnslint.schema.json#",
"aws": {
"enabled": true
"enabled": false
},

@@ -6,0 +6,0 @@ "domains": [

{
"name": "dnslint",
"version": "1.1.23",
"version": "1.1.24",
"description": "XYO Internal Domain Tool",
"main": "src/index.js",
"scripts": {
"install": "yarn build",
"pretest": "yarn install",

@@ -32,2 +33,3 @@ "test": "yarn tslint --config tslint.json src/*",

"dotenv-expand": "^5.0.0",
"html-validator": "^4.0.0",
"load-json-file": "^5.2.0",

@@ -34,0 +36,0 @@ "lodash": "^4.17.11",

@@ -8,2 +8,3 @@ import { DomainConfig } from "./domain"

public timeout?: number
public html?: boolean

@@ -10,0 +11,0 @@ public reverseDNS?: {

@@ -52,3 +52,3 @@ import { AWS } from './aws'

} else {
console.error(chalk.red(`Total Errors Found: ${result.errorCount}`))
console.error(chalk.yellow(`Total Errors Found: ${result.errorCount}`))
}

@@ -55,0 +55,0 @@ return result

import { BaseValidator } from '../base'
import { Config } from '../../config'
import { Dns } from '../../dns'

@@ -9,3 +8,3 @@ import http, { IncomingMessage } from 'http'

import assert from 'assert'
import { inspect } from 'util'
import htmlValidator from 'html-validator'
export class RecordValidator extends BaseValidator {

@@ -85,2 +84,10 @@

protected async validateHtml(data: string) {
const results = await htmlValidator({
data,
format: 'json'
})
return results.messages
}
protected async checkHttp(value: any) {

@@ -95,3 +102,4 @@ const timeout = this.config.timeout || 1000

assert(value !== undefined)
result = await this.getHttpResponse(value, this.name, timeout, false)
const response = await this.getHttpResponse(value, this.name, timeout, false)
result = response.result
await this.validateHeaders(this.config.http.headers, result.headers)

@@ -102,3 +110,15 @@ this.http.push(result)

this.addError("http", `Unexpected Response Code: ${result.statusCode} [Expected: ${expectedCode}]`)
} else {
if (this.config.html) {
if (result.statusCode === 200) {
const results = await this.validateHtml(response.rawData)
if (results && results.length > 0) {
for (const item of results) {
this.addError("html", item)
}
}
}
}
}
result.data = undefined
console.log(chalk.gray(`http[${timeout}]: ${value}: ${result.statusCode}`))

@@ -121,3 +141,4 @@ } catch (ex) {

assert(value !== undefined)
result = await this.getHttpResponse(value, this.name, timeout, true)
const response = await this.getHttpResponse(value, this.name, timeout, true)
result = response.result
await this.validateHeaders(this.config.https.headers, result.headers)

@@ -128,2 +149,13 @@ this.https.push(result)

this.addError("https", `Unexpected Response Code: ${result.statusCode} [Expected: ${expectedCode}]`)
} else {
if (result.statusCode === 200) {
if (this.config.html) {
const results = await this.validateHtml(response.rawData)
if (results && results.length > 0) {
for (const item of results) {
this.addError("html", item)
}
}
}
}
}

@@ -211,11 +243,12 @@ console.log(chalk.gray(`https[${timeout}]: ${value}: ${result.statusCode}`))

const startTime = Date.now()
let bytesRead = 0
let rawData = ''
let result: any = {}
return new Promise<any>((resolve, reject) => {
try {
const bytes = new Buffer(1)
const req = func.get(`${prefix}://${ip}`, { hostname, timeout }, (res) => {
result = this.sanitizeResponse(res, Date.now() - startTime)
result.port = res.socket.remotePort
res.on('data', (data) => {
bytesRead += data.length
res.on('data', (chunk) => {
rawData += chunk
})

@@ -225,4 +258,4 @@ }).on('error', (e) => {

}).on('close', () => {
result.bytesRead = bytesRead
resolve(result)
result.bytesRead = rawData.length
resolve({ result, rawData })
}).setTimeout(timeout, () => {

@@ -229,0 +262,0 @@ reject(`Timeout [${this.name}]: ${timeout}`)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc