text stringlengths 79 3.72M |
|---|
<vulnerable_code>except ImportError:
pass
__version__ = "1.26.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/32] Implement MSC2858 support (#9183)<commit_description>Fixes #8928.<fixed_code>... |
<vulnerable_code> with open(file_path) as file_stream:
return file_stream.read()
def read_templates(
self,
filenames: List[str],
custom_template_directory: Optional[str] = None,
autoescape: bool = False,
) -> List[jinja2.Template]:
"""Load a list of te... |
<vulnerable_code> "recaptcha_siteverify_api",
"https://www.recaptcha.net/recaptcha/api/siteverify",
)
self.recaptcha_template = self.read_templates(
["recaptcha.html"], autoescape=True
)[0]
def generate_config_section(self, **kwargs):
return """\<c... |
<vulnerable_code>
def read_config(self, config, **kwargs):
consent_config = config.get("user_consent")
self.terms_template = self.read_templates(["terms.html"], autoescape=True)[0]
if consent_config is None:
return<commit_title>[PATCH 01/32] Implement MSC2858 support (#9183)<com... |
<vulnerable_code> self.session_lifetime = session_lifetime
# The success template used during fallback auth.
self.fallback_success_template = self.read_templates(
["auth_success.html"], autoescape=True
)[0]
def generate_config_section(self, generate_secrets=False, **kwar... |
<vulnerable_code> if not admin_users:
raise SynapseError(400, "No local admin user in room")
admin_user_id = admin_users[-1]
pl_content = power_levels.content
else:<commit_title>[PATCH 01/32] Implement MSC2858 support (#9183)<commit_description>Fixes #8928.<f... |
<vulnerable_code> #
# For the default provider, the following settings are available:
#
# sub: name of the claim containing a unique identifier for the
# user. Defaults to 'sub', which OpenID Connect compliant
# provide... |
<vulnerable_code>
UserAttributeDict = TypedDict(
"UserAttributeDict", {"localpart": Optional[str], "display_name": Optional[str]}
)
C = TypeVar("C")
env = Environment(finalize=jinja_finalize)
@attr.s
class JinjaOidcMappingConfig:
subject_claim = attr.ib(type=str)
localpart_template = attr.ib(type=Option... |
<vulnerable_code># See the License for the specific language governing permissions and
# limitations under the License.
import string
from collections import Counter
from typing import Iterable, Optional, Tuple, Type
# offer the user a choice of login mechanisms.
#
# idp_icon: An optio... |
<vulnerable_code> # user-facing name of this auth provider
self.idp_name = "CAS"
# we do not currently support icons for CAS auth, but this is required by
# the SsoIdentityProvider protocol type.
self.idp_icon = None
self._sso_handler = hs.get_sso_handler()
<commit_title... |
<vulnerable_code> # MXC URI for icon for this auth provider
self.idp_icon = provider.idp_icon
self._sso_handler = hs.get_sso_handler()
self._sso_handler.register_identity_provider(self)<commit_title>[PATCH 01/32] Implement MSC2858 support (#9183)<commit_description>Fixes #8928.<fixed_co... |
<vulnerable_code> # user-facing name of this auth provider
self.idp_name = "SAML"
# we do not currently support icons for SAML auth, but this is required by
# the SsoIdentityProvider protocol type.
self.idp_icon = None
# a map from saml session id to Saml2SessionData obj... |
<vulnerable_code> """Optional MXC URI for user-facing icon"""
return None
@abc.abstractmethod
async def handle_redirect_request(
self,<commit_title>[PATCH 01/32] Implement MSC2858 support (#9183)<commit_description>Fixes #8928.<fixed_code>
"""Optional MXC URI for user-facing icon... |
<vulnerable_code> e = {"id": idp.idp_id, "name": idp.idp_name} # type: JsonDict
if idp.idp_icon:
e["icon"] = idp.idp_icon
return e
<commit_title>[PATCH 01/32] Implement MSC2858 support (#9183)<commit_description>Fixes #8928.<fixed_code>
e = {"id": idp.idp_id, "name": idp.idp_name} # type: Json... |
<vulnerable_code># See the License for the specific language governing permissions and
# limitations under the License.
import logging
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Set, Tuple
from synapse.api import errors
from synapse.api.constants import EventTypes
self._auth_handler... |
<vulnerable_code># limitations under the License.
import logging
from typing import Dict, List, Optional, Tuple
import attr
from canonicaljson import encode_canonical_json
from synapse.logging.opentracing import log_kv, set_tag, tag_args, trace
from synapse.replication.http.devices import ReplicationUserDevicesResync... |
<vulnerable_code># limitations under the License.
import logging
from synapse.api.errors import (
Codes,
SynapseError,
)
from synapse.logging.opentracing import log_kv, trace
from synapse.util.async_helpers import Linearizer
logger = logging.getLogger(__name__)
The actual payload of the encrypted keys ... |
<vulnerable_code>
@wraps(func)
def _tag_args_inner(*args, **kwargs):
argspec = inspect.getargspec(func)
for i, arg in enumerate(argspec.args[1:]):
set_tag("ARG_" + arg, args[i])
set_tag("args", args[len(argspec.args) :])<commit_title>[PATCH 01/32] Implement MSC2858 support (#... |
<vulnerable_code>
async def get_e2e_cross_signing_keys_bulk(
self, user_ids: List[str], from_user_id: Optional[str] = None
) -> Dict[str, Dict[str, dict]]:
"""Returns the cross-signing keys for a set of users.
Args:
async def claim_e2e_one_time_keys(
self, query_list: Itera... |
<vulnerable_code> self._no_verify_ssl_context = _no_verify_ssl.getContext()
self._no_verify_ssl_context.set_info_callback(_context_info_cb)
def get_options(self, host: bytes):
# IPolicyForHTTPS.get_options takes bytes, but we want to compare
# against the str whitelist. The hostname... |
<vulnerable_code> defaults={"per_second": 0.17, "burst_count": 3.0},
):
self.per_second = config.get("per_second", defaults["per_second"])
self.burst_count = config.get("burst_count", defaults["burst_count"])
class FederationRateLimitConfig:
defaults={"per_second": 0.01, "burst_... |
<vulnerable_code> HttpResponseException,
SynapseError,
)
from synapse.config.emailconfig import ThreepidBehaviour
from synapse.http import RequestTimedOutError
from synapse.http.client import SimpleHttpClient
from synapse.types import JsonDict, Requester
from synapse.util import json_decoder
from synapse.util.ha... |
<vulnerable_code>class EmailPasswordRequestTokenRestServlet(RestServlet):
PATTERNS = client_patterns("/account/password/email/requestToken$")
def __init__(self, hs):
super().__init__()
self.hs = hs
self.datastore = hs.get_datastore()
# Raise if the provided next_link value i... |
<vulnerable_code> Codes.THREEPID_DENIED,
)
existing_user_id = await self.hs.get_datastore().get_user_id_by_threepid(
"email", email
)
Codes.THREEPID_DENIED,
)
existing_user_id = await self.hs.get_datastore().get_user_id_by_thre... |
<vulnerable_code>
import synapse.rest.admin
from synapse.api.constants import LoginType, Membership
from synapse.api.errors import Codes
from synapse.rest.client.v1 import login, room
from synapse.rest.client.v2_alpha import account, register
from synapse.rest.synapse.client.password_reset import PasswordResetSubmitTok... |
<vulnerable_code> site = attr.ib(type=Site)
_reactor = attr.ib()
result = attr.ib(type=dict, default=attr.Factory(dict))
_producer = None
@property
def getPeer(self):
# We give an address so that getClientIP returns a non null entry,
# causing us to record the MAU
return ... |
<vulnerable_code> custom_headers: Optional[
Iterable[Tuple[Union[bytes, str], Union[bytes, str]]]
] = None,
) -> FakeChannel:
"""
Create a SynapseRequest at the path using the method and containing the
custom_headers: (name, value) pairs to add as request head... |
<vulnerable_code> "local": {"per_second": 10000, "burst_count": 10000},
"remote": {"per_second": 10000, "burst_count": 10000},
},
"saml2_enabled": False,
"default_identity_server": None,
"key_refresh_interval": 24 * 60 * 60 * 1000,<commit_title>[PATCH 01/32] Implem... |
<vulnerable_code> defaults={"per_second": 0.003, "burst_count": 5},
)
def generate_config_section(self, **kwargs):
return """\
## Ratelimiting ##
# "remote" for when users are trying to join rooms not on the server (which
# can be more expensive)
#... |
<vulnerable_code> "User's homeserver does not support this room version",
Codes.UNSUPPORTED_ROOM_VERSION,
)
elif e.code == 403:
raise e.to_synapse_error()
else:
raise<commit_title>[PATCH 01/32] Imp... |
<vulnerable_code> if event.state_key == self._server_notices_mxid:
raise SynapseError(HTTPStatus.FORBIDDEN, "Cannot invite this user")
# keep a record of the room version, if we don't yet know it.
# (this may get overwritten if we later get a different room version in a
# joi... |
<vulnerable_code>
self.third_party_event_rules = hs.get_third_party_event_rules()
async def upgrade_room(
self, requester: Requester, old_room_id: str, new_version: RoomVersion
) -> str:
invite_3pid_list = []
invite_list = []
await self.event_creation_handler.as... |
<vulnerable_code> burst_count=hs.config.ratelimiting.rc_joins_remote.burst_count,
)
# This is only used to get at ratelimit function, and
# maybe_kick_guest_users. It's fine there are multiple of these as
# it doesn't store state.
"""
raise NotImplementedError... |
<vulnerable_code>from unittest import TestCase
from synapse.api.constants import EventTypes
from synapse.api.errors import AuthError, Codes, SynapseError
from synapse.api.room_versions import RoomVersions
from synapse.events import EventBase
from synapse.federation.federation_base import event_from_pdu_json
s... |
<vulnerable_code> self.assertEquals(json.loads(content), channel.json_body)
class RoomJoinRatelimitTestCase(RoomBase):
user_id = "@sid1:red"
<commit_title>[PATCH 01/32] Implement MSC2858 support (#9183)<commit_description>Fixes #8928.<fixed_code>
self.assertEquals(json.loads(content), channel.json_... |
<vulnerable_code>import gc
import logging
import os
import signal
import socket
import sys
# rest of time. Doing so means less work each GC (hopefully).
#
# This only works on Python 3.7
if sys.version_info >= (3, 7):
gc.collect()
gc.freeze()
<commit_title>[PATCH 01/32] Implement MSC2858... |
<vulnerable_code>from synapse.rest.key.v2 import KeyApiV2Resource
from synapse.rest.synapse.client.pick_idp import PickIdpResource
from synapse.rest.synapse.client.pick_username import pick_username_resource
from synapse.rest.well_known import WellKnownResource
from synapse.server import HomeServer
from synapse.storage... |
<vulnerable_code>from typing_extensions import NoReturn, Protocol
from twisted.web.http import Request
from synapse.api.constants import LoginType
from synapse.api.errors import Codes, NotFoundError, RedirectException, SynapseError
from synapse.handlers.ui_auth import UIAuthSessionDataConstants
from synapse.http impo... |
<vulnerable_code> request.setHeader(b"Content-Security-Policy", b"frame-ancestors 'none';")
def finish_request(request: Request):
""" Finish writing the response to the request.
<commit_title>[PATCH 01/32] Implement MSC2858 support (#9183)<commit_description>Fixes #8928.<fixed_code>
request.setHeader(b"Con... |
<vulnerable_code># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import TYPE_CHECKING
import pkg_resources
from twisted.web.resource import Resource
from twisted.web.static impo... |
<vulnerable_code><commit_title>[PATCH 01/32] Implement MSC2858 support (#9183)<commit_description>Fixes #8928.<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 t... |
<vulnerable_code>from synapse.rest.client.v2_alpha.account import WhoamiRestServlet
from synapse.rest.synapse.client.pick_idp import PickIdpResource
from synapse.rest.synapse.client.pick_username import pick_username_resource
from synapse.types import create_requester
from tests import unittest
d = super().cr... |
<vulnerable_code>from typing_extensions import ContextManager
from twisted.internet import address
import synapse
import synapse.events
ToDeviceStream,
)
from synapse.rest.admin import register_servlets_for_media_repo
from synapse.rest.client.v1 import events, room
from synapse.rest.client.v1.initial_sync import ... |
<vulnerable_code>from synapse.rest.admin import AdminRestResource
from synapse.rest.health import HealthResource
from synapse.rest.key.v2 import KeyApiV2Resource
from synapse.rest.synapse.client.pick_idp import PickIdpResource
from synapse.rest.synapse.client.pick_username import pick_username_resource
from synapse.res... |
<vulnerable_code># -*- coding: utf-8 -*-
# Copyright 2020 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.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License f... |
<vulnerable_code>
return await self.db_pool.runInteraction("get_users_by_id_case_insensitive", f)
async def get_user_by_external_id(
self, auth_provider: str, external_id: str
) -> Optional[str]:
self._invalidate_cache_and_stream(txn, self.get_user_by_id, (user_id,))
async def rec... |
<vulnerable_code>from synapse.rest.client.v1 import login, logout
from synapse.rest.client.v2_alpha import devices, register
from synapse.rest.client.v2_alpha.account import WhoamiRestServlet
from synapse.rest.synapse.client.pick_idp import PickIdpResource
from synapse.rest.synapse.client.pick_username import pick_user... |
<vulnerable_code>from synapse.handlers.ui_auth.checkers import UserInteractiveAuthChecker
from synapse.rest.client.v1 import login
from synapse.rest.client.v2_alpha import auth, devices, register
from synapse.rest.oidc import OIDCResource
from synapse.types import JsonDict, UserID
from tests import unittest
def c... |
<vulnerable_code> # * HTML page for a confirmation step before redirecting back to the client
# with the login token: 'sso_redirect_confirm.html'.
#
# When rendering, this template is given three variables:
# * redirect_url: the URL the user is about to... |
<vulnerable_code>from synapse.logging.context import defer_to_thread
from synapse.metrics.background_process_metrics import run_as_background_process
from synapse.module_api import ModuleApi
from synapse.types import JsonDict, Requester, UserID
from synapse.util import stringutils as stringutils
from synapse.util.async... |
<vulnerable_code> to an additional page. (e.g. to prompt for more information)
"""
# grab a lock while we try to find a mapping for this user. This seems...
# optimistic, especially for implementations that end up redirecting to
# interstitial pages.
g... |
<vulnerable_code> )
async def complete_sso_login_async(
self, registered_user_id: str, request: SynapseRequest, client_redirect_url: str
):
"""Complete a SSO login by redirecting the user to a page to confirm whether they
want their access token sent to `client_redirect_url`, or ... |
<vulnerable_code>
# check that the auth handler got called as expected
auth_handler.complete_sso_login.assert_called_once_with(
"@test_user:test", request, "redirect_uri", None
)
def test_map_cas_user_to_existing_user(self):
# check that the auth handler got called as e... |
<vulnerable_code> self.get_success(self.handler.handle_oidc_callback(request))
auth_handler.complete_sso_login.assert_called_once_with(
expected_user_id, request, client_redirect_url, None,
)
self.provider._exchange_code.assert_called_once_with(code)
self.provider._pa... |
<vulnerable_code>
# check that the auth handler got called as expected
auth_handler.complete_sso_login.assert_called_once_with(
"@test_user:test", request, "redirect_uri", None
)
@override_config({"saml2_config": {"grandfathered_mxid_source_attribute": "mxid"}})
# check... |
<vulnerable_code>import argparse
import errno
import os
import time
import urllib.parse
from collections import OrderedDict
from hashlib import sha256
from textwrap import dedent
from typing import Any, Callable, Iterable, List, MutableMapping, Optional
import attr
import jinja2
import pkg_resources
import yaml
clas... |
<vulnerable_code> #
# localpart_template: Jinja2 template for the localpart of the MXID.
# If this is not set, the user will be prompted to choose their
# own username.
#
# display_name_template: Jinja2 template for t... |
<vulnerable_code> sso_config = config.get("sso") or {} # type: Dict[str, Any]
# The sso-specific template_dir
template_dir = sso_config.get("template_dir")
# Read templates from disk
(
"sso_auth_success.html",
"sso_auth_bad_user.html",
... |
<vulnerable_code> logger.info("Recorded registration session id %s", session_id)
# Set the cookie and redirect to the username picker
e = RedirectException(b"/_synapse/client/pick_username")
e.cookies.append(
b"%s=%s; path=/"
% (USERNAME_MAPPING_SESSION_COOKIE_NAM... |
<vulnerable_code><commit_title>[PATCH 01/32] Implement MSC2858 support (#9183)<commit_description>Fixes #8928.<fixed_code>
const usernameField = document.getElementById("field-username");
function throttle(fn, wait) {
let timeout;
return function() {
const args = Array.from(arguments);
if (time... |
<vulnerable_code>let inputField = document.getElementById("field-username");
let inputForm = document.getElementById("form");
let submitButton = document.getElementById("button-submit");
let message = document.getElementById("message");
// Submit username and receive response
function showMessage(messageText) {
//... |
<vulnerable_code>
consent_template_directory = hs.config.user_consent_template_dir
loader = jinja2.FileSystemLoader(consent_template_directory)
self._jinja_env = jinja2.Environment(
loader=loader, autoescape=jinja2.select_autoescape(["html", "htm", "xml"])<commit_title>[PATCH 01/32]... |
<vulnerable_code># See the License for the specific language governing permissions and
# limitations under the License.
from typing import TYPE_CHECKING
import pkg_resources
from twisted.web.http import Request
from twisted.web.resource import Resource
from twisted.web.static import File
from synapse.handlers.sso i... |
<vulnerable_code><commit_title>[PATCH 01/32] Implement MSC2858 support (#9183)<commit_description>Fixes #8928.<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 t... |
<vulnerable_code> # that should redirect to the username picker
self.assertEqual(channel.code, 302, channel.result)
picker_url = channel.headers.getRawHeaders("Location")[0]
self.assertEqual(picker_url, "/_synapse/client/pick_username")
# ... with a username_mapping_session cooki... |
<vulnerable_code> session.session_id, login_type, result
)
except LoginError as e:
if login_type == LoginType.EMAIL_IDENTITY:
# riot used to have a bug where it would request a new
# validation token (thus sen... |
<vulnerable_code>
stats["daily_active_users"] = await hs.get_datastore().count_daily_users()
stats["monthly_active_users"] = await hs.get_datastore().count_monthly_users()
stats["daily_active_rooms"] = await hs.get_datastore().count_daily_active_rooms()
stats["daily_messages"] = await hs.get_datastore()... |
<vulnerable_code> (x[0] - 1) * x[1] for x in res if x[1]
)
async def count_daily_messages(self):
"""
Returns an estimate of the number of messages sent in the last day.<commit_title>[PATCH 01/32] Implement MSC2858 support (#9183)<commit_description>Fixes #8928.<fixed_code>
... |
<vulnerable_code># limitations under the License.
"""Contains functions for registering clients."""
import logging
from typing import TYPE_CHECKING, List, Optional, Tuple
from synapse import types
from synapse.api.constants import MAX_USERID_LENGTH, EventTypes, JoinRules, LoginType
user_type: Optional[str] = ... |
<vulnerable_code># limitations under the License.
import abc
import logging
from typing import TYPE_CHECKING, Awaitable, Callable, Dict, List, Mapping, Optional
from urllib.parse import urlencode
import attr
from synapse.http import get_request_user_agent
from synapse.http.server import respond_with_html, respond_with... |
<vulnerable_code># limitations under the License.
import logging
from typing import TYPE_CHECKING
from twisted.web.http import Request
from twisted.web.resource import Resource
DirectServeJsonResource,
respond_with_html,
)
from synapse.http.servlet import parse_string
from synapse.http.site import SynapseRequ... |
<vulnerable_code> fallback_to_members=True,
)
summary_text = await self.make_summary_text(
notifs_by_room, state_by_room, notif_events, user_id, reason
)
template_vars = {
"user_display_name": user_display_name,
if "url" in event.content:
... |
<vulnerable_code> # We should get emailed about those messages
self._check_for_mail()
def test_encrypted_message(self):
room = self.helper.create_room_as(self.user_id, tok=self.access_token)
self.helper.invite(<commit_title>[PATCH 01/32] Implement MSC2858 support (#9183)<commit_descr... |
<vulnerable_code> #
# * providers: a list of available Identity Providers. Each element is
# an object with the following attributes:
# * idp_id: unique identifier for the IdP
# * idp_name: user-facing name for the IdP
#
... |
<vulnerable_code> )
return self._sso_auth_confirm_template.render(
description=session.description, redirect_url=redirect_url,
)
async def complete_sso_login(<commit_title>[PATCH 01/32] Implement MSC2858 support (#9183)<commit_description>Fixes #8928.<fixed_code>
)
... |
<vulnerable_code> #
# * username: the localpart of the user's chosen user id
#
# * HTML page for a confirmation step before redirecting back to the client
# with the login token: 'sso_redirect_confirm.html'.
#<commit_title>[PATCH 01/32] Implem... |
<vulnerable_code> access_token: The access token of the newly logged in device, or
None if `inhibit_login` enabled.
"""
if self.hs.config.worker_app:
await self._post_registration_client(
user_id=user_id, auth_result=auth_result, access_token=access... |
<vulnerable_code> chosen_localpart = attr.ib(type=Optional[str], default=None)
use_display_name = attr.ib(type=bool, default=True)
emails_to_use = attr.ib(type=Collection[str], default=())
# the HTTP cookie used to track the mapping session id
# map from idp_id to SsoIdentityProvider
self._... |
<vulnerable_code>
from twisted.web.resource import Resource
from synapse.rest.synapse.client.pick_idp import PickIdpResource
from synapse.rest.synapse.client.pick_username import pick_username_resource
from synapse.rest.synapse.client.sso_register import SsoRegisterResource
# enabled (they just won't work very... |
<vulnerable_code><commit_title>[PATCH 01/32] Implement MSC2858 support (#9183)<commit_description>Fixes #8928.<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 t... |
<vulnerable_code> if (length < 2)
{
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
mng_info=MngInfoFreeStruct(mng_info);
ThrowReaderException(CorruptImageError,"CorruptImage");
}
<commit_title>[PATCH] https://github.com/Image... |
<vulnerable_code> stmp = le_short(stmp);
*channels = stmp;
if (stmp>2)
{
fprintf (stderr, "Only mono and (intensity) stereo supported\n");
return -1;<commit_title>[PATCH] wav_io: guard against invalid channel numbers<commit_description>Fixes #13<fixed_code>
stmp = le_short(stmp);
*channels... |
<vulnerable_code> $(this).qtip({
overwrite: false,
content: {
attr: 'data-content'
},
show: {
event: event.type,<commit_title>[PATCH] avoid CSS vulnerability in Job Queue page<commit_description><fixed_code>
$(this).qtip({
overwrite: false,
... |
<vulnerable_code> info->ec3_done = 1;
goto concatenate;
}
}
/* fill the info needed for the "dec3" atom */<commit_title>[PATCH] avformat/movenc: Check that frame_types other than<commit_description><fixed_code>
info->ec3_done = 1;
... |
<vulnerable_code> return (NULL);
}
if ((job = cupsdAddJob(priority, printer->name)) == NULL)
{
send_ipp_status(con, IPP_INTERNAL_ERROR,
add_job_uuid(job);
apply_printer_defaults(printer, job);
attr = ippFindAttribute(job->attrs, "requesting-user-name", IPP_TAG_NAME);
if (con->username[0])
{
... |
<vulnerable_code>from twisted.web._newclient import ResponseDone
from twisted.web.http import PotentialDataLoss
from twisted.web.iweb import UNKNOWN_LENGTH
logger = logging.getLogger(__name__)
class SslComponents:
def __init__(self, sydent):
self.sydent = sydent
fp = open(caCertFilename)
... |
<vulnerable_code>from sydent.http.servlets.authenticated_unbind_threepid_servlet import (
AuthenticatedUnbindThreePidServlet,
)
logger = logging.getLogger(__name__)
v2.putChild(b'hash_details', self.sydent.servlets.hash_details)
self.factory = Site(root)
self.factory.displayTracebacks = F... |
<vulnerable_code> for file in [
"fli_overrun.bin",
"sgi_overrun.bin",
"pcx_overrun.bin",
"pcx_overrun2.bin",
]:<commit_title>[PATCH] Catch SGI buffer overruns<commit_description><fixed_code>
for file in [
"fli_overrun.bin",
"... |
<vulnerable_code> *dest = (UINT32)((buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]);
}
static int expandrow(UINT8* dest, UINT8* src, int n, int z)
{
UINT8 pixel, count;
count = pixel & RLE_MAX_RUN;
if (!count)
return count;
if (pixel & RLE_COPY_FLAG) {
w... |
<vulnerable_code> )
# the in-memory cache:
# * ensures that only one request is active at a time
# * takes load off the DB for the thundering herds
# * also caches any failures (unlike the DB) so we don't keep
# requesting the same endpoint
og = og.... |
<vulnerable_code> server.data,
)
def test_nonexistent_image(self) -> None:
"""If the preview image doesn't exist, ensure some data is returned."""
self.lookups["matrix.org"] = [(IPv4Address, "10.1.2.3")]
)
self.pump()
self.assertEqual(channel.code, 200)
... |
<vulnerable_code> var $tooltip = $('<div id="tooltip">');
ctrl.events.on('render', function () {
render(false);
if (panel.legendType === 'Right side') {
setTimeout(function () { render(true); }, 50);
}
});
<commit_title>[PATCH 2/3] rebuilt v1.3.4<commit_description><fixed_code>
var $tooltip = ... |
<vulnerable_code> var _, $;
function link(scope, elem, attrs, ctrl) {
var data, panel;
elem = elem.find('.piechart-panel__chart');
var $tooltip = $('<div id="tooltip">');
ctrl.events.on('render', function () {
render(false);
if (panel.legendType === 'Right side') {
setTimeout(fu... |
<vulnerable_code>import 'jquery.flot.pie';
export default function link(scope, elem, attrs, ctrl) {
var data, panel;
elem = elem.find('.piechart-panel__chart');
var $tooltip = $('<div id="tooltip">');
if (!ctrl.data) { return; }
data = ctrl.data;
panel = ctrl.panel;
if (0 == ctrl.data.length... |
<vulnerable_code> psf_binheader_readf (psf, "j", dword - bytesread) ;
if (map_info->channel_map != NULL)
{ size_t chanmap_size = psf->sf.channels * sizeof (psf->channel_map [0]) ;
free (psf->channel_map) ;
<commit_title>[PATCH] src/aiff.c: Fix a buffer read overflow<commit_description>Secunia Advisory SA76717.
... |
<vulnerable_code>import org.slf4j.LoggerFactory;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
* @throws IOException If something fails.
*/
public static File createTempDir() throws IOException {
File tmpFile = File.createTempFile("okm", null);
if (!... |
<vulnerable_code> <T extends IdentifiableObject> long countAllValuesByAttributes( Class<T> klass, List<Attribute> attributes );
<T extends IdentifiableObject> List<T> getByUid( Class<T> clazz, Collection<String> uids );
<T extends IdentifiableObject> List<T> getById( Class<T> clazz, Collection<Long> ids );... |
<vulnerable_code> E1107( "Object type `{0}` is not translatable." ),
E1108( "Could not add item to collection: {0}" ),
E1109( "Could not remove item from collection: {0}" ),
/* Data */
E2000( "Query parameters cannot be null" ),<commit_title>[PATCH] Merge pull request from GHSA-52vp-f7hj-cj92<commit... |
<vulnerable_code>import static org.hisp.dhis.hibernate.jsonb.type.JsonbFunctions.HAS_USER_GROUP_IDS;
import static org.hisp.dhis.hibernate.jsonb.type.JsonbFunctions.HAS_USER_ID;
import static org.hisp.dhis.security.acl.AclService.LIKE_READ_METADATA;
import java.util.Arrays;
import java.util.Objects;
import lombok.Requ... |
<vulnerable_code>import org.hisp.dhis.category.CategoryOptionCombo;
import org.hisp.dhis.chart.Chart;
import org.hisp.dhis.common.exception.InvalidIdentifierReferenceException;
import org.hisp.dhis.hibernate.HibernateProxyUtils;
import org.hisp.dhis.reporttable.ReportTable;
import org.hisp.dhis.schema.Schema;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.