Uname: Linux webm016.cluster127.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
Software: Apache
PHP version: 7.4.33 [ PHP INFO ] PHP os: Linux
Server Ip: 54.36.31.145
Your Ip: 216.73.216.182
User: homesquasz (91404) | Group: users (100)
Safe Mode: OFF
Disable Function:
_dyuweyrj4,_dyuweyrj4r,dl

name : index.js
'use strict'

const {
  ValidateHost,
  ParseLockfile,
  ValidateHttps,
  ValidateScheme,
  ValidateUrl
} = require('lockfile-lint-api')
const debug = require('debug')('lockfile-lint')

module.exports = {
  ValidateHostManager,
  ValidateHttpsManager,
  ValidateSchemeManager,
  ValidateUrlManager
}

function ValidateSchemeManager ({path, type, validatorValues, validatorOptions}) {
  debug(
    `validate-scheme-manager invoked with validator options: ${JSON.stringify(validatorValues)}`
  )

  const options = {
    lockfilePath: path,
    lockfileType: type
  }

  const parser = new ParseLockfile(options)
  const lockfile = parser.parseSync()
  const validator = new ValidateScheme({packages: lockfile.object})

  return validator.validate(validatorValues)
}

function ValidateHostManager ({path, type, validatorValues, validatorOptions}) {
  debug(`validate-host-manager invoked with validator options: ${JSON.stringify(validatorValues)}`)

  const options = {
    lockfilePath: path,
    lockfileType: type
  }

  const parser = new ParseLockfile(options)
  const lockfile = parser.parseSync()
  const validator = new ValidateHost({packages: lockfile.object})
  const validationResult = validator.validate(validatorValues, validatorOptions)

  // Check if some of the errors are for allowed URLs and filter those out
  if (validatorOptions && validatorOptions.allowedUrls) {
    const urlValidator = new ValidateUrl({packages: lockfile.object})

    validationResult.errors = validationResult.errors.filter(
      result => !urlValidator.validateSingle(result.package, validatorOptions.allowedUrls)
    )

    // If we don't have any errors left at this point make sure it's a success type
    if (!validationResult.errors.length) {
      validationResult.type = 'success'
    }
  }

  return validationResult
}

function ValidateHttpsManager ({path, type, validatorValues, validatorOptions}) {
  debug(`validate-host-manager invoked with validator options: ${JSON.stringify(validatorValues)}`)

  const options = {
    lockfilePath: path,
    lockfileType: type
  }

  const parser = new ParseLockfile(options)
  const lockfile = parser.parseSync()
  const validator = new ValidateHttps({packages: lockfile.object})

  return validator.validate()
}

function ValidateUrlManager ({path, type, validatorValues, validatorOptions}) {
  debug(`validate-url-manager invoked with validator options: ${JSON.stringify(validatorValues)}`)

  const options = {
    lockfilePath: path,
    lockfileType: type
  }

  const parser = new ParseLockfile(options)
  const lockfile = parser.parseSync()
  const validator = new ValidateUrl({packages: lockfile.object})

  return validator.validate(validatorValues, validatorOptions)
}
© 2026 GrazzMean