text
stringlengths
79
3.72M
<vulnerable_code> if ((pktdata[3] & JUNIPER_FLAG_NO_L2) == JUNIPER_FLAG_NO_L2) { /* no L2 header present - eth_hdr_offset is actually IP offset */ uint32_t ip_hdr_offset = l2_len; if (datalen < ip_hdr_offset + 1) return 0; if ((pktdata[ip_hdr_offset...
<vulnerable_code>#include <string.h> #include "../../lib/sll.h" #define JUNIPER_FLAG_NO_L2 0x02 /* L2 header */ #define JUNIPER_FLAG_EXT 0x80 /* Juniper extensions present */ #define JUNIPER_PCAP_MAGIC "MGC" } else { l2_len = 4; /* MGC + flags (no header extens...
<vulnerable_code>#include <string.h> #include "../../lib/sll.h" #define JUNIPER_FLAG_EXT 0x80 /* Juniper extensions present */ #define JUNIPER_PCAP_MAGIC "MGC" } else { l2_len = 4; /* MGC + flags (no header extensions) */ } } /* fall through */ c...
<vulnerable_code> if (Buffer == nullptr || Size < 1) return 0; //If the size is larger than than the amount left in the buffer if (Size + dataBufferPos > dataBufferTotalSize) { //We will only return the remaining data memcpy(Buffer, dataBuffer + dataBufferPos, dataBufferTotalSize - dataBufferPos); ...
<vulnerable_code> # Load data from STIX document, and other usefull data def load_event(self, args, filename, from_misp, stix_version): self.outputname = '{}.json'.format(filename) if len(args) > 0 and args[0]: self.add_original_file(filename, args[0], stix_version) try: ...
<vulnerable_code> bpp=BitmapHeader2.Depth; UnpackRaster: if ((image->colors == 0) && (bpp != 24)) { image->colors=one << bpp; } image->columns=Bitmap2Header1.Width; image->rows=Bitmap2Header1.Heig...
<vulnerable_code> } $('#DownloadSupportBundle').on('click', function () { window.location.href = Core.Config.Get('Baselink') + 'Action=' + Core.Config.Get('Action') + ';Subaction=DownloadSupportBundle;Filename=' + Response.Filename + ';RandomID=' + Respons...
<vulnerable_code> log.info('Starting Calibre Web...') Principal(app) lm.init_app(app) app.secret_key = os.getenv('SECRET_KEY', 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT') web_server.init_app(app, config) db.setup_db(config)<commit_title>[PATCH] Don't use an hardcoded session key<commit_description>This fi...
<vulnerable_code>/* $OpenBSD: tcp_input.c,v 1.359 2018/09/17 14:07:48 friehm Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* * ACKs some data in middle of a hole; need to * split current hole */ temp = (struct sackhole *) pool_get(&sackhl_pool, PR_NOWAIT); ...
<vulnerable_code> (uint8_t*) r2.re->code, (uint8_t*) r1.ss->c_string, r1.ss->length, r2.re->flags | RE_FLAGS_SCAN, NULL, NULL) >= 0;<commit_title>[PATCH] Fix issue #646 and some edge cases with wide regexps using \b<commit_description><fixed_code> (ui...
<vulnerable_code>YR_THREAD_STORAGE_KEY thread_storage_key = 0; // // yr_re_initialize // re->code, (uint8_t*) target, strlen(target), re->flags | RE_FLAGS_SCAN, NULL, NULL); // // yr_re_exec // // Executes a regular expression // // Args: // uint8_t* re_code - Reg...
<vulnerable_code>typedef int (*RE_EXEC_FUNC)( uint8_t* code, uint8_t* input, size_t input_size, int flags, RE_MATCH_CALLBACK_FUNC callback, void* callback_args); ac_match->forward_code, data + offset, data_size - offset, offset > 0 ? flags | RE_FLAGS_NOT_AT_START ...
<vulnerable_code> "rule test { strings: $a = /a.{1,2}b/ wide condition: !a == 8 }", "a\0x\0x\0b\0"); assert_regexp_syntax_error(")"); assert_true_regexp("abc", "abc", "abc"); assert_false_regexp("abc", "xbc");<commit_title>[PATCH] Fix issue #646 and some edge cases with wide regexps using \b<commit_de...
<vulnerable_code> for (;;) { u8 label_len; if (j >= length) return -1; GET8(label_len); if (!label_len) break; if (label_len & 0xc0) { *cp++ = '.'; } if (cp + label_len >= end) return -1; memcpy(cp, packet + j, label_len); cp += label_len; j += label_len; static char * search_make_new(const stru...
<vulnerable_code> cp = strchr(ip_as_string, ':'); if (*ip_as_string == '[') { int len; if (!(cp = strchr(ip_as_string, ']'))) { return -1; } len = (int) ( cp-(ip_as_string + 1) ); if (len > (int)sizeof(buf)-1) { return -1; } memcpy(buf, ip_as_string+1, len);<commit_title>[PATCH] Cherry-pick libeve...
<vulnerable_code> ("", ValueError("bad query field: ''")), ("&", ValueError("bad query field: ''")), ("&&", ValueError("bad query field: ''")), (";", ValueError("bad query field: ''")), (";&;", ValueError("bad query field: ''")), # Should the next few really be valid? ("=", {}), ("=&=", {...
<vulnerable_code> (b"&a=b", [(b'a', b'b')]), (b"a=a+b&b=b+c", [(b'a', b'a b'), (b'b', b'b c')]), (b"a=1&a=2", [(b'a', b'1'), (b'a', b'2')]), (";", []), (";;", []), (";a=b", [('a', 'b')]), ("a=a+b;b=b+c", [('a', 'a b'), ('b', 'b c')]), ("a=1;a=2", [('a', '1'), ('a', '2')]), (b";", []),...
<vulnerable_code> def parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None): """Parse a query given as a string argument. Arguments: max_num_fields: int. If set, then throws a ValueError if there are more than ...
<vulnerable_code> if (pos<0) pos=0; gf_list_insert(mov->TopBoxes, brand, pos); } } break; <commit_title>[PATCH] fixed #1783 (fuzz)<commit_description><fixed_code> if (pos<0) pos=0; gf_list_insert(mov->TopBoxes, brand, pos); } gf_isom_box_del(a); } break;
<vulnerable_code>// content scripts. Whether a message can trigger a privileged operation is // decided based on whether the port from which a message is received is // privileged, which is a status evaluated once, at port connection time. vAPI.messaging = { ports: new Map(), listeners: new Map(), de...
<vulnerable_code> read_until_whitespace, skip_over_comment, skip_over_whitespace, ) from PyPDF2.errors import PdfStreamError PyPDF2._utils.deprecate_no_replacement("foo") error_msg = "foo is deprecated and will be removed in PyPDF2 3.0.0." assert exc.value.args[0] == error_msg<commit_title>[...
<vulnerable_code> image=DestroyImageList(image); return((Image *) NULL); } /* Initialize JPEG parameters. */ #endif entry->magick=(IsImageFormatHandler *) IsJPEG; entry->adjoin=MagickFalse; entry->description=ConstantString(description); if (*version != '\0') entry->version=ConstantSt...
<vulnerable_code>static ERL_NIF_TERM aes_cfb_128_crypt(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); static ERL_NIF_TERM aes_ctr_encrypt(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); static ERL_NIF_TERM rand_bytes_1(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); static ERL_NIF_TERM rand_bytes_3(E...
<vulnerable_code>static ERL_NIF_TERM rand_bytes_1(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); static ERL_NIF_TERM strong_rand_bytes_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); static ERL_NIF_TERM rand_bytes_3(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); static ERL_NIF_TERM strong_rand_u...
<vulnerable_code> float num; int i; int WBCTC_count; entries = sget2(cbuf_SR2); if (entries > 1000) return; if (dng_writer == nonDNG) { switch (tag_id) { case 0x7300: FORC4 cblack[c] = sget2(cbuf_SR2 + tag_dataoffset + tag_dataunitlen * c); TagProcessed = 1; ...
<vulnerable_code>import java.io.IOException; import java.util.concurrent.atomic.AtomicReference; import org.xnio.channels.CloseListenerSettable; import org.xnio.conduits.ConduitStreamSinkChannel; import org.xnio.conduits.ConduitStreamSourceChannel; * An empty listener used as a flag, to indicate that close listen...
<vulnerable_code> async exec (args) { const b = this.npm.bin this.npm.output(b) if (this.npm.config.get('global') && !path.split(delimiter).includes(b)) { log.error('bin', '(not in PATH env variable)') } }<commit_title>[PATCH] deps: upgrade npm to 8.11.0<commit_description><fixed_code> async ...
<vulnerable_code>const BaseCommand = require('../base-command.js') class Birthday extends BaseCommand { static name = 'birthday' static description = 'Birthday' static ignoreImplicitWorkspace = true static isShellout = true async exec () { this.npm.config.set('yes', true) return this.npm.exec('exec'...
<vulnerable_code>const localeCompare = require('@isaacs/string-locale-compare')('en') const log = require('../utils/log-shim') const searchCachePackage = async (path, spec, cacheKeys) => { const parsed = npa(spec) if (parsed.rawSpec !== '' && parsed.type === 'tag') { throw new Error(`Cannot list cache keys for...
<vulnerable_code>const log = require('../utils/log-shim.js') const validateLockfile = require('../utils/validate-lockfile.js') const removeNodeModules = async where => { const rimrafOpts = { glob: false } process.emit('time', 'npm-ci:rm') const path = `${where}/node_modules` // get the list of entries so we ca...
<vulnerable_code> msg.push('') } if (!this.npm.config.get('global')) { const pkgPath = resolve(this.npm.prefix, 'package.json') const pkg = await rpj(pkgPath).catch(() => ({})) <commit_title>[PATCH] deps: upgrade npm to 8.11.0<commit_description><fixed_code> msg.push('') } if (!...
<vulnerable_code> ] async exec (args) { if (this.npm.config.get('global')) { const er = new Error('`npm dedupe` does not work in global mode.') er.code = 'EDEDUPEGLOBAL' throw er<commit_title>[PATCH] deps: upgrade npm to 8.11.0<commit_description><fixed_code> ] async exec (args) { if ...
<vulnerable_code> // node_modules is sometimes under ./lib, and in global mode we're only ever // walking through node_modules (because we will have been given a package // name already) if (this.npm.config.get('global')) { this.top = resolve(this.npm.globalDir, '..') } else { this.top = ...
<vulnerable_code> async list (spec, opts) { if (!spec) { if (this.npm.config.get('global')) { throw this.usageError() } const { name } = await readPackage(path.resolve(this.npm.prefix, 'package.json'))<commit_title>[PATCH] deps: upgrade npm to 8.11.0<commit_description><fixed_code> as...
<vulnerable_code> throw err } if (this.npm.config.get('global')) { const err = new Error('`npm fund` does not support global packages') err.code = 'EFUNDGLOBAL' throw err<commit_title>[PATCH] deps: upgrade npm to 8.11.0<commit_description><fixed_code> throw err } if (this....
<vulnerable_code> // the /path/to/node_modules/.. const globalTop = resolve(this.npm.globalDir, '..') const ignoreScripts = this.npm.config.get('ignore-scripts') const isGlobalInstall = this.npm.config.get('global') const where = isGlobalInstall ? globalTop : this.npm.prefix const forced = this.n...
<vulnerable_code> } async exec (args) { if (this.npm.config.get('global')) { throw Object.assign( new Error( 'link should never be --global.\n' +<commit_title>[PATCH] deps: upgrade npm to 8.11.0<commit_description><fixed_code> } async exec (args) { if (this.npm.global) { t...
<vulnerable_code> const all = this.npm.config.get('all') const color = this.npm.color const depth = this.npm.config.get('depth') const global = this.npm.config.get('global') const json = this.npm.config.get('json') const link = this.npm.config.get('link') const long = this.npm.config.get('lon...
<vulnerable_code> async exec (args) { const global = path.resolve(this.npm.globalDir, '..') const where = this.npm.config.get('global') ? global : this.npm.prefix getEdgesOut (node) { // TODO: normalize usage of edges and avoid looping through nodes here if (this.npm.config.get('global...
<vulnerable_code> // reaches registry in order to autocomplete rm if (argv[2] === 'rm') { if (this.npm.config.get('global')) { return [] } const { name } = await readJson(resolve(this.npm.prefix, 'package.json')) async getPkg (prefix, pkg) { if (!pkg) { if (this.npm.config...
<vulnerable_code> // noise generated during packing const tarballs = [] for (const { arg, manifest } of manifests) { const tarballData = await libpack(arg, this.npm.flatOptions) const pkgContents = await getContents(manifest, tarballData) tarballs.push(pkgContents) }<commit_title>[PATCH...
<vulnerable_code> this.prefix = prefix } if (this.npm.config.get('global')) { throw Object.assign( new Error(`There's no package.json file to manage on global mode`), { code: 'EPKGGLOBAL' }<commit_title>[PATCH] deps: upgrade npm to 8.11.0<commit_description><fixed_code> this.pr...
<vulnerable_code> } // we pass dryRun: true to libnpmpack so it doesn't write the file to disk const tarballData = await pack(spec, { ...opts, dryRun: true }) const pkgContents = await getContents(manifest, tarballData) // The purpose of re-reading the manifest is in case it changed,<commit_title>[...
<vulnerable_code> async exec (args) { const globalTop = resolve(this.npm.globalDir, '..') const where = this.npm.config.get('global') ? globalTop : this.npm.prefix const arb = new Arborist({ ...this.npm.flatOptions, path: where,<commit_title>[PATCH] deps: upgrade npm to 8.11.0<commit_descripti...
<vulnerable_code> const BaseCommand = require('../base-command.js') class SetScript extends BaseCommand { static description = 'Set tasks in the scripts section of package.json' static params = ['workspace', 'workspaces', 'include-workspace-root'] static name = 'set-script' static usage = ['[<script>] [<command...
<vulnerable_code> // // loadVirtual, fall back to loadActual // rename shrinkwrap file type, and tree.meta.save() if (this.npm.config.get('global')) { const er = new Error('`npm shrinkwrap` does not work for global packages') er.code = 'ESHRINKWRAPGLOBAL' throw er<commit_title>[PATCH] d...
<vulnerable_code> async exec (args) { // the /path/to/node_modules/.. const global = this.npm.config.get('global') const path = global ? resolve(this.npm.globalDir, '..') : this.npm.localPrefix if (!args.length) { if (!global) { throw new Error('Must provide a package name t...
<vulnerable_code> async exec (args) { const update = args.length === 0 ? true : args const global = path.resolve(this.npm.globalDir, '..') const where = this.npm.config.get('global') ? global : this.npm.prefix <commit_title>[PATCH] deps: upgrade npm to 8.11.0<commit_description><fixed_code> a...
<vulnerable_code> const local = /^\.@/.test(pkg) || pkg === '.' if (local) { if (this.npm.config.get('global')) { throw new Error('Cannot use view command in global mode.') } const dir = this.npm.prefix<commit_title>[PATCH] deps: upgrade npm to 8.11.0<commit_description><fixed_code> ...
<vulnerable_code> }) } const isGlobal = this.config.get('global') const workspacesEnabled = this.config.get('workspaces') // if cwd is a workspace, the default is set to [that workspace] const implicitWorkspace = this.config.get('workspace', 'default').length > 0 execPromise = Promise....
<vulnerable_code> default: false, type: Boolean, short: 'g', description: ` Operates in "global" mode, so that packages are installed into the \`prefix\` folder instead of the current working directory. See `, description: ` When passed to \`npm config\` this refers to which config file to use. ...
<vulnerable_code>const npmFetch = require('npm-registry-fetch') const needsAuthError = (msg) => Object.assign(new Error(msg), { code: 'ENEEDAUTH' }) module.exports = async (npm, opts = {}) => { const { registry } = opts if (!registry) { throw Object.assign(new Error('No registry specified.'), { code: 'ENORE...
<vulnerable_code>'use strict' const util = require('util') const fs = require('fs') const fsm = require('fs-minipass') const ssri = require('ssri') const contentPath = require('./path') const Pipeline = require('minipass-pipeline') const lstat = util.promisify(fs.lstat) const readFile = util.promisify(fs.readFile) c...
<vulnerable_code> module.exports = rm function rm (cache, integrity) { return hasContent(cache, integrity).then((content) => { // ~pretty~ sure we can't end up with a content lacking sri, but be safe if (content && content.sri) { return rimraf(contentPath(cache, content.sri)).then(() => true) } els...
<vulnerable_code>'use strict' const util = require('util') const contentPath = require('./path') const fixOwner = require('../util/fix-owner') const fs = require('fs') const moveFile = require('../util/move-file') const Minipass = require('minipass') const Pipeline = require('minipass-pipeline') const uniqueFilename ...
<vulnerable_code> const util = require('util') const crypto = require('crypto') const fs = require('fs') const Minipass = require('minipass') const path = require('path') const ssri = require('ssri') const rimraf = util.promisify(_rimraf) rimraf.sync = _rimraf.sync const appendFile = util.promisify(fs.appendFile) cons...
<vulnerable_code>const memo = require('./memoization') const read = require('./content/read') function getData (cache, key, opts = {}) { const { integrity, memoize, size } = opts const memoized = memo.get(cache, key, opts) if (memoized && memoize !== false) { return Promise.resolve({ metadata: memoized...
<vulnerable_code> module.exports = putData function putData (cache, key, data, opts = {}) { const { memoize } = opts opts = putOpts(opts) return write(cache, data, opts).then((res) => { return index .insert(cache, key, res.integrity, { ...opts, size: res.size }) .then((entry) => { if (mem...
<vulnerable_code> module.exports.chownr = fixOwner function fixOwner (cache, filepath) { if (!process.getuid) { // This platform doesn't need ownership fixing return Promise.resolve() } getSelf() if (self.uid !== 0) { // almost certainly can't chown anyway return Promise.resolve() } retur...
<vulnerable_code>'use strict' const fs = require('fs') const util = require('util') const chmod = util.promisify(fs.chmod) const unlink = util.promisify(fs.unlink) const stat = util.promisify(fs.stat) const move = require('@npmcli/move-file') const pinflight = require('promise-inflight') module.exports = moveFile fu...
<vulnerable_code> module.exports.mkdir = mktmpdir function mktmpdir (cache, opts = {}) { const { tmpPrefix } = opts const tmpDir = path.join(cache, 'tmp') return fs.mkdir(tmpDir, { recursive: true, owner: 'inherit' }) .then(() => { // do not use path.join(), it drops the trailing / if tmpPrefix is unse...
<vulnerable_code>const pMap = require('p-map') const contentPath = require('./content/path') const fixOwner = require('./util/fix-owner') const fs = require('fs') const fsm = require('fs-minipass') const glob = util.promisify(require('glob')) const index = require('./entry-index') const hasOwnProperty = (obj, key) => ...
<vulnerable_code>const { Request, Response } = require('minipass-fetch') const Minipass = require('minipass') const MinipassCollect = require('minipass-collect') const MinipassFlush = require('minipass-flush') const MinipassPipeline = require('minipass-pipeline') const cacache = require('cacache') const url = require('...
<vulnerable_code><commit_title>[PATCH] deps: upgrade npm to 8.11.0<commit_description><fixed_code> 'use strict' const MinipassPipeline = require('minipass-pipeline') class CachingMinipassPipeline extends MinipassPipeline { #events = [] #data = new Map() constructor (opts, ...streams) { // CRITICAL: do NOT ...
<vulnerable_code>const Minipass = require('minipass') const MinipassPipeline = require('minipass-pipeline') const fetch = require('minipass-fetch') const promiseRetry = require('promise-retry') const ssri = require('ssri') const getAgent = require('./agent.js') const pkg = require('../package.json') // we got...
<vulnerable_code>const glob = require('glob') const globify = pattern => pattern.split('\\').join('/') const pathHasPkg = (input) => { if (!input.startsWith('node_modules/')) { return false this.bundledScopes = Array.from(new Set( this.bundled.filter(f => /^@/.test(f)) .map(f => f.split('...
<vulnerable_code> stream.resolved = this.resolved stream.integrity = this.integrity // run the prepare script, get the list of files, and tar it up // pipe to the stream, and proxy errors the chain. this[_prepareDir]() .then(() => packlist({ path: this.resolved })) .then(files => tar.c(t...
<vulnerable_code>const rpj = require('read-package-json-fast') const pickManifest = require('npm-pick-manifest') const ssri = require('ssri') // Corgis are cute. 🐕🐶 const corgiDoc = 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*' const fetch = require('npm-registry-fetch') // TODO: memoi...
<vulnerable_code> const _onEnd = Symbol('_onEnd') const _getOptions = Symbol('_getOptions') class IntegrityStream extends MiniPass { constructor (opts) { super() this.optString = getOptString(options) } emit (ev, data) { if (ev === 'end') { this[_onEnd]() err.sri = this.sri this.emi...
<vulnerable_code> } } output (...msg) { if (this.base.output) { return this.base.output(msg)<commit_title>[PATCH] deps: upgrade npm to 8.11.0<commit_description><fixed_code> } } get global () { return this.config.get('global') || this.config.get('location') === 'global' } output (......
<vulnerable_code> }).reply(200, { ...manifest, users }) } async package ({ manifest, times = 1, query, tarballs }) { let nock = this.nock const spec = npa(manifest.name) nock = nock.reply(200, manifest) if (tarballs) { for (const version in tarballs) { // for (const version in manife...
<vulnerable_code>const t = require('tap') const { fake: mockNpm } = require('../../fixtures/mock-npm.js') const path = require('path') const npa = require('npm-package-arg') let outputOutput = [] let rimrafPath = '' const rimraf = (path, cb) => { rimrafPath = path return cb() } let logOutput = [] let tarballStr...
<vulnerable_code>const fs = require('fs') const util = require('util') const readdir = util.promisify(fs.readdir) const t = require('tap') const { fake: mockNpm } = require('../../fixtures/mock-npm') t.test('should ignore scripts with --ignore-scripts', async t => { const SCRIPTS = [] let REIFY_CALLED = false ...
<vulnerable_code> registry.whoami({ statusCode: 404, body: {} }) t.rejects(testComp([], []), { code: 'ENEEDAUTH' }) }) t.test('no args', async t => {<commit_title>[PATCH] deps: upgrade npm to 8.11.0<commit_description><fixed_code> registry.whoami({ statusCode: 404, body: {} }) t.rejects(testComp([], []), { ...
<vulnerable_code> await exec.exec(['foo', 'one arg', 'two arg']) t.strictSame(MKDIRPS, [installDir], 'need to make install dir') t.match(ARB_CTOR, [{ path }]) t.match(ARB_REIFY, [], 'no need to install again, already there') t.equal(PROGRESS_ENABLED, true, 'progress re-enabled') const PATH = `${resolve(insta...
<vulnerable_code> }) await outdated(testDir, { global: false, }).exec([]) t.equal(logs.length, 0, 'no logs') }) await t.rejects( outdated(testDir, { global: false, }).exec([]), 'There is an error with this package.' ) }) await outdated(testDir, { global: false, }).exec([]) ...
<vulnerable_code>const t = require('tap') const { fake: mockNpm } = require('../../fixtures/mock-npm') t.test('pings', async t => { t.plan(6) const registry = 'https://registry.npmjs.org' let noticeCalls = 0 const Ping = t.mock('../../../lib/commands/ping.js', { '../../../lib/utils/ping.js': function (spe...
<vulnerable_code> }) await setScript.exec(['arg1', 'arg2']) t.hasStrict(WARN_OUTPUT[0], ['set-script', 'Script "arg1" was overwritten'], 'warning was logged') }) t.test('workspaces', async t => {<commit_title>[PATCH] deps: upgrade npm to 8.11.0<commit_description><fixed_code> }) await setScript.exec(['arg1'...
<vulnerable_code>const username = 'foo' const auth = { '//registry.npmjs.org/:_authToken': 'test-auth-token' } t.test('npm whoami', async (t) => { const { npm, joinedOutput } = await loadMockNpm(t, { config: auth }) const registry = new MockRegistry({ tap: t, t.equal(joinedOutput(), username, 'should print u...
<vulnerable_code> }) await t.rejects(mock.npm.exec('org', []), /.*Usage/) })<commit_title>[PATCH] deps: upgrade npm to 8.11.0<commit_description><fixed_code> }) await t.rejects(mock.npm.exec('org', []), /.*Usage/) }) t.test('usage', async t => { const { npm } = await loadMockNpm(t) t.afterEach(() => { n...
<vulnerable_code>const t = require('tap') t.test('throws ENOREGISTRY when no registry option is provided', async (t) => { t.plan(2) const getIdentity = t.mock('../../../lib/utils/get-identity.js') try { await getIdentity({}) } catch (err) { t.equal(err.code, 'ENOREGISTRY', 'assigns the appropriate err...
<vulnerable_code>const t = require('tap') const mockGlobals = require('../../fixtures/mock-globals') t.test('is not windows', async t => { mockGlobals(t, { 'process.platform': 'posix' }) t.match({ isWindows: false, isWindowsShell: false, }, t.mock('../../../lib/utils/is-windows.js')) }) t.test('is wind...
<vulnerable_code>const t = require('tap') const { load: loadMockNpm } = require('../../fixtures/mock-npm.js') t.test('usage', async t => { const { npm } = await loadMockNpm(t) t.afterEach(() => { npm.config.set('viewer', null) npm.config.set('long', false) npm.config.set('userconfig', '/some/config/fil...
<vulnerable_code>const t = require('tap') t.test('pings', async (t) => { t.plan(3) const options = { fake: 'options' } const response = { some: 'details' } const ping = t.mock('../../../lib/utils/ping.js', { 'npm-registry-fetch': (url, opts) => { t.equal(url, '/-/ping?write=true', 'calls the correct...
<vulnerable_code> */ public class CombinedHttpHeaders extends DefaultHttpHeaders { public CombinedHttpHeaders(boolean validate) { super(new CombinedHttpHeadersImpl(CASE_INSENSITIVE_HASHER, valueConverter(validate), nameValidator(validate))); } @Override } CombinedHttpHeadersImpl(Ha...
<vulnerable_code>import io.netty.handler.codec.DefaultHeadersImpl; import io.netty.handler.codec.HeadersUtils; import io.netty.handler.codec.ValueConverter; import io.netty.util.AsciiString; import io.netty.util.ByteProcessor; import io.netty.util.internal.PlatformDependent; import java.util.ArrayList; import java.uti...
<vulnerable_code><commit_title>[PATCH] Consolidate HTTP header value and name validation<commit_description><fixed_code> /* * Copyright 2022 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * wi...
<vulnerable_code> * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.http; import io.netty.util.internal.StringUtil;<commit_title>[PATCH] Consolidate HTTP header value and name validation<commit_description><fixed_code> * License for the...
<vulnerable_code> import io.netty.handler.codec.http.HttpHeadersTestUtils.HeaderValue; import io.netty.util.AsciiString; import io.netty.util.internal.StringUtil; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.function.Executable; @Test public void keysShouldBeCaseInsensitiveInHeadersEquals() {...
<vulnerable_code><commit_title>[PATCH] Consolidate HTTP header value and name validation<commit_description><fixed_code> /* * Copyright 2022 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * wi...
<vulnerable_code> import io.netty.handler.codec.CharSequenceValueConverter; import io.netty.handler.codec.DefaultHeaders; import io.netty.util.AsciiString; import io.netty.util.ByteProcessor; import io.netty.util.internal.PlatformDependent; import static io.netty.handler.codec.http2.Http2Error.PROTOCOL_ERROR; import s...
<vulnerable_code> public Http2Headers decodeHeaders(int streamId, ByteBuf headerBlock) throws Http2Exception { try { final Http2Headers headers = newHeaders(); hpackDecoder.decode(streamId, headerBlock, headers, validateHeaders, validateHeaderValues); headerArraySizeAccumu...
<vulnerable_code>package io.netty.handler.codec.http2; import io.netty.buffer.ByteBuf; import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.handler.codec.http.HttpHeaderValues; import io.netty.handler.codec.http2.HpackUtil.IndexType; import io.netty.util.AsciiString; import static io.netty.handler.code...
<vulnerable_code> assertFalse(headers.contains("2name", "Value3", false)); } private static void verifyAllPseudoHeadersPresent(Http2Headers headers) { for (PseudoHeaderName pseudoName : PseudoHeaderName.values()) { assertNotNull(headers.get(pseudoName.value()));<commit_title>[PATCH] ...
<vulnerable_code>import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mockin...
<vulnerable_code> @Test public void stripTEHeadersAccountsForOWS() { HttpHeaders inHeaders = new DefaultHttpHeaders(); inHeaders.add(TE, " " + TRAILERS + ' '); Http2Headers out = new DefaultHttp2Headers(); HttpConversionUtil.toHttp2Headers(inHeaders, out);<commit_title>[PATCH] Co...
<vulnerable_code> final Http2Headers http2Headers = new DefaultHttp2Headers().method(new AsciiString("GET")).path(new AsciiString("/example")) .authority(new AsciiString("www.example.org:5555")).scheme(new AsciiString("http")) .scheme(new AsciiStrin...
<vulnerable_code> assertThrows(IllegalArgumentException.class, new Executable() { @Override public void execute() { ReadOnlyHttp2Headers.trailers(true, new AsciiString(":name"), new AsciiString("foo"), new AsciiString("othername"), new AsciiString("...
<vulnerable_code> private final byte hashMask; private final ValueConverter<V> valueConverter; private final NameValidator<K> nameValidator; private final HashingStrategy<K> hashingStrategy; int size; }; } @SuppressWarnings("unchecked") public DefaultHeaders(ValueConverter<V> va...
<vulnerable_code> ValueConverter<V> valueConverter, NameValidator<K> nameValidator) { super(nameHashingStrategy, valueConverter, nameValidator); } }<commit_title>[PATCH] Consolidate HTTP header value and name validation<commit_description><fixed_code> ValueConverter<V> valueConverter,...