text
stringlengths
79
3.72M
<vulnerable_code> assert.strictEqual(Tokens({ secretLength: 4 }).secretSync().length, 6) }) }) }) describe('.create(secret)', function () {<commit_title>[PATCH] Fixed code coverage and add param validation<commit_description><fixed_code> assert.strictEqual(Tokens({ secretLength: 4 }).secre...
<vulnerable_code> const uint16_t Photoshop::iptc_ = 0x0404; const uint16_t Photoshop::preview_ = 0x040c; static inline bool inRange(int lo,int value, int hi) { return lo<=value && value <= hi; } clearMetadata(); int search = 6 ; // Exif, ICC, XMP, Comment, IPTC, SOF ...
<vulnerable_code> stdout = [""] stderr = [ """Exiv2 exception in print action for file $filename: Not a valid ICC Profile """ ] <commit_title>[PATCH] Improved handling of jpg segments to avoid out-of-bound<commit_description><fixed_code> stdout = [""] stderr = [ """Exiv2 exception in print action f...
<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; }<commit_title>[PATCH] add NULL checks in cJSON_SetValuestring<comm...
<vulnerable_code> DestroyQuantumPixels(quantum_info); quantum=(quantum_info->pad+6)*(quantum_info->depth+7)/8; extent=image->columns*quantum; if (quantum != (extent/image->columns)) return(MagickFalse); return(AcquireQuantumPixels(quantum_info,extent)); }<commit_title>[PATCH] https://github.com/ImageMagi...
<vulnerable_code> } remain -= size; tkHint->rtp_p->sl_header.accessUnitEndFlag = remain ? 0 : 1; e = gf_rtp_builder_process(tkHint->rtp_p, ptr, size, (u8) !remain, samp->dataLength, duration, (u8) (descIndex + GF_RTP_TX3G_SIDX_OFFSET) ); ptr += size; tkHint->rtp_p->sl_header.accessUnitStartFlag =...
<vulnerable_code> * Utilities to aid in the translation of decimal types to/from multiple parts. * * @author Nick Williams * @since 2.2.0 */ public final class DecimalUtils { private static final BigDecimal ONE_BILLION = new BigDecimal(1_000_000_000L); private DecimalUtils() { throw new Runtime...
<vulnerable_code> optionsform_prefill: function() { var $span = $("#id_dom_admin_username").next("span"); $span.html("@" + $("#id_name").val()); }, domadminsform_init: function() {<commit_title>[PATCH 1/2] Fixed XSS issue in domain creation form.<commit_description><fixed_code> options...
<vulnerable_code> }); }; $(document).ready(function() { $(document).ajaxSuccess(function(e, xhr, settings) { ajax_login_redirect(xhr); }); $(document).ajaxError(defaultAjaxErrorHandler);<commit_title>[PATCH 1/2] Fixed XSS issue in domain creation form.<commit_description><fixed_code> }); }; /** * Simp...
<vulnerable_code> : gettext("This operation will remove all data associated to this domain, excepting accounts."); $("a[name=deldomain]").confirm({ question: function() { return this.$element.attr('title'); }, method: "POST", warning: warnmsg, checkbox...
<vulnerable_code> self._method('GET') elif self.path.startswith('/headers'): self._headers() elif self.path == '/trailing_garbage': payload = b'<html><video src="/vid.mp4" /></html>' self.send_response(200) self.assertEqual(do_req(303, 'PUT'), (...
<vulnerable_code> new_method = req.get_method() new_data = req.data remove_headers = [] # A 303 must either use GET or HEAD for subsequent request # https://datatracker.ietf.org/doc/html/rfc7231#section-6.4.4 if code == 303 and req.get_method() != 'HEAD': new_...
<vulnerable_code> return; } /*UTC_time - see annex C of DVB-SI ETSI EN 300468*/ /* decodes an Modified Julian Date (MJD) into a Co-ordinated Universal Time (UTC) See annex C of DVB-SI ETSI EN 300468 */<commit_title>[PATCH] mpeg2ts: add section size check (#2395)<commit_description><fixed_code> return; } if (da...
<vulnerable_code>import com.vaadin.flow.server.AppShellRegistry; import com.vaadin.flow.server.BootstrapHandler; import com.vaadin.flow.server.Constants; import com.vaadin.flow.server.HandlerHelper; import com.vaadin.flow.server.VaadinContext; import com.vaadin.flow.server.VaadinRequest; import com.vaadin.flow.server.V...
<vulnerable_code> return 0; } int parse(char *elf) { int fd; struct stat st; PRINT_SECTION_TITLE("Nr", "Name", "Type", "Addr", "Off", "Size", "Es", "Flg", "Lk", "Inf", "Al"); for (int i = 0; i < ehdr->e_shnum; i++) { name = elf_map + shstrtab.sh_offset + shdr[i].sh_name; ...
<vulnerable_code> len = (*p)[0] << 8 | (*p)[1]; *p += 2; if( (*p) + len > end ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message " "(psk_identity_hint length)" ) );<commit_title>[PATCH] Prevent arithmetic overflow on bounds check<commit_descripti...
<vulnerable_code> name: description: - Zone name. type: str required: true path: import os import platform import tempfile import time if int(self.os_minor) < 10: self.module.fail_json(msg='This module requires Solaris 10 or later') def configure(self): if not sel...
<vulnerable_code> if (error) goto out_unlock; /* for DAX, we convert unwritten extents directly */ if (create && (!nimaps || (new || ISUNWRITTEN(&imap)))) set_buffer_new(bh_result); BUG_ON(direct && imap.br_startblock == DELAYSTARTBLOCK); return 0; out_unlock:<commit_title>[PATCH] xfs: don't BUG(...
<vulnerable_code> new_size = DICTIONARY_MAX_SIZE; else new_size = rar_fls((unsigned int)rar->unp_size) << 1; new_window = realloc(rar->lzss.window, new_size); if (new_window == NULL) { archive_set_error(&a->archive, ENOMEM,<commit_title>[PATCH] Avoid a double-free when a window size of 0 is...
<vulnerable_code> bmc->pdev.name = "ipmi_bmc"; rv = ida_simple_get(&ipmi_bmc_ida, 0, 0, GFP_KERNEL); if (rv < 0) goto out; bmc->pdev.dev.driver = &ipmidriver.driver; bmc->pdev.id = rv; bmc->pdev.dev.release = release_bmc_device;<commit_title>[PATCH] ipmi: Fix memory leak in __ipmi_bmc_register<commit_des...
<vulnerable_code>} R_API ut8 *r_bin_java_get_attr_buf(RBinJavaObj *bin, ut64 sz, const ut64 offset, const ut8 *buf, const ut64 len) { ut8 *attr_buf = NULL; int pending = len - offset; const ut8 *a_buf = offset + buf; attr_buf = (ut8 *) calloc (pending + 1, 1); if (!attr_buf) { eprintf ("Unable to allocate enoug...
<vulnerable_code>from bagel.config import Settings from langchain.docstore.document import Document from langchain.vectorstores import Bagel from tests.integration_tests.vectorstores.fake_embeddings import ( def test_similarity_search() -> None: """Test smiliarity search""" setting = Settings( bagel_...
<vulnerable_code> options.mode = OSTREE_REPO_CHECKOUT_MODE_USER; options.overwrite_mode = OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES; options.enable_fsync = FALSE; /* We checkout to a temp dir and sync before moving it in place */ if (!ostree_repo_checkout_at (self->repo, &options, ...
<vulnerable_code> } else if (local_pull) { if (!ostree_repo_remote_get_url (flatpak_dir_get_repo (system), arg_origin, &url, g_main_context_push_thread_default (main_context); if (!flatpak_dir_pull (system, arg_ori...
<vulnerable_code>} ); QUnit.test( "altField", function( assert ) { assert.expect( 10 ); var inp = testHelper.init( "#inp" ), alt = $( "#alt" ); // No alternate field set inp.simulate( "keydown", { ctrlKey: true, keyCode: $.ui.keyCode.END } ); assert.equal( inp.val(), "", "Alt field - dp - ctrl+end" ); assert....
<vulnerable_code> altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" ); date = this._getDate( inst ); dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) ); $( altField ).val( dateStr ); } }, <commit_title>[PATCH] Datepicker: Make sure altField is treated as ...
<vulnerable_code> HTTPStatus.BAD_GATEWAY, "Got error %d" % (response.code,), Codes.UNKNOWN ) # TODO: if our Content-Type is HTML or something, just read the first # N bytes into RAM rather than saving it all to disk only to read it # straight back in again ) ...
<vulnerable_code> } } f = function(x){ if (typeof(x)!=='number') throw new TypeError('cdf function input must be a number, got:'+typeof(x)); if (Number.isNaN(x)) return x; var left=0, right=xs.length-1, mid, midval; if (x<xs[0]) return 0; if (x>=xs[xs.length-1]) r...
<vulnerable_code>PY33 = sys.version_info[0] == 3 and sys.version_info[1] >= 3 PY37 = sys.version_info[0] == 3 and sys.version_info[1] >= 7 PY310 = sys.version_info[0] == 3 and sys.version_info[1] >= 10 if PY2: import urlparse<commit_title>[PATCH 1/2] feat(profiling): Use co_qualname in python 3.11 (#1831)<commit_d...
<vulnerable_code>from contextlib import contextmanager import sentry_sdk from sentry_sdk._compat import PY33 from sentry_sdk._types import MYPY from sentry_sdk.utils import ( filename_for_module, ) def get_frame_name(frame): # type: (FrameType) -> str # in 3.11+, there is a frame.f_code.co_qualname ...
<vulnerable_code> gevent = None minimum_python_33 = pytest.mark.skipif( sys.version_info < (3, 3), reason="Profiling is only supported in Python >= 3.3" ) requires_gevent = pytest.mark.skipif(gevent is None, reason="gevent not enabled") return [(tid, (stack, stack)) for tid, stack in sample] @pytest.ma...
<vulnerable_code> if not hub: return if hub.client and hub.client.options["instrumenter"] != INSTRUMENTER.OTEL: return <commit_title>[PATCH 1/2] feat(profiling): Use co_qualname in python 3.11 (#1831)<commit_description>The `get_frame_name` implementation works well for <3.11 but...
<vulnerable_code> size_t bytes_per_line, extent, length; ssize_t count=(ssize_t) ReadBlob(image,sun_info.length,sun_data); if (count != (ssize_t) sun_info.length) ThrowReaderException(CorruptImageError,"UnableToReadImageData"); sun_pixels=sun_data; bytes_per_line=0; if (sun_inf...
<vulnerable_code>/* Character classification. * Note we assume ASCII compatibility of code points < 128 here. */ #define ISIN_(ch, ch_min, ch_max) ((ch_min) <= (unsigned)(ch) && (unsigned)(ch) <= (ch_max)) #define ISANYOF_(ch, palette) (md_strchr((palette), (ch)) != NULL) #define ISANYOF2_(ch, ch1, ch2...
<vulnerable_code> char *str; u_int len, j; // packet is truncated... further inspection is not needed if((offset+4+str_len) >= packet->payload_packet_len) return(-1); u_int16_t p_offset, u_int16_t certificate_len) { struct ndpi_packet_struct *packet = &flow->packet; u_int num_found = 0, i; ...
<vulnerable_code> if (gf_isom_get_sample_count(file, sceneT)==1) { samp = gf_isom_get_sample(file, sceneT, 1, &descIndex); if (samp && gf_hinter_can_embbed_data(samp->data, samp->dataLength, GF_STREAM_SCENE)) { slc.timeScale = slc.timestampResolution = gf_isom_get_media_timescale(file, sceneT); slc.OCRR...
<vulnerable_code> email_regex = re.compile( r"^" "(?P<local>[^@]*[^@.])" r"@" r"(?P<server>[^@]+(?:\.[^@]+)*)" r"$", re.IGNORECASE, ) <commit_title>[PATCH] optimize email regex (credits: @kevinbackhouse, fix: #372)<commit_description><fixed_code> email_regex = re.compile( r"^" "(?P<local>[^@]*[^@.])" r"@...
<vulnerable_code>import javax.servlet.http.HttpSession; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.joda.time.LocalDateTime; import org.slf4j.Logger; import org.xwiki.component.annotation.Component; import org.xwiki.configuration.ConfigurationSource; ...
<vulnerable_code> */ package org.xwiki.contrib.oidc.auth.internal; import java.net.URI; import java.net.URISyntaxException; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; import org.junit.jupiter.api.Test; import org.xwiki.configuration.ConfigurationSource; import org.xwiki.test.junit...
<vulnerable_code> TRANSACTION_CONCURRENCY_LIMIT, ) async def on_context_state_request( self, origin: str, room_id: str, event_id: str ) -> Tuple[int, Dict[str, Any]]: origin_host, _ = parse_server_name(origin)<commit_title>[PATCH] Kill off some references to "context"<commit_...
<vulnerable_code> class FederationStateV1Servlet(BaseFederationServlet): PATH = "/state/(?P<context>[^/]*)/?" # This is when someone asks for all data for a given context. async def on_GET(self, origin, content, query, context): return await self.handler.on_context_state_request( origi...
<vulnerable_code> private ByteBufAllocator wrapped; private int maxAllocation; public TestByteBufAllocator(ByteBufAllocator wrapped) { this.wrapped = wrapped; } <commit_title>[PATCH] Fix Checkstyle violation<commit_description><fixed_code> private ByteBufAllocator wra...
<vulnerable_code>// Note ';' is \x3B var PATH_VALUE = /[\x20-\x3A\x3C-\x7E]+/; // Used for checking whether or not there is a trailing semi-colon var TRAILING_SEMICOLON = /;+$/; var DAY_OF_MONTH = /^(\d{1,2})[^\d]*$/; var TIME = /^(\d{1,2})[^\d]*:(\d{1,2})[^\d]*:(\d{1,2})[^\d]*$/; var MONTH = /^(Jan|Feb|Mar|Apr|May|J...
<vulnerable_code> "no path": function(c) { assert.equal(c.path, null) }, "no domain": function(c) { assert.equal(c.domain, null) }, "no extensions": function(c) { assert.ok(!c.extensions) } } }) .export(module);<commit_title>[PATCH] Reduce parse time for many semicolons.<commit_description>Bug ...
<vulnerable_code> jas_matrix_t *matrix; int i; if (!(matrix = jas_malloc(sizeof(jas_matrix_t)))) { return 0; }<commit_title>[PATCH] Fixed a problem with a null pointer dereference in the BMP<commit_description><fixed_code> jas_matrix_t *matrix; int i; if (numrows < 0 || numcols < 0) { return 0; } if (!(m...
<vulnerable_code> uint_fast16_t numcmpts; long n; if (optstr) { jas_eprintf("warning: ignoring BMP decoder options\n"); } /* Read the bitmap header. */ if (bmp_gethdr(in, &hdr)) { jas_eprintf("cannot get header\n"); return 0; } JAS_DBGLOG(1, ( "BMP header: magic 0x%x; siz %d; res1 %d; res2 %d; off %d\n...
<vulnerable_code> DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); documentBuilderFactory.setIgnoringElementContentWhitespace(true); DocumentBuilder documentBuilder = documentBuilderFactor...
<vulnerable_code>MLFLOW_DEFAULT_PREDICTION_DEVICE = _EnvironmentVariable( "MLFLOW_DEFAULT_PREDICTION_DEVICE", str, None )<commit_title>[PATCH] Disallow using a file URI as model version source (#8126)<commit_description>* Add a test Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * Add a test Si...
<vulnerable_code>from mlflow.utils.proto_json_utils import message_to_json, parse_dict from mlflow.utils.validation import _validate_batch_log_api_req from mlflow.utils.string_utils import is_string_type from mlflow.utils.uri import is_local_uri from mlflow.utils.file_utils import local_file_uri_to_path from mlflow.tra...
<vulnerable_code> return False parsed_uri = urllib.parse.urlparse(uri) if parsed_uri.hostname: return False scheme = parsed_uri.scheme return False def is_http_uri(uri): scheme = urllib.parse.urlparse(uri).scheme return scheme == "http" or scheme == "https"<commit_title>[PATCH...
<vulnerable_code> process.wait(timeout=timeout) def _init_server(backend_uri, root_artifact_uri): """ Launch a new REST server using the tracking store specified by backend_uri and root artifact directory specified by root_artifact_uri. **os.environ, BACKEND_STORE_URI_ENV_VAR: b...
<vulnerable_code> ) def test_create_model_version_with_local_source(mlflow_client): name = "mode" mlflow_client.create_registered_model(name) exp_id = mlflow_client.create_experiment("test") run = mlflow_client.create_run(experiment_id=exp_id) response = requests.post( f"{mlflow_cl...
<vulnerable_code> assert is_local_uri("./mlruns") assert is_local_uri("file:///foo/mlruns") assert is_local_uri("file:foo/mlruns") assert not is_local_uri("file://myhostname/path/to/file") assert not is_local_uri("https://whatever")<commit_title>[PATCH] Disallow using a file URI as model version sou...
<vulnerable_code> return QStringLiteral("qemu"); } QString mp::platform::daemon_config_home() // temporary { auto ret = QString{qgetenv("DAEMON_CONFIG_HOME")};<commit_title>[PATCH] [settings] move privileged mounts default to platform<commit_description><fixed_code> return QStringLiteral("qemu"); } QString...
<vulnerable_code> {mp::autostart_key, autostart_default}, {mp::hotkey_key, default_hotkey()}, {mp::bridged_interface_key, ""}, {mp::mounts_key, "true"}};...
<vulnerable_code> key_aliases = calloc(num_key_aliases, sizeof(*key_aliases)); if (!key_aliases) return false; } i = 0; darray_foreach(alias, info->aliases) { if (alias->real != XKB_ATOM_NONE) { key_aliases[i].alias = alias->alias; key_aliases[i].r...
<vulnerable_code> return true; } static void read_module(RBuffer *b, ut64 addr, struct minidump_module *module) { st64 o_addr = r_buf_seek (b, 0, R_BUF_CUR); r_buf_seek (b, addr, R_BUF_SET); module->base_of_image = r_buf_read_le64 (b); module->size_of_image = r_buf_read_le32 (b); module->check_sum = r_buf_read_le...
<vulnerable_code> } } static const BYTE CBR2_BPP[] = { 0, 0, 0, 8, 16, 24, 32 }; static const BYTE BPP_CBR2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0 }; static const BYTE CBR23_BPP[] = { 0, 0, 0, 8, 16, 2...
<vulnerable_code>import io.vertx.core.http.HttpHeaders; import io.vertx.core.http.HttpServerRequest; import io.vertx.core.http.HttpServerResponse; import io.vertx.ext.web.Route; import io.vertx.ext.web.RoutingContext; } if (!route.isExactPath()) { final String rest = context.pathParam("*"); if (re...
<vulnerable_code><commit_title>[PATCH] Fix the webroot escape to classpath on windows<commit_description>Signed-off-by: Paulo Lopes <pmlopes@gmail.com><fixed_code> /* * Copyright 2014 Red Hat, Inc. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Ecl...
<vulnerable_code>@SuppressWarnings("serial") public class EmailValidator extends RegexpValidator { /** * Creates a validator for checking that a string is a syntactically valid * e-mail address. * the message to display in case the value does not validate. */ public EmailValidato...
<vulnerable_code> req.mu = source_mu; req.allowed = true; hook_call_user_can_login(&req); if (!req.allowed) { sasl_logcommand(p, source_mu, CMDLOG_LOGIN, "failed LOGIN to \2%s\2 (denied by hook)", entity(source_mu)->name);<commit_title>[PATCH] saslserv/main: free sasl_sourceinfo_t after use<commit_description><fi...
<vulnerable_code> const char* fnName = "getCachedUTFString"; const J9UTF8* pathUTF = NULL; U_8 temp[J9SH_MAXPATH + sizeof(J9UTF8)]; J9UTF8* temputf = (J9UTF8*)&temp; char* tempstr = (char*)J9UTF8_DATA(temputf); SH_ScopeManager* localSCM; bool allowUpdate = true; Trc_SHR_Assert_False(_ccHead->hasWriteMutex(curre...
<vulnerable_code> Write colormap to file. */ q=colormap; if (image->depth <= 8) for (i=0; i < (ssize_t) image->colors; i++) { *q++=(unsigned char) image->colormap[i].red; *q++=(unsigned char) image->colormap[i].green; *q++=(unsigned char) image->colormap[i].blue; } else for ...
<vulnerable_code> buffer=(unsigned char *) AcquireQuantumMemory(512,sizeof(*buffer)); if (buffer == (unsigned char *) NULL) ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); packet_size=(size_t) (image->depth > 8 ? 2: 1); scanline=(unsigned char *) AcquireQuantumMemory(image->columns,packet_...
<vulnerable_code> imsx = 2048; imsy = 2048; imbuf = (unsigned char *) AcquireQuantumMemory(imsx * imsy,1); if (imbuf == NULL) { return(MagickFalse); sixel_palet[n] = SIXEL_RGB(255, 255, 255); } (void) ResetMagickMemory(imbuf, background_color_index, imsx * imsy); while (*p...
<vulnerable_code> (void) SetImageType(huffman_image,BilevelType,exception); write_info=CloneImageInfo((ImageInfo *) NULL); SetImageInfoFile(write_info,file); (void) SetImageType(image,BilevelType,exception); (void) SetImageDepth(image,1,exception); write_info->compression=Group4Compression; write_info->typ...
<vulnerable_code> status_buf, KLSI_STATUSBUF_LEN, 10000 ); if (rc < 0) dev_err(&port->dev, "Reading line status failed (error = %d)\n", rc); else { status = get_unaligned_le16(status_buf); dev_info(&port->serial->dev->dev, "read status %x %x\n",<commit_title>[PATCH] USB: serial: kl5ku...
<vulnerable_code> bool src_known = tnum_subreg_is_const(src_reg->var_off); bool dst_known = tnum_subreg_is_const(dst_reg->var_off); struct tnum var32_off = tnum_subreg(dst_reg->var_off); s32 smin_val = src_reg->smin_value; u32 umin_val = src_reg->umin_value; /* Assuming scalar64_min_max_or will be called so it is...
<vulnerable_code> path, which will be within the original buffer. Guaranteed to not make the path longer, and will not fail. 'size' is the length of the path, if known. If -1, the first null character will be assumed to be the end of the path. */ wchar_t * _Py_normpathAndSize(wchar_t *path, Py_ssize_t size, ...
<vulnerable_code># See the License for the specific language governing permissions and # limitations under the License. import os import sys import yappi def main(): try: if os.getenv('DEFAULT_SCORE_HOST') is not None: os.system("ssh-keyscan "+os.getenv('DEFAULT_SCORE_HOST')+" >> /root/.ssh/k...
<vulnerable_code> async def __init_score_container(self): """create score container and save score_info and score_stub """ for i in range(conf.SCORE_LOAD_RETRY_TIMES): try: self.__score_info = await self.__run_score_container() except BaseException as e...
<vulnerable_code> genesis_block = 3 ########### # SCORE ### ########### DEFAULT_SCORE_HOST = os.getenv('DEFAULT_SCORE_HOST', '') DEFAULT_SCORE_BASE = os.getenv('DEFAULT_SCORE_BASE', 'git@'+DEFAULT_SCORE_HOST) DEFAULT_SCORE_REPOSITORY_PATH = os.path.join(LOOPCHAIN_ROOT_PATH, 'score') DEFAULT_SCORE_STORAGE_PATH = os...
<vulnerable_code> class MetaParams: class ScoreLoad: repository_path = "repository_path" score_package = "score_package" base = "base" peer_id = "peer_id" class ScoreInfo: score_id = "score_id" score_version = "score_version"<commit_title>[PATCH] [LC-426] refact...
<vulnerable_code> class PeerServiceStub(metaclass=SingletonMetaClass): REST_GRPC_TIMEOUT = conf.GRPC_TIMEOUT + conf.REST_ADDITIONAL_TIMEOUT REST_SCORE_QUERY_TIMEOUT = conf.SCORE_QUERY_TIMEOUT + conf.REST_ADDITIONAL_TIMEOUT def __init__(self): self.__stub_to_peer_service = None def set_stub_por...
<vulnerable_code>import loopchain import loopchain.utils as util from loopchain import configure as conf from loopchain.baseservice import ObjectManager, StubManager, CommonSubprocess from loopchain.blockchain.types import Address from loopchain.blockchain.blocks import Block from loopchain.blockchain.transactions impo...
<vulnerable_code>/* POST create user */ router.get('/new', function(req, res, next) { var conn = mysql.createConnection({ host : "localhost", user : "root", password: "root", port : 3306,<commit_title>[PATCH] Added remote host to msyql connection<commit_description><fixed_code> /* POST create...
<vulnerable_code> super().__init__(hs) self.hs = hs self.is_mine_id = hs.is_mine_id self.http_client = hs.get_simple_http_client() self._presence_enabled = hs.config.use_presence <commit_title>[PATCH] Apply an IP range blacklist to push and key revocation<commit_description><fixe...
<vulnerable_code> for domain in federation_domain_whitelist: self.federation_domain_whitelist[domain] = True self.federation_ip_range_blacklist = config.get( "federation_ip_range_blacklist", [] ) # Attempt to create an IPSet from the given ranges ...
<vulnerable_code> def __init__(self, hs): super().__init__(hs) self.clock = hs.get_clock() self.client = hs.get_http_client() self.key_servers = self.config.key_servers async def get_keys(self, keys_to_fetch): def __init__(self, hs): super().__init__(hs) self....
<vulnerable_code> def __init__(self, hs: "HomeServer"): self.config = hs.config self.http_client = hs.get_simple_http_client() self.clock = hs.get_clock() self._instance_name = hs.get_instance_name() <commit_title>[PATCH] Apply an IP range blacklist to push and key revocation<commit_...
<vulnerable_code> def __init__(self, hs): self.server_name = hs.hostname self.client = hs.get_http_client() @log_function def get_room_state_ids(self, destination, room_id, event_id):<commit_title>[PATCH] Apply an IP range blacklist to push and key revocation<commit_description><fixed_code>...
<vulnerable_code> self._message_handler = hs.get_message_handler() self._server_notices_mxid = hs.config.server_notices_mxid self.config = hs.config self.http_client = hs.get_simple_http_client() self._instance_name = hs.get_instance_name() self._replication = hs.get_repli...
<vulnerable_code> def __init__(self, hs): super().__init__(hs) self.http_client = SimpleHttpClient(hs) # We create a blacklisting instance of SimpleHttpClient for contacting identity # servers specified by clients self.blacklisting_http_client = SimpleHttpClient( ...
<vulnerable_code> return _scheduler class IPBlacklistingResolver: """ A proxy for reactor.nameResolver which only produces non-blacklisted IP addresses, preventing DNS rebinding attacks on URL preview. return r class BlacklistingAgentWrapper(Agent): """ An Agent wrapper which will pre...
<vulnerable_code>import urllib.parse from typing import List, Optional from netaddr import AddrFormatError, IPAddress from zope.interface import implementer from twisted.internet import defer from twisted.web.iweb import IAgent, IAgentEndpointFactory, IBodyProducer from synapse.crypto.context_factory import Federati...
<vulnerable_code>from canonicaljson import encode_canonical_json from prometheus_client import Counter from signedjson.sign import sign_json from zope.interface import implementer from twisted.internet import defer from twisted.internet.error import DNSLookupError from twisted.internet.interfaces import IReactorPlugga...
<vulnerable_code> if "url" not in self.data: raise PusherConfigException("'url' required in data for HTTP pusher") self.url = self.data["url"] self.http_client = hs.get_proxied_http_client() self.data_minus_url = {} self.data_minus_url.update(self.data) del sel...
<vulnerable_code> def __init__(self, hs): self.hs = hs self.auth = hs.get_auth() self.client = hs.get_http_client() self.clock = hs.get_clock() self.server_name = hs.hostname self.store = hs.get_datastore()<commit_title>[PATCH] Apply an IP range blacklist to push and k...
<vulnerable_code> @cache_in_self def get_simple_http_client(self) -> SimpleHttpClient: return SimpleHttpClient(self) @cache_in_self def get_proxied_http_client(self) -> SimpleHttpClient: return SimpleHttpClient( self, http_proxy=os.getenvb(b"http_proxy"), ...
<vulnerable_code> self.mock_http_client.put_json = DeferredMockCallable() hs = yield setup_test_homeserver( self.addCleanup, http_client=self.mock_http_client, keyring=Mock(), ) self.filtering = hs.get_filtering()<commit_title>[PATCH] Apply an IP range blacklist to push and ...
<vulnerable_code> def make_homeserver(self, reactor, clock): hs = self.setup_test_homeserver( http_client=None, homeserver_to_use=GenericWorkerServer ) return hs<commit_title>[PATCH] Apply an IP range blacklist to push and key revocation<commit_description><fixed_code> def m...
<vulnerable_code>class ServerKeyFetcherTestCase(unittest.HomeserverTestCase): def make_homeserver(self, reactor, clock): self.http_client = Mock() hs = self.setup_test_homeserver(http_client=self.http_client) return hs def test_get_keys_from_server(self): } ] ...
<vulnerable_code> class DeviceTestCase(unittest.HomeserverTestCase): def make_homeserver(self, reactor, clock): hs = self.setup_test_homeserver("server", http_client=None) self.handler = hs.get_device_handler() self.store = hs.get_datastore() return hs class DehydrationTestCase(unit...
<vulnerable_code> self.mock_registry.register_query_handler = register_query_handler hs = self.setup_test_homeserver( http_client=None, resource_for_federation=Mock(), federation_client=self.mock_federation, federation_registry=self.mock_registry,<commit_t...
<vulnerable_code> ] def make_homeserver(self, reactor, clock): hs = self.setup_test_homeserver(http_client=None) self.handler = hs.get_federation_handler() self.store = hs.get_datastore() return hs<commit_title>[PATCH] Apply an IP range blacklist to push and key revocation<commit...
<vulnerable_code> def make_homeserver(self, reactor, clock): hs = self.setup_test_homeserver( "server", http_client=None, federation_sender=Mock() ) return hs <commit_title>[PATCH] Apply an IP range blacklist to push and key revocation<commit_description><fixed_code> def mak...
<vulnerable_code> hs = yield setup_test_homeserver( self.addCleanup, http_client=None, resource_for_federation=Mock(), federation_client=self.mock_federation, federation_server=Mock(),<commit_title>[PATCH] Apply an IP range blacklist to push and key re...
<vulnerable_code> hs = self.setup_test_homeserver( notifier=Mock(), http_client=mock_federation_client, keyring=mock_keyring, replication_streams={}, ) ) ) put_json = self.hs.get_http_client().put_json put_json.assert_c...
<vulnerable_code>from mock import Mock import treq from service_identity import VerificationError from zope.interface import implementer reactor=self.reactor, tls_client_options_factory=self.tls_factory, user_agent="test-agent", # Note that this is unused since _well_known_resolve...