text stringlengths 79 3.72M |
|---|
<vulnerable_code> return {
init: function (options) {
var defer = $q.defer();
options.initCallback = function () {
apiReady.resolve();
defer.resolve();
};
xdLocalStorage.init(options);
return defer.promise;<commit_title>[PATCH] Handle case if localSto... |
<vulnerable_code> var options = {
iframeId: 'cross-domain-iframe',
iframeUrl: undefined,
initCallback: function () {}
};
var requestId = -1;
var iframe;
if (data && data.namespace === MESSAGE_NAMESPACE) {
if (data.id === 'iframe-ready') {
iframeReady = true;
options.initCall... |
<vulnerable_code> var allowedOriginsAttr = (postApi && postApi.getAttribute("accepted-origins")) || '';
var allowedOrigins = allowedOriginsAttr.split(',');
// Verify the sender's origin has been whitelisted
function isOriginAllowed(origin) {
if (allowedOrigins.length === 1 && (allowedOrigins[0] === '*' || a... |
<vulnerable_code> * @param connection
* @param stmt
*/
public static void closeDbConnection(Connection connection, PreparedStatement stmt)
{
// closes the connection
try
{
if (null != stmt)
{
//System.out.println("- Closes the prepared statement");
... |
<vulnerable_code>package org.identifiers.db;
import org.identifiers.data.URIextended;
import org.identifiers.db.DbUtilities;
import java.util.ArrayList;
import java.util.List;
/**
* Simple dao for SPARQL testing.
*
* @author Camille
* @version 20140519
*/
public class RegistryDao
{
private Connection connec... |
<vulnerable_code>from authentication.models import User
from automation.models import HttpAutomatedTest, PingAutomatedTest
from testing.models import TlsScanHistory
#
# Model: User
class DomainNameSerializer(serializers.Serializer):
domain_name = serializers.CharField(
max_length=200, required=True, help_... |
<vulnerable_code>import re
from rest_framework.serializers import ValidationError
pattern = re.compile(
r"^(([a-zA-Z]{1})|([a-zA-Z]{1}[a-zA-Z]{1})|"
r"([a-zA-Z]{1}[0-9]{1})|([0-9]{1}[a-zA-Z]{1})|"
r"([a-zA-Z0-9][-_.a-zA-Z0-9]{0,61}[a-zA-Z0-9]))\."
r"([a-zA-Z]{2,13}|[a-zA-Z0-9-]{2,30}.[a-zA-Z]{2,3})$"
... |
<vulnerable_code> Checks the presence of a SOA record.
"""
domain_name = request.data.get("domain_name", None)
result = check_soa_record(domain_name)
return Response(result, status=status.HTTP_200_OK)
<commit_title>[PATCH] chg: [security] Added new domain name validator used in th... |
<vulnerable_code>from weasyprint import CSS, HTML
from testing.models import TlsScanHistory
from .cipher_scoring import load_cipher_info
logger = logging.getLogger(__name__)
def full_domain_validator(hostname):
"""
Fully validates a domain name as compilant with the standard rules:
- Composed of se... |
<vulnerable_code><commit_title>[PATCH] chg: [security] Added new domain name validator used in the<commit_description><fixed_code>
import re
from rest_framework.serializers import ValidationError
pattern = re.compile(
r"^(([a-zA-Z]{1})|([a-zA-Z]{1}[a-zA-Z]{1})|"
r"([a-zA-Z]{1}[0-9]{1})|([0-9]{1}[a-zA-Z]{1})|"... |
<vulnerable_code>
process = subprocess.Popen(
cmd,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,<commit_title>[PATCH] Merge pull request from GHSA-2ggp-cmvm-f62f<commit_description>- Regex that validates docker_reference variable
- Sec... |
<vulnerable_code>import json
import logging
import os
import tempfile
from collections import namedtuple
from pathlib import Path
Docker references are documented here:
https://github.com/containers/skopeo/blob/0faf16017/docs/skopeo.1.md#image-names
"""
name = python_safe_name(docker_reference.replace("... |
<vulnerable_code> uint8_t subopt_type;
uip_ipaddr_t prefix;
uip_ds6_route_t *rep;
uint8_t buffer_length;
int pos;
int len;
int i;
uip_ipaddr_copy(&dao_sender_addr, &UIP_IP_BUF->srcipaddr);
buffer = UIP_ICMP_PAYLOAD;
buffer_length = uip_len - uip_l3_icmp_hdr_len;
pos = 0;
instance_id = buffer[po... |
<vulnerable_code>{
char *copy = NULL;
/* if object's type is not cJSON_String or is cJSON_IsReference, it should not set valuestring */
if (!(object->type & cJSON_String) || (object->type & cJSON_IsReference))
{
return NULL;
}
{
cJSON *after_inserted = NULL;
if (which < 0)
{
... |
<vulnerable_code>{
char buffer[10];
cJSON *item = cJSON_CreateString("item");
cJSON_InitHooks(NULL);
TEST_ASSERT_NULL(cJSON_Parse(NULL));
cJSON_DeleteItemFromObject(item, NULL);
cJSON_DeleteItemFromObjectCaseSensitive(NULL, "item");
cJSON_DeleteItemFromObjectCaseSensitive(item, NULL);
T... |
<vulnerable_code>/*******************************************************************************
* Copyright (c) 2011, 2021 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this d... |
<vulnerable_code>/*******************************************************************************
* Copyright (c) 2013, 2015 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this d... |
<vulnerable_code> threshold_image=CloneImage(image,0,0,MagickTrue,exception);
if (threshold_image == (Image *) NULL)
return((Image *) NULL);
if (width == 0)
return(threshold_image);
if (SetImageStorageClass(threshold_image,DirectClass) == MagickFalse)
{<commit_title>[PATCH] https://github.com/ImageMa... |
<vulnerable_code><commit_title>[PATCH] XWIKI-20281: Improve tips rendering<commit_description><fixed_code>
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU... |
<vulnerable_code><commit_title>[PATCH] XWIKI-20281: Improve tips rendering<commit_description><fixed_code>
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU... |
<vulnerable_code> */
package org.xwiki.panels.test.po;
import org.xwiki.test.ui.po.ViewPage;
/**
*/
public class PanelViewPage extends ViewPage
{
@SuppressWarnings("unchecked")
@Override
protected PanelEditPage createInlinePage()
{
return new PanelEditPage();
}
}<commit_title>[PATCH] XWIK... |
<vulnerable_code>import java.util.Objects;
import java.util.Properties;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.xwiki.model.reference.ObjectPropertyReference;
import org.xwiki.model.reference.ObjectReference;
import org.xwiki.model.reference.SpaceReference;
impo... |
<vulnerable_code> testPartialDataHandling<CompactSerializer>(
s, 3 /* headers */ + 30 * 2 /* 2b / kv pair */);
}<commit_title>[PATCH] Better handling of truncated data when reading strings<commit_description>Summary:
Currently we read string size and blindly pre-allocate it. This allows malicious attacker to sen... |
<vulnerable_code> Object parser loop.
*/
ldblk=ReadBlobLSBLong(image);
if ((ldblk > 9999) || (ldblk < 0))
break;
HDR.Type[3]=ldblk % 10; ldblk /= 10; /* T digit */
}
filepos = TellBlob(image);
while(!EOFBlob(image)) /* object parser loop */
{
Frames = 1;
if (filepos != (uns... |
<vulnerable_code> return NULL;
if (elements > 0) {
r->element = hi_calloc(elements,sizeof(redisReply*));
if (r->element == NULL) {
freeReplyObject(r);<commit_title>[PATCH] Fix for integer/buffer overflow CVE-2021-32765<commit_description>This fix prevents hiredis from trying to a... |
<vulnerable_code> freeReplyObject(reply);
redisReaderFree(reader);
#if LLONG_MAX > SIZE_MAX
test("Set error when array > SIZE_MAX: ");
reader = redisReaderCreate();<commit_title>[PATCH] Fix for integer/buffer overflow CVE-2021-32765<commit_description>This fix prevents hiredis from trying to allocate mo... |
<vulnerable_code> _HANDLERS: The handlers registered via decorators.
"""
import json
import os
import time
end_time = start_time - 24*60*60
entries = hist.entries_between(end_time, start_time)
return [{"url": e.url, "title": e.title or e.url, "time": e.atime}
for e in entries]
@ad... |
<vulnerable_code> assert(p_stream != 00);
l_tcp =&(p_j2k->m_cp.tcps[p_j2k->m_current_tile_number]);
l_current_data = p_j2k->m_specific_param.m_encoder.m_header_tile_data;
l_mco_size = 5 + l_tcp->m_nb_mcc_records;
if (l_mco_size > p_j2k->m_specific_param.m_encoder.m_header_tile_d... |
<vulnerable_code> }
if (url.pathname.endsWith('/dynamic-replace')) {
return NextResponse.rewrite('/_interface/dynamic-path')
}
return new Response(null, {<commit_title>[PATCH 01/13] fix(next-swc): Update swc (#33427)<commit_description>This PR applies lots of patches, including
- https://github.com/swc-p... |
<vulnerable_code>
if (url.pathname === '/redirects/infinite-loop-1') {
url.pathname = '/redirects/infinite-loop'
return Response.redirect(url.pathname)
}
}<commit_title>[PATCH 01/13] fix(next-swc): Update swc (#33427)<commit_description>This PR applies lots of patches, including
- https://github.com/swc-p... |
<vulnerable_code>
if (url.pathname.startsWith('/rewrites/to-blog')) {
const slug = url.pathname.split('/').pop()
console.log('rewriting to slug', slug)
return NextResponse.rewrite(`/rewrites/fallback-true-blog/${slug}`)
}
if (url.pathname === '/rewrites/rewrite-to-ab-test') {
let bucket = request... |
<vulnerable_code><commit_title>[PATCH 01/13] fix(next-swc): Update swc (#33427)<commit_description>This PR applies lots of patches, including
- https://github.com/swc-project/swc/pull/3303
- https://github.com/swc-project/swc/pull/3301
- https://github.com/swc-project/swc/pull/3287
- https://github.com/swc-project... |
<vulnerable_code><commit_title>[PATCH 01/13] fix(next-swc): Update swc (#33427)<commit_description>This PR applies lots of patches, including
- https://github.com/swc-project/swc/pull/3303
- https://github.com/swc-project/swc/pull/3301
- https://github.com/swc-project/swc/pull/3287
- https://github.com/swc-project... |
<vulnerable_code>context.appDir = join(__dirname, '../')
const middlewareWarning = 'using beta Middleware (not covered by semver)'
describe('Middleware base tests', () => {
describe('dev mode', () => {
let output = ''
beforeAll(async () => {
context.appPort = await findPort()
context.app = await... |
<vulnerable_code>import { NextResponse } from 'next/server'
export function middleware() {
return NextResponse.rewrite('/about/a')
}<commit_title>[PATCH 01/13] fix(next-swc): Update swc (#33427)<commit_description>This PR applies lots of patches, including
- https://github.com/swc-project/swc/pull/3303
- https://... |
<vulnerable_code> )
)
)
.ncc({ packageName: 'jest-worker', externals })
.target('compiled/jest-worker/out')
await fs.move(<commit_title>[PATCH 01/13] fix(next-swc): Update swc (#33427)<commit_description>This PR applies lots of patches, including
- https://github.com/swc-pr... |
<vulnerable_code>(()=>{var __webpack_modules__={282:(e,t,r)=>{"use strict";var o=r(330);var i=r(40);e.exports.O=convert;function convert(e,t,r,o){r=checkEncoding(r||"UTF-8");t=checkEncoding(t||"UTF-8");e=e||"";var n;if(r!=="UTF-8"&&typeof e==="string"){e=new Buffer(e,"binary")}if(r===t){if(typeof e==="string"){n=new Bu... |
<vulnerable_code>import { useState } from 'react'
import Image from 'next/image'
const Page = () => (
<div>
<h1>On Loading Complete Test</h1>
<ImageWithMessage
id="1"
src="/test.jpg"
layout="intrinsic"
width="128"
height="128"
/>
<hr />
<ImageWithMessage
id="2"... |
<vulnerable_code> try {
browser = await webdriver(appPort, '/on-loading-complete')
await browser.eval(`document.getElementById("footer").scrollIntoView()`)
await check(
() => browser.eval(`document.getElementById("img1").src`),
/test(.*)jpg/
)
await check(
() =... |
<vulnerable_code>import json
import os
from app import db
from app.historeport.onto_func import StandardVocabulary
from app.models import ReportHisto
with open(
os.path.join(current_app.config["ONTOLOGY_FOLDER"], "ontology.json"), "w"
) as json_file:
json.dump(clean_tree, json_file, indent=4)
... |
<vulnerable_code>GRAD_COMPARISON = re.compile(r"<cs-[123]>")
NON_GRAD_COMPARISON = re.compile(r"<cs-4>")
ENTITIES_FEATS = re.compile(r"(\d)_((?:[\.\w\s/-](?!\d_))+)")
KEYWORD = re.compile(r"\((?!.*\()(.*)\)$")
class Comparison:<commit_title>[PATCH] Resolved ReDoS vulnerability in Corpus Reader (#2816)<commit_descript... |
<vulnerable_code>#include "itemstackmetadata.h"
#include "util/serialize.h"
#include "util/strfnd.h"
#define DESERIALIZE_START '\x01'
#define DESERIALIZE_KV_DELIM '\x02'
updateToolCapabilities();
}
bool ItemStackMetadata::setString(const std::string &name, const std::string &var)
{
bool result = Metadata::setString... |
<vulnerable_code> call_rcu_bh(&p->rcu, br_multicast_free_pg);
err = 0;
if (!mp->ports && !mp->mglist &&
netif_running(br->dev))
mod_timer(&mp->timer, jiffies);
break;<commit_title>[PATCH] bridge: fix some kernel warning in multicast timer<commit_description>Several people reported the warning: "kernel ... |
<vulnerable_code>from __future__ import annotations
import warnings
from typing import Any, Dict, List, Optional
from pydantic import Extra, root_validator
from langchain.prompts.base import BasePromptTemplate
from langchain.utilities import PythonREPL
class PALChain(Chain):
"""Implements Program-Aided Language... |
<vulnerable_code><commit_title>[PATCH] WIP<commit_description><fixed_code>
"""Test LLM PAL functionality."""
import sys
sys.path.append(r"C:\projects\langchain")
import pytest
from langchain.chains.pal.base import PALChain
from langchain.chains.pal.math_prompt import MATH_PROMPT
from langchain.schema import OutputPar... |
<vulnerable_code> CL_PROGRAM_BINARY_SIZES,sizeof(size_t),&binaryProgramSize,NULL);
if (status != CL_SUCCESS)
return;
binaryProgram=(unsigned char*) AcquireMagickMemory(binaryProgramSize);
status=openCL_library->clGetProgramInfo(device->program,
CL_PROGRAM_BINARIES,sizeof(unsigned char*),&binaryProgram... |
<vulnerable_code> ) -> bytes:
"""Download a metadata file and return it as bytes"""
if version is None:
filename = f"{rolename}.json"
else:
filename = f"{version}.{rolename}.json"
url = parse.urljoin(self._metadata_base_url, filename)
return self._fetch... |
<vulnerable_code> return self._fetcher.download_bytes(url, length)
def _load_local_metadata(self, rolename: str) -> bytes:
with open(os.path.join(self._dir, f"{rolename}.json"), "rb") as f:
return f.read()
def _persist_metadata(self, rolename: str, data: bytes) -> None:
"""A... |
<vulnerable_code>from tuf.api.serialization.json import JSONSerializer
from tuf.exceptions import FetcherHTTPError
from tuf.api.metadata import (
Key,
Metadata,
MetaFile,
self.dump_dir = None
self.dump_version = 0
self._initialize()
@property
def _initialize(self):
... |
<vulnerable_code>import os
import sys
import tempfile
from typing import Optional, Tuple
from tuf.exceptions import UnsignedMetadataError, BadVersionNumberError
import unittest
def test_keys_and_signatures(self):
"""Example of the two trickiest test areas: keys and root updates"""
<commit_title>[PATCH 1/... |
<vulnerable_code>import copy
import warnings
import io
from securesystemslib import exceptions as sslib_exceptions
from securesystemslib import formats as sslib_formats
# Save and construct the full metadata path.
metadata_directory = self.metadata_directory[metadata_set]
metadata_filename = metadata_role... |
<vulnerable_code> self.assertEqual(None, multi_repo_updater.get_updater('bad_repo_name'))
def _load_role_keys(keystore_directory):
<commit_title>[PATCH 1/9] ngclient: Do not use urljoin to form metadata URL<commit_description>urljoin considers the second URL to override the base URL if the second
one contains e.g... |
<vulnerable_code> # By default add one new key for the role
key, signer = self.create_key()
delegator.add_key(role.name, key)
if role not in self.signers:
self.signers[role.name] = []
self.signers[role.name].append(signer)
<commit_title>[PATCH 1/9] ngclient: Do not use... |
<vulnerable_code> self.repository_updater._move_current_to_previous('snapshot')
self.assertTrue(os.path.exists(previous_snapshot_filepath))
<commit_title>[PATCH 1/9] ngclient: Do not use urljoin to form metadata URL<commit_description>urljoin considers the second URL to override the base URL if the second
one... |
<vulnerable_code> return self.repository_name
def _load_metadata_from_file(self, metadata_set, metadata_role):
# Save and construct the full metadata path.
metadata_directory = self.metadata_directory[metadata_set]
metadata_filename = parse.quote(metadata_role, "") + '.json'
metadata_filepath... |
<vulnerable_code> "Expected a NoWorkingMirrorError composed of one BadSignatureError")
def test_1__update_fileinfo(self):
# Tests
# Verify that the 'self.fileinfo' dictionary is empty (its starts off empty
# and is only populated if _update_fileinfo() is called.
fileinfo_dict = self... |
<vulnerable_code>
def _fileinfo_has_changed(self, metadata_filename, new_fileinfo):
"""
<Purpose>
Non-public method that determines whether the current fileinfo of
'metadata_filename' differs from 'new_fileinfo'. The 'new_fileinfo'
argument should be extracted from the latest copy of the... |
<vulnerable_code>import os
import sys
import tempfile
from tuf.api.metadata import Targets
from typing import Optional, Tuple
from tuf.exceptions import UnsignedMetadataError, BadVersionNumberError
import unittest
}
# Add new delegated targets, update the snapshot
targets = Targets(1, "1.0.19",... |
<vulnerable_code> source = self.request.form.get('source')
if source:
# Is it valid XML?
try:
root = etree.fromstring(source)
except etree.XMLSyntaxError as e:
return json.dumps({
'success': False,<commit_title>[PATCH... |
<vulnerable_code> u32in();
// Number of entries
mp4config.frame.ents = u32in();
// fixme: check atom size
mp4config.frame.data = malloc(sizeof(*mp4config.frame.data)
* (mp4config.frame.ents + 1));
<commit_title>[PATCH] fix heap-buffer-overflow in mp4read.c<commit_des... |
<vulnerable_code> "name": "List plugins",
"description": gettext("Allows to list installed plugins."),
"default_groups": [READONLY_GROUP, USER_GROUP, ADMIN_GROUP],
"roles": ["manage"],
},
{
"key": "MANAGE",<commit_tit... |
<vulnerable_code> Returns:
A list of jinja2 templates.
"""
templates = []
search_directories = [self.default_template_dir]
# The loader will first look in the custom template directory (if specified) for the
}
)
for filename in filenames:
... |
<vulnerable_code> foundMatchingPermission.set(true);
}
});
}
}
} else {<commit_title>[PATCH] exit early if matching permission found; add test for *:*<commit_description><fixed_code>
foundMatchingPermission.set(true);
}
... |
<vulnerable_code> default List<String> getPermissions() {
List<String> permissions = new ArrayList<>();
permissions.add("*:*");
permissions.add(this.getName().replace('_', ':'));
permissions.add(this.getName().substring(0, this.getName().indexOf('_')) + ":*");
return permissions;
};
}<commit_titl... |
<vulnerable_code> AuthenticationUtils.isPermitted(
service.authenticationService, Optional.of(user), ethBlockNumber))
.isTrue();
// eth/accounts not permitted
assertThat(
AuthenticationUtils.isPermitted(
... |
<vulnerable_code> @Test
public void getPermissions() {
List<String> permissions = method.getPermissions();
assertThat(permissions).containsExactlyInAnyOrder("net:*", "net:listening", "*:*");
}
private JsonRpcRequestContext netListeningRequest() {<commit_title>[PATCH] exit early if matching permission fo... |
<vulnerable_code> if ((sock->type != SOCK_SEQPACKET) && (sock->type != SOCK_RAW))
return -ESOCKTNOSUPPORT;
if (sock->type == SOCK_RAW)
sock->ops = &rawsock_raw_ops;
else
sock->ops = &rawsock_ops;
sk = sk_alloc(net, PF_NFC, GFP_ATOMIC, nfc_proto->proto, kern);
if (!sk)<commit_title>[PATCH] net/nfc/rawsock.c:... |
<vulnerable_code> """Run user's notification script"""
if test:
script = test.get("nscript_script")
nscript_parameters = test.get("nscript_parameters")
else:
script = sabnzbd.cfg.nscript_script()
nscript_parameters = sabnzbd.cfg.nscript_parameters()
nscript_parameters = ns... |
<vulnerable_code> if (op == 2) {
istart = n-1;
}
if (start && Jsi_GetNumberFromValue(interp,start, &nstart)==JSI_OK) {
istart = (int)nstart;
if (istart > n)
goto bail;
Jsi_Obj *obj = _this->d.obj;
n = jsi_SizeOfArray(interp, obj);
if (start && Jsi_GetNumberFro... |
<vulnerable_code> break;
}
case TIOCINQ: {
/*
* These two are safe on a single CPU system as only
* user tasks fiddle here
*/
struct sk_buff *skb = skb_peek(&sk->sk_receive_queue);
long amount = 0;
if (skb)
amount = skb->len - sizeof(struct ddpehdr);
rc = put_user(amount, (int __user *)argp);
... |
<vulnerable_code> text = this.data.path;
}
if (this.data.path || this.data.anchor || this.data.parameters) {
let fullpath = this.data.path + (this.data.parameters ? '?' + this.data.parameters : '') + (this.data.anchor ? '#' + this.data.anchor : '');
let displayHtml = E... |
<vulnerable_code>
@gen.coroutine
def authenticate(self, handler, data):
username = data['username'].lower()
if not self.create_users:
if not self._user_exists(username):<commit_title>[PATCH] Use normalize_username instead of .lower<commit_description>allows for following normalizati... |
<vulnerable_code> this.valueConverter = checkNotNull(valueConverter, "valueConverter");
this.nameValidator = checkNotNull(nameValidator, "nameValidator");
hashingStrategy = checkNotNull(nameHashingStrategy, "nameHashingStrategy");
// Enforce a bound of [2, 128] because hashMask is a byte.... |
<vulnerable_code>import org.apache.ibatis.cache.Cache;
import org.apache.ibatis.cache.CacheException;
import org.apache.ibatis.io.Resources;
/**
* @author Clinton Begin
}
private Serializable deserialize(byte[] value) {
Serializable result;
try (ByteArrayInputStream bis = new ByteArrayInputStream(value);... |
<vulnerable_code>/**
* Copyright 2009-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import java.io.ByteArrayOutputStream;
import java.io.Externalizable;
import java.io.IOException;
... |
<vulnerable_code><commit_title>[PATCH] Output warning when deserializing object stream with no<commit_description><fixed_code>
/**
* Copyright 2009-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with ... |
<vulnerable_code> 'command': [
{
// FOR command
pattern: /((?:^|[&(])[ \t]*)for(?: ?\/[a-z?](?:[ :](?:"[^"]*"|[^\s"/]\S*))?)* \S+ in \([^)]+\) do/im,
lookbehind: true,
inside: {
'keyword': /^for\b|\b(?:in|do)\b/i,
},
{
// IF command
pattern: /((?:^|[&(])[ \t]*)if(?: ?\/[a-z?](?:[ ... |
<vulnerable_code>!function(e){var r=/%%?[~:\w]+%?|!\S+!/,t={pattern:/\/[a-z?]+(?=[ :]|$):?|-[a-z]\b|--[a-z-]+\b/im,alias:"attr-name",inside:{punctuation:/:/}},n=/"(?:[\\"]"|[^"])*"(?!")/,i=/(?:\b|-)\d+\b/;Prism.languages.batch={comment:[/^::.*/m,{pattern:/((?:^|[&(])[ \t]*)rem\b(?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,look... |
<vulnerable_code> greedy: true
},
{
pattern: RegExp(/("|')(?:(?!\1|\$\{)[^\\]|\\.|\$\{(?:<expr>)*?\})*\1/.source.replace(/<expr>/g, function () { return FTL_EXPR; })),
greedy: true,
inside: {
'interpolation': {
pattern: RegExp(/((?:^|[^\\])(?:\\\\)*)\$\{(?:<expr>)*?\}/.source.replace(/<e... |
<vulnerable_code>!function(n){for(var i="[^<()\"']|\\((?:<expr>)*\\)|<(?!#--)|<#--(?:[^-]|-(?!->))*--\x3e|\"(?:[^\\\\\"]|\\\\.)*\"|'(?:[^\\\\']|\\\\.)*'",e=0;e<2;e++)i=i.replace(/<expr>/g,function(){return i});i=i.replace(/<expr>/g,"[^\\s\\S]");var t={comment:/<#--[\s\S]*?-->/,string:[{pattern:/\br("|')(?:(?!\1)[^\\]|\... |
<vulnerable_code> }
},
lambda: {
pattern: RegExp(par + 'lambda\\s+\\((?:&?' + symbol + '\\s*)*\\)'),
lookbehind: true,
inside: {
keyword: /^lambda/,<commit_title>[PATCH] Fixed even more exp backtracking<commit_description><fixed_code>
}
},
lambda: {
pattern: RegExp(par + 'lambda\\s+\\(\\s*(... |
<vulnerable_code>!function(e){function n(e){return RegExp("(\\()"+e+"(?=[\\s\\)])")}function a(e){return RegExp("([\\s([])"+e+"(?=[\\s)])")}var t="[-+*/_~!@$%^=<>{}\\w]+",r="(\\()",i="(?=\\))",s="(?=\\s)",o={heading:{pattern:/;;;.*/,alias:["comment","title"]},comment:/;.*/,string:{pattern:/"(?:[^"\\]|\\.)*"/,greedy:!0,... |
<vulnerable_code> pattern: /(->)[\w]+/,
lookbehind: true
},
'number': /\b0b[01]+\b|\b0x[\da-f]+\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)*|\B\.\d+)(?:e[+-]?\d+)?/i,
'operator': /<?=>|\?\?=?|\.{3}|->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||[?~]|[/^|%*&<>.+-]=?/,
'punctuation': /[{}\[\](),:;]/
};<commit_title>[PATC... |
<vulnerable_code>!function(a){a.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:[/\/\*[\s\S]*?\*\/|\/\/.*|#.*/],variable:/\$+(?:\w+\b|(?={))/i,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},keyword:[... |
<vulnerable_code> 'table': {
// Modifiers can be applied to the row: {color:red}.|1|2|3|
// or the cell: |{color:red}.1|2|3|
pattern: withModifier(/^(?:(?:<MOD>|<PAR>|[<>=^~])+\.\s*)?(?:\|(?:(?:<MOD>|<PAR>|[<>=^~_]|[\\/]\d+)+\.)?[^|]*)+\|/.source, 'm'),
inside: {
'modifier': {
// Mod... |
<vulnerable_code>!function(n){function e(n,e){return RegExp(n.replace(/<MOD>/g,function(){return"(?:\\([^|()\n]+\\)|\\[[^\\]\n]+\\]|\\{[^}\n]+\\})"}).replace(/<PAR>/g,function(){return"(?:\\)|\\((?![^|()\n]+\\)))"}),e||"")}var i={css:{pattern:/\{[^}]+\}/,inside:{rest:n.languages.css}},"class-id":{pattern:/(\()[^)]+(?=\... |
<vulnerable_code> }
},
'function-inline': {
pattern: /\$F:[-\w.]+\?[-\w.]+(?:,(?:\|?(?:[-#.^+*~]*(?:[\w+][^$]*)|=(?:[\S+][^$]*)|@[-#]*(?:\w+.)[\w+.]+)?)*)?\$/,
inside: {
'variable': {
pattern: /(?:[,|])@?(?:#+|[-+*~=^])?[\w.]+/,
alias: 'function'
},
'function-block': {
pattern: /\$XF:{[-\... |
<vulnerable_code>!function(n){n.languages.xeora=n.languages.extend("markup",{constant:{pattern:/\$(?:DomainContents|PageRenderDuration)\$/,inside:{punctuation:{pattern:/\$/}}},variable:{pattern:/\$@?(?:#+|[-+*~=^])?[\w.]+\$/,inside:{punctuation:{pattern:/[$.]/},operator:{pattern:/#+|[-+*~=^@]/}}},"function-inline":{pat... |
<vulnerable_code> workspace = Workspace(
agent.config.workspace_path, agent.config.restrict_to_workspace
)
path = os.path.join(directory, name)
generated_file = workspace.get_path(path)
path = os.path.join(generated_file)
try:
with open(path, "w+", encoding="utf-8") as f:
... |
<vulnerable_code> with open(destination) as f:
assert f.read() == random_code
def test_execute_python_code_filters_out_workspace_escaping(random_code: str, random_string: str, agent: Agent):
ai_name = agent.ai_name + "/../../"
result: str = sut.execute_python_code(random_code, "test_code", agent=age... |
<vulnerable_code> var toHash = ''
if (date !== null) {
toHash += date + '-' + salt
}
return toHash + '-' + hash(toHash + '-' + secret)
}
if (this.validity > 0) {
date = parseInt(token.substr(0, index))
if (Date.now() - date > this.validity) {
return false<commit_title>[PATCH] Store the ... |
<vulnerable_code>import markdown.postprocessors
import markdown.treeprocessors
import markdown.util
import requests
from django.conf import settings
from django.db.models import Q
# Name for the outer capture group we use to separate whitespace and
# other delimiters from the actual content. This value won't be an
# o... |
<vulnerable_code><commit_title>[PATCH] CVE-2021-41115: Use re2 for user-supplied linkifier patterns.<commit_description>Zulip attempts to validate that the regular expressions that admins
enter for linkifiers are well-formatted, and only contain a specific
subset of regex grammar. The process of checking these
propert... |
<vulnerable_code>)
import django.contrib.auth
from bitfield import BitField
from bitfield.types import BitHandler
from django.conf import settings
def filter_pattern_validator(value: str) -> None:
regex = re.compile(r"^(?:(?:[\w\-#_= /:]*|[+]|[!])(\(\?P<\w+>.+\)))+$")
error_msg = _("Invalid linkifier pattern... |
<vulnerable_code> url_format_string = r"https://trac.example.com/ticket/%(id)s"
linkifier_1 = RealmFilter(
realm=realm,
pattern=r"(?P<id>ABC\-[0-9]+)(?![A-Z0-9-])",
url_format_string=url_format_string,
)
linkifier_1.save()
self.assertEqual(
... |
<vulnerable_code> result = self.client_post("/json/realm/filters", info=data)
self.assert_json_error(result, "This field cannot be blank.")
data["pattern"] = "$a"
result = self.client_post("/json/realm/filters", info=data)
self.assert_json_error(
result, "Invalid link... |
<vulnerable_code>
String_Obj Parser::parse_ie_keyword_arg()
{
String_Schema_Ptr kwd_arg = SASS_MEMORY_NEW(String_Schema, pstate, 3);
if (lex< variable >()) {
kwd_arg->append(SASS_MEMORY_NEW(Variable, pstate, Util::normalize_underscores(lexed)));
} else {<commit_title>[PATCH] Fix memory leak in `pa... |
<vulnerable_code> .finally(() => server.close());
});
});<commit_title>[PATCH] Merge pull request from GHSA-4w46-w44m-3jq3<commit_description>* strip password after authentication to prevent cleartext password storage
* fixed forgotten testcase forcing ;-/
* added test to check if password is not stored in use... |
<vulnerable_code>
return new Promise((resolve, reject) => {
client.bind(userCn, authData.password, ldapError => {
if (ldapError) {
let error;
switch (ldapError.code) {<commit_title>[PATCH] Merge pull request from GHSA-4w46-w44m-3jq3<commit_description>* strip password after authentication to... |
<vulnerable_code>from absl.testing import parameterized
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import errors
# Need array_grad to register gradient for Identity.
from tensorflow.python.ops import array_grad ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.