text stringlengths 79 3.72M |
|---|
<vulnerable_code>
import com.vaadin.flow.component.AttachEvent;
import com.vaadin.flow.component.ComponentEventListener;
import com.vaadin.flow.component.HasHelper;
import com.vaadin.flow.component.HasLabel;
import com.vaadin.flow.component.HasSize;
@JsModule("./datepickerConnector.js")
@NpmPackage(value = "date-fns", ... |
<vulnerable_code><commit_title>[PATCH 1/5] chore: fix typo (#3121)<commit_description><fixed_code>
/*
* Copyright 2000-2022 Vaadin Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*... |
<vulnerable_code> * License for the specific language governing permissions and limitations under
* the License.
*/
package com.vaadin.flow.component.textfield;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.HasElement;
import com.vaadin.flow.dom.Element;
import java.util.Optional;
imp... |
<vulnerable_code><commit_title>[PATCH 1/5] chore: fix typo (#3121)<commit_description><fixed_code>
package com.vaadin.flow.component;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class HasClearButtonTest {
private TestComponent component;
@Before
public void setup() {
... |
<vulnerable_code> * License for the specific language governing permissions and limitations under
* the License.
*/
package com.vaadin.flow.component.textfield;
import com.vaadin.flow.component.HasElement;
import com.vaadin.flow.dom.Element;
import com.vaadin.flow.dom.ElementFactory;
import org.junit.Test;
import s... |
<vulnerable_code>
import com.vaadin.flow.component.AttachEvent;
import com.vaadin.flow.component.CompositionNotifier;
import com.vaadin.flow.component.HasHelper;
import com.vaadin.flow.component.HasLabel;
import com.vaadin.flow.component.HasSize;
extends GeneratedVaadinNumberField<C, T> implements HasSize,
... |
<vulnerable_code>
import com.vaadin.flow.component.AttachEvent;
import com.vaadin.flow.component.CompositionNotifier;
import com.vaadin.flow.component.HasHelper;
import com.vaadin.flow.component.HasLabel;
import com.vaadin.flow.component.HasSize;
extends GeneratedVaadinTextField<BigDecimalField, BigDecimal> imp... |
<vulnerable_code>
import com.vaadin.flow.component.AttachEvent;
import com.vaadin.flow.component.CompositionNotifier;
import com.vaadin.flow.component.HasHelper;
import com.vaadin.flow.component.HasLabel;
import com.vaadin.flow.component.HasSize;
public class EmailField extends GeneratedVaadinEmailField<EmailField, Str... |
<vulnerable_code>
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.HasElement;
/**
* Mixin interface for text-field components that have prefix and suffix slots
* prefix component
*/
default void setPrefixComponent(Component component) {
SlotHelpers.clearSl... |
<vulnerable_code>
import com.vaadin.flow.component.AttachEvent;
import com.vaadin.flow.component.CompositionNotifier;
import com.vaadin.flow.component.HasHelper;
import com.vaadin.flow.component.HasLabel;
import com.vaadin.flow.component.HasSize;
extends GeneratedVaadinPasswordField<PasswordField, String> imple... |
<vulnerable_code>
import com.vaadin.flow.component.AttachEvent;
import com.vaadin.flow.component.ComponentEventListener;
import com.vaadin.flow.component.HasEnabled;
import com.vaadin.flow.component.HasHelper;
import com.vaadin.flow.component.HasLabel;
@JsModule("./vaadin-time-picker/timepickerConnector.js")
public cla... |
<vulnerable_code> public void showSelectedCell(String name, int col, int row,
String cellValue, boolean function, boolean locked,
boolean initialSelection) {
getElement().callJsFunction("showSelectedCell", name, col, row,
cellValue, function, locked... |
<vulnerable_code>import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.DivElement;
import com.vaadin.addon.spreadsheet.shared.SpreadsheetState;
import com.vaadin.client.ApplicationConnecti... |
<vulnerable_code>
import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;
import com.vaadin.addon.spreadsheet.client.SpreadsheetServerRpc;
import elemental.json.Json;
import elemental.json.JsonArray;
import jsinterop.annotations.JsType;
@SuppressWarnings("serial")
@JsType
public class Spr... |
<vulnerable_code>import com.vaadin.flow.component.ComponentEventListener;
import elemental.json.JsonArray;
@SuppressWarnings("serial")
public class SpreadsheetEventListener
return o == null ? null : o.getBoolean(pos);
}
private HashMap<Integer, Float> toMapFloat(JsonArray o, int pos) {
HashMa... |
<vulnerable_code>
def __init__(self, default_timeout=300, cache="", **kwargs):
super(UWSGICache, self).__init__(
default_timeout, extract_serializer_args(kwargs)
)
if platform.python_implementation() == "PyPy":<commit_title>[PATCH] Add missing unpacking for uwsgi cache<commit_de... |
<vulnerable_code> count=ReadBlob(image,(size_t) GetBlobSize(image),buffer);
if ((count != (ssize_t) GetBlobSize(image)) ||
(LocaleNCompare((char *) buffer,"SFW",3) != 0))
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
(void) CloseBlob(image);
/*
Find the start of the JFIF data<commi... |
<vulnerable_code> unsigned char
*group4;
status=MagickTrue;
write_info=CloneImageInfo(image_info);
(void) CopyMagickString(write_info->filename,"GROUP4:",MagickPathExtent);
(void) CopyMagickString(write_info->magick,"GROUP4",MagickPathExtent);
group4_image=CloneImage(inject_image,0,0,MagickTrue,exceptio... |
<vulnerable_code> env_base_dir_name = os.getenv("CDO_DEMO_NONRANDOM_UUID_BASE")
if env_base_dir_name is None:
return
base_dir_original_path = pathlib.Path(env_base_dir_name)
if not base_dir_original_path.exists():<commit_title>[PATCH] Test relative call positions<commit_description>Disclaimer:
P... |
<vulnerable_code><commit_title>[PATCH] Test relative call positions<commit_description>Disclaimer:
Participation by NIST in the creation of the documentation of mentioned
software is not intended to imply a recommendation or endorsement by the
National Institute of Standards and Technology, nor is it intended to
imply ... |
<vulnerable_code><commit_title>[PATCH] Test relative call positions<commit_description>Disclaimer:
Participation by NIST in the creation of the documentation of mentioned
software is not intended to imply a recommendation or endorsement by the
National Institute of Standards and Technology, nor is it intended to
imply ... |
<vulnerable_code> !length)
return BGP_ATTR_PARSE_WITHDRAW;
/* "An UPDATE message that contains the MP_UNREACH_NLRI is not required
to carry any other path attributes.", though if MP_REACH_NLRI or NLRI
are present, it should. Check for any other attribute being present
instead.
*/
if ((!CHECK_FLA... |
<vulnerable_code> /* Network Layer Reachability Information. */
update_len = end - stream_pnt(s);
if (update_len && attribute_len) {
/* Set NLRI portion to structure. */
nlris[NLRI_UPDATE].afi = AFI_IP;
nlris[NLRI_UPDATE].safi = SAFI_UNICAST;<commit_title>[PATCH] bgpd: Ignore handling NLRIs if we received MP_U... |
<vulnerable_code>var URL = window.URL || window.webkitURL || window.mozURL || window.msURL;
navigator.saveBlob = navigator.saveBlob || navigator.msSaveBlob || navigator.mozSaveBlob || navigator.webkitSaveBlob;
window.saveAs = window.saveAs || window.webkitSaveAs || window.mozSaveAs || window.msSaveAs;
// Because highl... |
<vulnerable_code>// Secret for JWT tokens creation (make it dynamic for production)
var jwtSecret = "ASy4FVjsXNLQl09LbieroWsjO5UXjvX5";
exports.jwtSecret = jwtSecret;
class ACL {<commit_title>[PATCH] Implements @luisfontes19 PR for better JWT secret generation<commit_description><fixed_code>
require("dotenv").config()... |
<vulnerable_code>// Filename whitelist validation for template creation
function validFilename(filename) {
const regex = /^[A-zÀ-ú0-9 \[\]\'()_-]+$/i;<commit_title>[PATCH] Implements @luisfontes19 PR for better JWT secret generation<commit_description><fixed_code>
var fs = require('fs');
function createSecret() {
... |
<vulnerable_code> profileName_ = std::string(reinterpret_cast<char *>(chunkData.pData_), iccOffset-1);
++iccOffset; // +1 = 'compressed' flag
zlibToDataBuf(chunkData.pData_ + iccOffset, chunkLength - iccOffset, iccProfile_);
#ifdef DEBUG
st... |
<vulnerable_code> /*
* Read signature
*/
sig_len = ( p[0] << 8 ) | p[1];
p += 2;
<commit_title>[PATCH] Add bounds check before signature length read<commit_description><fixed_code>
/*
* Read signature
*/
if( p > end - 2 )
{
... |
<vulnerable_code>
try:
# Task was never executed. Initialize RenderedTaskInstanceFields
# to render template and mask secrets.
rendered_task_instance = RenderedTaskInstanceFields(self)
rendered_fields = rendered_task_instance.rendered_fields
if rendere... |
<vulnerable_code>
@pytest.mark.usefixtures("patch_app")
def test_rendered_template_secret(*args, admin_client, create_dag_run, task_secret):
"""Test that the Rendered View masks values retrieved from secret variables."""
Variable.set("my_secret", "foo")
Variable.set("spam", "egg")
ti.refresh_from_t... |
<vulnerable_code> FUNC(GITMODULES_NAME, ERROR) \
FUNC(GITMODULES_SYMLINK, ERROR) \
FUNC(GITMODULES_URL, ERROR) \
/* warnings */ \
FUNC(BAD_FILEMODE, WARN) \
FUNC(EMPTY_NAME, WARN) \
FSCK_MSG_GITMODULES_URL,
"disallowed submodule url: %s",
value);
free(name);
return 0;<commit_title>[PATCH... |
<vulnerable_code>DEFAULT_QUEUE_SIZE = 100
DEFAULT_MAX_BREADCRUMBS = 100
class INSTRUMENTER:
SENTRY = "sentry"<commit_title>[PATCH] Always remove Django session related cookies.<commit_description><fixed_code>
DEFAULT_QUEUE_SIZE = 100
DEFAULT_MAX_BREADCRUMBS = 100
SENSITIVE_DATA_SUBSTITUTE = "[Filtered]"
class ... |
<vulnerable_code>import weakref
from sentry_sdk._types import MYPY
from sentry_sdk.consts import OP
from sentry_sdk.hub import Hub, _should_send_default_pii
from sentry_sdk.scope import add_global_event_processor
from sentry_sdk.serializer import add_global_repr_processor
try:
from django import VERSION as DJANGO... |
<vulnerable_code> session_lifetime = self.parse_duration(session_lifetime)
self.session_lifetime = session_lifetime
def generate_config_section(self, generate_secrets=False, **kwargs):
if generate_secrets:
registration_shared_secret = 'registration_shared_secret: "%s"' % (<co... |
<vulnerable_code>logger = logging.getLogger(__name__)
SUCCESS_TEMPLATE = """
<html>
<head>
<title>Success!</title>
<meta name='viewport' content='width=device-width, initial-scale=1,
user-scalable=no, minimum-scale=1.0, maximum-scale=1.0'>
<link rel="stylesheet" href="/_matrix/static/client/register/style.css">
<... |
<vulnerable_code> break;
case TYPE_UNKNOWN:
eprintf ("Get not implemented for type 0x%x\n", type);
r_list_pop (refs);
free_object (ret);
return NULL;
case 0:<commit_title>[PATCH] Fix bins/*/rep8 - UAF crash in pyc parser ##crash<commit_description>* Reported by Cen Zhang via huntr.dev<fixed_code>
break;
c... |
<vulnerable_code> *out_size = tmp_out_size;
if (mp_buf != tmp_out_buf) {
flb_free(mp_buf);
}
/* Do time resolution ? */
/* Ensure the pointer we are about to read is not NULL */
if (k->via.str.ptr == NULL) {
flb_free(mp_buf);
*out_buf = NULL;
m... |
<vulnerable_code> if (file)
{
char buffer[1024]; int len;
while ((len = zzip_entry_fread (buffer, 1024, 1, file)))
{
DBG2("entry read %i", len);
fwrite (buffer, len, 1, out);
if (file)
{
char buffer[1024]; int len;
while ((len = zzip_entry_fread (buffer, 1024, 1, file)))
fwrite (buf... |
<vulnerable_code> self.xmpp.plugin['xep_0030'].add_feature('urn:xmpp:carbons:2')
def _handle_carbon_received(self, msg):
self.xmpp.event('carbon_received', msg)
def _handle_carbon_sent(self, msg):
self.xmpp.event('carbon_sent', msg)
def enable(self, ifrom=None, timeout=None, callba... |
<vulnerable_code> // LOG_HANDLE("common_size: %lu\n", obj->common_size); // needed for
// unknown
bit_set_position (dat, restartpos);
// obj->unknown_off = obj->unknown_pos - restartpos;
// LOG_TRACE("Unknown pos %lu, offset %lu\n", obj->unknown_pos,
// obj->u... |
<vulnerable_code> else
is_entity = obj->supertype == DWG_SUPERTYPE_ENTITY;
// properly dwg_decode_object/_entity for eed, reactors, xdic
if (klass && !is_entity)
error = dwg_encode_UNKNOWN_OBJ (dat, obj);
else if (klass)
error = dwg_encode_UNKNO... |
<vulnerable_code> else if ((error = dwg_free_variable_type (obj->parent, obj))
& DWG_ERR_UNHANDLEDCLASS)
{
int is_entity;
int i;
Dwg_Class *klass;
unhandled:
is_entity = 0;
i = obj->type - 500;
klass = NULL;
dwg ... |
<vulnerable_code> if(GetType() == MOD_TYPE_IT)
{
// IT pattern loop start row update - at the end of a pattern loop, set pattern loop start to next row (for upcoming pattern loops with missing SB0)
for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++)
{
if((pChn->rowCommand.command == CMD_S3... |
<vulnerable_code>** previous instruction 'oldpc'.
*/
static int changedline (const Proto *p, int oldpc, int newpc) {
while (oldpc++ < newpc) {
if (p->lineinfo[oldpc] != 0)
return (luaG_getfuncline(p, oldpc - 1) != luaG_getfuncline(p, newpc));
}
return 0; /* no line changes in the way */
}
<commit_titl... |
<vulnerable_code> # session to be active.
#
# This defaults to 0, meaning the user is queried for their credentials
# before every action, but this can be overridden to alow a single
# validation to be re-used. This weakens the protections afforded by
... |
<vulnerable_code> alias (str)
Returns:
boolean: True if user is allowed to crate the alias
"""
for rule in self._alias_creation_rules:
if rule.matches(user_id, room_id, [alias]):<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
... |
<vulnerable_code> if room_alias:
result["room_alias"] = room_alias.to_string()
# Always wait for room creation to progate before returning
await self._replication.wait_for_stream_position(
self.hs.config.worker.events_shard_config.get_instance(room_id),
"event... |
<vulnerable_code>class _Invalidation:
# _Invalidation is passed as an `on_invalidate` callback to bulk_get_push_rules,
# which means that it it is stored on the bulk_get_push_rules cache entry. In order
# to ensure that we don't accumulate lots of redunant callbacks on the cache entry,
# we need to ensu... |
<vulnerable_code>
Returns:
pushers: Dictionary containing pushers information.
total: Number of pushers in dictonary `pushers`.
"""
PATTERNS = admin_patterns("/users/(?P<user_id>[^/]*)/pushers$")<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
Returns:
... |
<vulnerable_code>
class RoomUpgradeRestServlet(RestServlet):
"""Handler for room uprade requests.
Handles requests of the form:
<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
class RoomUpgradeRestServlet(RestServlet):
"""Handler for room upgrade requests.
Handles reques... |
<vulnerable_code> # section 3.6 [2] to be a `token` or a `quoted-string`, where a `token`
# is (essentially) a single US-ASCII word, and a `quoted-string` is a
# US-ASCII string surrounded by double-quotes, using backslash as an
# escape charater. Note that %-encoding is *not* permitted.
... |
<vulnerable_code> async def get_local_media(
self, request: Request, media_id: str, name: Optional[str]
) -> None:
"""Responds to reqests for local media, if exists, or returns 404.
Args:
request: The incoming request.
media_info = await self.store.get_cached_remote_m... |
<vulnerable_code> event_map:
a dict from event_id to event, for any events that we happen to
have in flight (eg, those currently being persisted). This will be
used as a starting point fof finding the state we need; any missing
events will be re... |
<vulnerable_code> },
)
# Add the messages to the approriate local device inboxes so that
# they'll be sent to the devices when they next sync.
self._add_messages_to_local_device_inbox_txn(
txn, stream_id, local_messages_by_user_then_device<... |
<vulnerable_code> # and state sets {A} and {B} then walking the auth chains of A and B
# would immediately show that C is reachable by both. However, if we
# stopped at C then we'd only reach E via the auth chain of B and so E
# would errornously get included in the returned difference.
... |
<vulnerable_code> # Figure out the changes of membership to invalidate the
# `get_rooms_for_user` cache.
# We find out which membership events we may have deleted
# and which we have added, then we invlidate the caches for all
# those users.
members... |
<vulnerable_code> (server_name, key_id, from_server) triplet if one already existed.
Args:
server_name: The name of the server.
key_id: The identifer of the key this JSON is for.
from_server: The server this JSON was fetched from.
ts_now_ms: The time now in... |
<vulnerable_code> async def count_daily_sent_e2ee_messages(self):
def _count_messages(txn):
# This is good enough as if you have silly characters in your own
# hostname then thats your own fault.
like_clause = "%:" + self.hs.hostname
sql = """
async def co... |
<vulnerable_code>
Args:
room_id: List of room_ids.
to_key: Max stream id to fetch receipts upto.
from_key: Min stream id to fetch receipts from. None fetches
from the start.
Args:
room_ids: The room id.
to_key: Max stream id t... |
<vulnerable_code> async def _background_add_rooms_room_version_column(
self, progress: dict, batch_size: int
):
"""Background update to go and add room version inforamtion to `rooms`
table from `current_state_events` table.
"""
<commit_title>[PATCH 01/14] Fix some typos.<commit_de... |
<vulnerable_code> def get_current_state_deltas_txn(txn):
# First we calculate the max stream id that will give us less than
# N results.
# We arbitarily limit to 100 stream_id entries to ensure we don't
# select toooo many.
sql = """
SEL... |
<vulnerable_code> retry_interval: int,
) -> None:
"""Sets the current retry timings for a given destination.
Both timings should be zero if retrying is no longer occuring.
Args:
destination<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
... |
<vulnerable_code>
class StateGroupBackgroundUpdateStore(SQLBaseStore):
"""Defines functions related to state groups needed to run the state backgroud
updates.
"""
<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
class StateGroupBackgroundUpdateStore(SQLBaseStore):
"""Define... |
<vulnerable_code> # which should be empty.
if config is None:
raise ValueError(
"config==None in prepare_database, but databse is not empty"
)
# if it's a worker app, refuse to upgrade the database, to avoid multiple<commit_title>[P... |
<vulnerable_code> # and b) noting that if we have seen a run of persisted positions
# without gaps (e.g. 5, 6, 7) then we can skip forward (e.g. to 7).
#
# Note: There is no guarentee that the IDs generated by the sequence
# will be gapless; gaps can form when e.g. a transaction w... |
<vulnerable_code> persisted in the same room after this position will be after the
returned `RoomStreamToken`.
Note: no guarentees are made about ordering w.r.t. events in other
rooms.
"""
# Doing the naive thing satisfies the desired properties described in<commit_title>... |
<vulnerable_code> delayed_call = reactor.callLater(timeout, time_it_out)
def convert_cancelled(value: failure.Failure):
# if the orgininal deferred was cancelled, and our timeout has fired, then
# the reason it was cancelled was due to our timeout. Turn the CancelledError
# into a Timeou... |
<vulnerable_code>
await self._clean_room_for_join(room_id)
handled_events = set()
try:
# Try the host we successfully got a response to /make_join/
# request first.
auth_chain = ret["auth_chain"]
auth_chain.sort(key=lambda e: e.depth)
... |
<vulnerable_code>
import pymacaroons
from twisted.internet import defer
from synapse.api.auth import Auth
from synapse.api.constants import UserTypes
from synapse.api.errors import (
from synapse.types import UserID
from tests import unittest
from tests.utils import mock_getRawHeaders, setup_test_homeserver
class ... |
<vulnerable_code>
import jsonschema
from twisted.internet import defer
from synapse.api.constants import EventContentFields
from synapse.api.errors import SynapseError
from synapse.api.filtering import Filter
from synapse.events import make_event_from_dict
from tests import unittest
from tests.utils import setup_tes... |
<vulnerable_code> self.mock_scheduler = Mock()
hs = Mock()
hs.get_datastore.return_value = self.mock_store
self.mock_store.get_received_ts.return_value = defer.succeed(0)
self.mock_store.set_appservice_last_pos.return_value = defer.succeed(None)
hs.get_application_service_... |
<vulnerable_code># limitations under the License.
"""Tests REST events for /profile paths."""
import json
from mock import Mock
from twisted.internet import defer
import synapse.types
from synapse.api.errors import AuthError, SynapseError
from synapse.rest import admin
from synapse.rest.client.v1 import login, prof... |
<vulnerable_code>except ImportError:
pass
__version__ = "1.27.0rc2"
if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)):
# We import here so that we don't have to install a bunch of deps when<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
except ImportError:
pass
... |
<vulnerable_code>
# Copy over user power levels now as this will not be possible with >100PL users once
# the room has been created
# Calculate the minimum power level needed to clone the room
event_power_levels = power_levels.get("events", {})
state_default = power_levels.get("... |
<vulnerable_code><commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
# -*- coding: utf-8 -*-
# Copyright 2021 The Matrix.org Foundation C.I.C.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a... |
<vulnerable_code>from synapse.logging.context import make_deferred_yieldable
from synapse.types import JsonDict, UserID, map_username_to_mxid_localpart
from synapse.util import json_decoder
if TYPE_CHECKING:
from synapse.server import HomeServer
self._token_generator = token_generator
self._callb... |
<vulnerable_code><commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
# -*- coding: utf-8 -*-
# Copyright 2021 The Matrix.org Foundation C.I.C.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a... |
<vulnerable_code>from synapse.server import HomeServer
from synapse.types import UserID
from tests.test_utils import FakeResponse, simple_async_mock
from tests.unittest import HomeserverTestCase, override_config
try:
return config
def make_homeserver(self, reactor, clock):
self.http_client = Moc... |
<vulnerable_code><commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
# -*- coding: utf-8 -*-
# Copyright 2021 The Matrix.org Foundation C.I.C.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a... |
<vulnerable_code> return self.config["user"].split(":")[1]
def do_config(self, line):
""" Show the config for this client: "config"
Edit a key value mapping: "config key value" e.g. "config token 1234"
Config variables:
user: The username to auth with.
print(e... |
<vulnerable_code>
class HttpClient:
""" Interface for talking json over http
"""
def put_json(self, url, data):
""" Sends the specifed json data using PUT
Args:
url (str): The URL to PUT data to.
pass
def get_json(self, url, args=None):
""" Gets some json ... |
<vulnerable_code> self.redraw()
def redraw(self):
""" method for redisplaying lines
based on internal list of lines """
self.stdscr.clear()
self.paintStatus(self.statusText)<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
self.redraw()
... |
<vulnerable_code>
class InputOutput:
""" This is responsible for basic I/O so that a user can interact with
the example app.
"""
self.server = server
def on_line(self, line):
""" This is where we process commands.
"""
try:
m = re.match(r"^join (\S+)$", lin... |
<vulnerable_code> time.sleep(7)
print("SSRC spammer started")
while self.running:
ssrcMsg = (
"<presence to='%(tojid)s' xmlns='jabber:client'><x xmlns='http://jabber.org/protocol/muc'/><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://jitsi.org/jitsi... |
<vulnerable_code> arg_kinds.append(ARG_NAMED_OPT) # Arg is an optional kwarg.
signature = signature.copy_modified(
arg_types=arg_types, arg_names=arg_names, arg_kinds=arg_kinds,
)
return signature<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
arg_kinds.append(A... |
<vulnerable_code># We pin black so that our tests don't start failing on new releases.
CONDITIONAL_REQUIREMENTS["lint"] = [
"isort==5.7.0",
"black==19.10b0",
"flake8-comprehensions",
"flake8",
]<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
# We pin black so that our tests d... |
<vulnerable_code> rights: str = "access",
allow_expired: bool = False,
) -> synapse.types.Requester:
""" Get a registered user's ID.
Args:
request: An HTTP request with an access_token query parameter.
return user_id, app_service
async def get_user_by_access_... |
<vulnerable_code>
class RelationTypes:
"""The types of relations known to this server.
"""
ANNOTATION = "m.annotation"
REPLACE = "m.replace"<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
class RelationTypes:
"""The types of relations known to this server."""
ANN... |
<vulnerable_code>
class LimitExceededError(SynapseError):
"""A client has sent too many requests and is being throttled.
"""
def __init__(
self,
class RoomKeysVersionError(SynapseError):
"""A client has tried to upload to a non-current version of the room_keys store
"""
def __init__... |
<vulnerable_code>
@classmethod
def default(cls, user_id):
"""Returns a default presence state.
"""
return cls(
user_id=user_id,
state=PresenceState.OFFLINE,<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
@classmethod
def defaul... |
<vulnerable_code>
def start_worker_reactor(appname, config, run_command=reactor.run):
""" Run the reactor in the main process
Daemonizes if necessary, and then configures some resources, before starting
the reactor. Pulls configuration from the 'worker' settings in 'config'.
logger,
run_command=re... |
<vulnerable_code> ]
async def set_state(self, target_user, state, ignore_status_msg=False):
"""Set the presence state of the user.
"""
presence = state["presence"]
valid_presence = (<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
]
as... |
<vulnerable_code>
@cached(num_args=1, cache_context=True)
async def matches_user_in_member_list(
self, room_id: str, store: "DataStore", cache_context: _CacheContext,
) -> bool:
"""Check if this service is interested a room based upon it's membership
<commit_title>[PATCH 01/14] Fix some typo... |
<vulnerable_code>
try:
await self.put_json(
uri=uri, json_body=body, args={"access_token": service.hs_token},
)
sent_transactions_counter.labels(service.id).inc()
sent_events_counter.labels(service.id).inc(len(events))<commit_title>[PATCH 01/14] Fi... |
<vulnerable_code>
class ApplicationServiceScheduler:
""" Public facing API for this module. Does the required DI to tie the
components together. This also serves as the "event_pool", which in this
case is a simple array.
"""<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
c... |
<vulnerable_code> return self.read_templates([filename])[0]
def read_templates(
self, filenames: List[str], custom_template_directory: Optional[str] = None,
) -> List[jinja2.Template]:
"""Load a list of template files from disk using the given variables.
# TODO: switch to synap... |
<vulnerable_code>
class AuthConfig(Config):
"""Password and login configuration
"""
section = "auth"
<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
class AuthConfig(Config):
"""Password and login configuration"""
section = "auth"
|
<vulnerable_code> )
def get_single_database(self) -> DatabaseConnectionConfig:
"""Returns the database if there is only one, useful for e.g. tests
"""
if not self.databases:
raise Exception("More than one database exists")
<commit_title>[PATCH 01/14] Fix some typos.<commi... |
<vulnerable_code> self.email_notif_template_html,
self.email_notif_template_text,
) = self.read_templates(
[notif_template_html, notif_template_text], template_dir,
)
self.email_notif_for_new_users = email_config.get(
se... |
<vulnerable_code> )
logging_group.add_argument(
"-f", "--log-file", dest="log_file", help=argparse.SUPPRESS,
)
def generate_files(self, config, config_dir_path):<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
)
logging_group.add_argum... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.