filename
stringlengths
6
103
patch
stringlengths
47
76k
parent_content
stringlengths
17
1.6M
id
stringlengths
12
19
aiosmtpd/smtp.py
@@ -87,7 +87,7 @@ class _DataState(enum.Enum): EMPTY_BARR = bytearray() EMPTYBYTES = b'' MISSING = _Missing.MISSING -NEWLINE = '\n' +NEWLINE = '\r\n' VALID_AUTHMECH = re.compile(r"[A-Z0-9_-]+\Z") # https://tools.ietf.org/html/rfc3207.html#page-3 @@ -1427,9 +1427,10 @@ async def smtp_DATA(self, arg: str) -> None:...
# Copyright 2014-2021 The aiosmtpd Developers # SPDX-License-Identifier: Apache-2.0 import asyncio import asyncio.sslproto as sslproto import binascii import collections import enum import inspect import logging import re import socket import ssl from base64 import b64decode, b64encode from email._header_value_parser ...
PYSEC-2024-221
arches/app/models/concept.py
@@ -32,6 +32,8 @@ from django.utils.translation import ugettext as _ from django.utils.translation import get_language from django.db import IntegrityError +from psycopg2.extensions import AsIs + import logging @@ -505,13 +507,12 @@ def get_child_edges( except: return [] - ...
""" ARCHES - a program developed to inventory and manage immovable cultural heritage. Copyright (C) 2013 J. Paul Getty Trust and World Monuments Fund This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software ...
GHSA-gmpq-xrxj-xh8m
arches/app/views/concept.py
@@ -380,8 +380,7 @@ def dropdown(request): def paged_dropdown(request): conceptid = request.GET.get("conceptid") - query = request.GET.get("query", None) - query = None if query == "" else query + query = request.GET.get("query", "") page = int(request.GET.get("page", 1)) limit = 50 ...
""" ARCHES - a program developed to inventory and manage immovable cultural heritage. Copyright (C) 2013 J. Paul Getty Trust and World Monuments Fund This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software ...
GHSA-gmpq-xrxj-xh8m
cps/helper.py
@@ -734,10 +734,10 @@ def save_cover_from_url(url, book_path): if not cli.allow_localhost: # 127.0.x.x, localhost, [::1], [::ffff:7f00:1] ip = socket.getaddrinfo(urlparse(url).hostname, 0)[0][4][0] - if ip.startswith("127.") or ip.startswith('::ffff:7f') or ip == "::1": + ...
# -*- coding: utf-8 -*- # This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web) # Copyright (C) 2012-2019 cervinko, idalin, SiphonSquirrel, ouzklcn, akushsky, # OzzieIsaacs, bodybybuddha, jkrehm, matthazinski, janeczku # # This program is free software: you can ...
GHSA-2647-c639-qv2j
src/werkzeug/_internal.py
@@ -34,7 +34,7 @@ _legal_cookie_chars_re = rb"[\w\d!#%&\'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=]" _cookie_re = re.compile( rb""" - (?P<key>[^=;]+) + (?P<key>[^=;]*) (?:\s*=\s* (?P<val> "(?:[^\\"]|\\.)*" | @@ -382,16 +382,21 @@ def _cookie_parse_impl(b: bytes) -> t.Iterator[t.Tuple[b...
import logging import operator import re import string import sys import typing import typing as t from datetime import date from datetime import datetime from datetime import timezone from itertools import chain from weakref import WeakKeyDictionary if t.TYPE_CHECKING: from _typeshed.wsgi import StartResponse ...
GHSA-px8h-6qxv-m22q
src/werkzeug/sansio/http.py
@@ -126,10 +126,6 @@ def parse_cookie( def _parse_pairs() -> t.Iterator[t.Tuple[str, str]]: for key, val in _cookie_parse_impl(cookie): # type: ignore key_str = _to_str(key, charset, errors, allow_none_charset=True) - - if not key_str: - continue - val_...
import re import typing as t from datetime import datetime from .._internal import _cookie_parse_impl from .._internal import _dt_as_utc from .._internal import _to_str from ..http import generate_etag from ..http import parse_date from ..http import parse_etags from ..http import parse_if_range_header from ..http imp...
GHSA-px8h-6qxv-m22q
tests/test_http.py
@@ -412,7 +412,8 @@ def test_is_resource_modified_for_range_requests(self): def test_parse_cookie(self): cookies = http.parse_cookie( "dismiss-top=6; CP=null*; PHPSESSID=0a539d42abc001cdc762809248d4beed;" - 'a=42; b="\\";"; ; fo234{=bar;blub=Blah; "__Secure-c"=d' + 'a=42...
import base64 from datetime import date from datetime import datetime from datetime import timedelta from datetime import timezone import pytest from werkzeug import datastructures from werkzeug import http from werkzeug._internal import _wsgi_encoding_dance from werkzeug.test import create_environ class TestHTTPUt...
GHSA-px8h-6qxv-m22q
tests/compiler/ir/test_optimize_ir.py
@@ -143,7 +143,9 @@ (["sub", "x", 0], ["x"]), (["sub", "x", "x"], [0]), (["sub", ["sload", 0], ["sload", 0]], None), - (["sub", ["callvalue"], ["callvalue"]], None), + (["sub", ["callvalue"], ["callvalue"]], [0]), + (["sub", ["msize"], ["msize"]], None), + (["sub", ["gas"], ["gas"]], None), ...
import pytest from vyper.codegen.ir_node import IRnode from vyper.exceptions import StaticAssertionException from vyper.ir import optimizer optimize_list = [ (["eq", 1, 2], [0]), (["lt", 1, 2], [1]), (["eq", "x", 0], ["iszero", "x"]), (["ne", "x", 0], ["iszero", ["iszero", "x"]]), (["ne", "x", 1],...
GHSA-c647-pxm2-c52w
tests/parser/functions/test_create_functions.py
@@ -431,3 +431,212 @@ def test2(target: address, salt: bytes32) -> address: # test2 = c.test2(b"\x01", salt) # assert HexBytes(test2) == create2_address_of(c.address, salt, vyper_initcode(b"\x01")) # assert_tx_failed(lambda: c.test2(bytecode, salt)) + + +# XXX: these various tests to check the msize allo...
import pytest import rlp from eth.codecs import abi from hexbytes import HexBytes import vyper.ir.compile_ir as compile_ir from vyper.codegen.ir_node import IRnode from vyper.compiler.settings import OptimizationLevel from vyper.utils import EIP_170_LIMIT, checksum_encode, keccak256 # initcode used by create_minimal...
GHSA-c647-pxm2-c52w
tests/parser/functions/test_raw_call.py
@@ -426,6 +426,164 @@ def baz(_addr: address, should_raise: bool) -> uint256: assert caller.baz(target.address, False) == 3 +# XXX: these test_raw_call_clean_mem* tests depend on variables and +# calling convention writing to memory. think of ways to make more +# robust to changes to calling convention and mem...
import pytest from hexbytes import HexBytes from vyper import compile_code from vyper.builtins.functions import eip1167_bytecode from vyper.exceptions import ArgumentException, InvalidType, StateAccessViolation pytestmark = pytest.mark.usefixtures("memory_mocker") def test_max_outsize_exceeds_returndatasize(get_con...
GHSA-c647-pxm2-c52w
vyper/builtins/functions.py
@@ -21,6 +21,7 @@ clamp_basetype, clamp_nonzero, copy_bytes, + dummy_node_for_type, ensure_in_memory, eval_once_check, eval_seq, @@ -36,7 +37,7 @@ unwrap_location, ) from vyper.codegen.expr import Expr -from vyper.codegen.ir_node import Encoding +from vyper.codegen.ir_node import...
import hashlib import math import operator from decimal import Decimal from vyper import ast as vy_ast from vyper.abi_types import ABI_Tuple from vyper.ast.validation import validate_call_args from vyper.codegen.abi_encoder import abi_encode from vyper.codegen.context import Context, VariableRecord from vyper.codegen....
GHSA-c647-pxm2-c52w
vyper/codegen/ir_node.py
@@ -1,3 +1,4 @@ +import contextlib import re from enum import Enum, auto from functools import cached_property @@ -46,6 +47,77 @@ class Encoding(Enum): # future: packed +# shortcut for chaining multiple cache_when_complex calls +# CMC 2023-08-10 remove this and scope_together _as soon as_ we have +# real va...
import re from enum import Enum, auto from functools import cached_property from typing import Any, List, Optional, Tuple, Union from vyper.compiler.settings import VYPER_COLOR_OUTPUT from vyper.evm.address_space import AddrSpace from vyper.evm.opcodes import get_ir_opcodes from vyper.exceptions import CodegenPanic, C...
GHSA-c647-pxm2-c52w
airflow/www/auth.py
@@ -38,7 +38,8 @@ def decorated(*args, **kwargs): appbuilder = current_app.appbuilder dag_id = ( - request.args.get("dag_id") + kwargs.get("dag_id") + or request.args.get("dag_id") or request.form.get("dag_id") or...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
GHSA-2h84-3crq-vgfj
tests/www/views/test_views_tasks.py
@@ -369,6 +369,20 @@ def test_graph_trigger_origin_graph_view(app, admin_client): check_content_in_response(href, resp) +def test_graph_view_without_dag_permission(app, one_dag_perm_user_client): + url = "/dags/example_bash_operator/graph" + resp = one_dag_perm_user_client.get(url, follow_redirects=True)...
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
GHSA-2h84-3crq-vgfj
src/picklescan/scanner.py
@@ -11,6 +11,7 @@ from typing import IO, List, Optional, Set, Tuple import urllib.parse import zipfile +from .relaxed_zipfile import RelaxedZipFile from .torch import ( get_magic_number, @@ -375,7 +376,7 @@ def get_magic_bytes_from_zipfile(zip: zipfile.ZipFile, num_bytes=8): def scan_zip_bytes(data: IO[byte...
from dataclasses import dataclass from enum import Enum import http.client import io import json import logging import os import pickletools from tarfile import TarError from tempfile import TemporaryDirectory from typing import IO, List, Optional, Set, Tuple import urllib.parse import zipfile from .torch import ( ...
GHSA-2fh4-gpch-vqv4
tests/test_scanner.py
@@ -249,6 +249,22 @@ def initialize_zip_file(path, file_name, data): zip.writestr(file_name, data) +def initialize_corrupt_zip_file_central_directory(path, file_name, data): + if not os.path.exists(path): + with zipfile.ZipFile(path, "w") as zip: + zip.writestr(file_name, data) + +...
import aiohttp import bdb import http.client import importlib import io import os import pathlib import pickle import pip import py7zr import pydoc import pytest import requests import runpy import socket import subprocess import sys import venv import zipfile from functools import partial from unittest import TestCase...
GHSA-2fh4-gpch-vqv4
src/fides/api/service/privacy_request/dsr_package/dsr_report_builder.py
@@ -45,7 +45,9 @@ def pretty_print(value: str, indent: int = 4) -> str: return json.dumps(value, indent=indent, default=storage_json_encoder) jinja2.filters.FILTERS["pretty_print"] = pretty_print - self.template_loader = Environment(loader=FileSystemLoader(DSR_DIRECTORY)) + self.te...
import json import os import zipfile from collections import defaultdict from io import BytesIO from pathlib import Path from typing import Any, Dict, List, Optional import jinja2 from jinja2 import Environment, FileSystemLoader from fides.api.models.privacy_request import PrivacyRequest from fides.api.schemas.policy...
GHSA-3vpf-mcj7-5h38
bson/__init__.py
@@ -150,7 +150,7 @@ def _get_object(data, position, as_class, tz_aware, uuid_subtype): object = _elements_to_dict(encoded, as_class, tz_aware, uuid_subtype) position += obj_size if "$ref" in object: - return (DBRef(object.pop("$ref"), object.pop("$id"), + return (DBRef(object.pop("$ref"), o...
# Copyright 2009-2012 10gen, Inc. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
PYSEC-2013-30
test/test_collection.py
@@ -30,6 +30,7 @@ from bson.binary import Binary, UUIDLegacy, OLD_UUID_SUBTYPE, UUID_SUBTYPE from bson.code import Code +from bson.dbref import DBRef from bson.objectid import ObjectId from bson.py3compat import b from bson.son import SON @@ -1675,6 +1676,31 @@ def test_bad_encode(self): self.assertRais...
# -*- coding: utf-8 -*- # Copyright 2009-2012 10gen, Inc. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
PYSEC-2013-30
nova/tests/virt/vmwareapi/test_driver_api.py
@@ -34,6 +34,7 @@ from nova.compute import api as compute_api from nova.compute import power_state from nova.compute import task_states +from nova.compute import vm_states from nova import context from nova import exception from nova.openstack.common import jsonutils @@ -1191,6 +1192,31 @@ def test_get_info(self)...
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # Copyright (c) 2012 VMware, Inc. # Copyright (c) 2011 Citrix Systems, Inc. # Copyright 2011 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. Yo...
GHSA-jv34-xvjq-ppch
nova/virt/vmwareapi/vmops.py
@@ -29,6 +29,7 @@ from nova import compute from nova.compute import power_state from nova.compute import task_states +from nova.compute import vm_states from nova import context as nova_context from nova import exception from nova.network import model as network_model @@ -966,13 +967,9 @@ def reboot(self, instanc...
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # Copyright (c) 2012 VMware, Inc. # Copyright (c) 2011 Citrix Systems, Inc. # Copyright 2011 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. Yo...
GHSA-jv34-xvjq-ppch
lollms/server/endpoints/lollms_configuration_infos.py
@@ -155,7 +155,7 @@ async def apply_settings(request: Request): "debug_log_file_path", "petals_model_path", "skills_lib_database_name", - "discussion_db_name" + ...
""" project: lollms file: lollms_configuration_infos.py author: ParisNeo description: This module contains a set of FastAPI routes that provide information about the Lord of Large Language and Multimodal Systems (LoLLMs) Web UI application. These routes are specific to configurations """ from fastapi import ...
GHSA-8mrm-r7h3-c3hj
lib/ansible/plugins/callback/splunk.py
@@ -98,6 +98,9 @@ def send_event(self, url, authtoken, state, result, runtime): else: ansible_role = None + if 'args' in result._task_fields: + del result._task_fields['args'] + data = {} data['uuid'] = result._task._uuid data['session'] = self.sessio...
# -*- coding: utf-8 -*- # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distr...
GHSA-3m93-m4q6-mc6v
lib/ansible/plugins/callback/sumologic.py
@@ -89,6 +89,9 @@ def send_event(self, url, state, result, runtime): else: ansible_role = None + if 'args' in result._task_fields: + del result._task_fields['args'] + data = {} data['uuid'] = result._task._uuid data['session'] = self.session
# -*- coding: utf-8 -*- # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distr...
GHSA-3m93-m4q6-mc6v
llama-index-core/llama_index/core/exec_utils.py
@@ -45,20 +45,16 @@ def _restricted_import( "float": float, "format": format, "frozenset": frozenset, - "getattr": getattr, - "hasattr": hasattr, "hash": hash, "hex": hex, "int": int, "isinstance": isinstance, "issubclass": issubclass, - "iter": iter, "len": len, ...
import ast import copy from types import CodeType, ModuleType from typing import Any, Dict, Mapping, Sequence, Union ALLOWED_IMPORTS = { "math", "time", "datetime", "pandas", "scipy", "numpy", "matplotlib", "plotly", "seaborn", } def _restricted_import( name: str, globals:...
GHSA-wvpx-g427-q9wc
keystone/common/config.py
@@ -188,7 +188,7 @@ def configure(): register_cli_str('pydev-debug-host', default=None) register_cli_int('pydev-debug-port', default=None) - register_str('admin_token', default='ADMIN') + register_str('admin_token', secret=True, default='ADMIN') register_str('bind_host', default='0.0.0.0') r...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 OpenStack LLC # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
GHSA-rxrm-xvp4-jqvh
tensorflow/python/ops/image_ops_test.py
@@ -3161,6 +3161,14 @@ def testPreserveAspectRatioSquare(self): self._assertResizeCheckShape(x, x_shape, [320, 320], [320, 320, 3]) + def testLargeDim(self): + with self.session(): + with self.assertRaises(errors.InternalError): + x = np.ones((5, 1, 1, 2)) + v = image_ops.resize_images_v...
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
PYSEC-2021-392
jupyter_server_proxy/__init__.py
@@ -3,6 +3,8 @@ from jupyter_server.utils import url_path_join as ujoin from .api import ServersInfoHandler, IconHandler +__version__ = "3.2.3" + # Jupyter Extension points def _jupyter_server_extension_points(): return [{
from .handlers import setup_handlers from .config import ServerProxy as ServerProxyConfig, make_handlers, get_entrypoint_server_processes, make_server_process from jupyter_server.utils import url_path_join as ujoin from .api import ServersInfoHandler, IconHandler # Jupyter Extension points def _jupyter_server_extensio...
GHSA-w3vc-fx9p-wp4v
jupyter_server_proxy/handlers.py
@@ -124,6 +124,39 @@ def check_origin(self, origin=None): async def open(self, port, proxied_path): raise NotImplementedError('Subclasses of ProxyHandler should implement open') + async def prepare(self, *args, **kwargs): + """ + Enforce authentication on *all* requests. + + This...
""" Authenticated HTTP proxy for Jupyter Notebooks Some original inspiration from https://github.com/senko/tornado-proxy """ import inspect import socket import os from urllib.parse import urlunparse, urlparse, quote import aiohttp from asyncio import Lock from copy import copy from tornado import gen, web, httpclie...
GHSA-w3vc-fx9p-wp4v
setup.py
@@ -93,6 +93,7 @@ # acceptance tests additionally require firefox and geckodriver "test": [ "pytest", + "pytest-asyncio", "pytest-cov", "pytest-html" ],
""" jupyter-server-proxy setup """ import json from glob import glob from pathlib import Path import setuptools from jupyter_packaging import ( combine_commands, create_cmdclass, ensure_targets, install_npm, skip_if_exists, ) HERE = Path(__file__).parent.resolve() # The name of the project name =...
GHSA-w3vc-fx9p-wp4v
tests/test_proxies.py
@@ -6,6 +6,7 @@ from http.client import HTTPConnection from urllib.parse import quote import pytest +from tornado.httpclient import HTTPClientError from tornado.websocket import websocket_connect PORT = os.getenv('TEST_PORT', 8888) @@ -246,28 +247,19 @@ def test_server_content_encoding_header(): assert ...
import asyncio import gzip from io import BytesIO import json import os from http.client import HTTPConnection from urllib.parse import quote import pytest from tornado.websocket import websocket_connect PORT = os.getenv('TEST_PORT', 8888) TOKEN = os.getenv('JUPYTER_TOKEN', 'secret') def request_get(port, path, toke...
GHSA-w3vc-fx9p-wp4v
modoboa/admin/views/domain.py
@@ -16,6 +16,7 @@ from django.utils.translation import ugettext as _, ungettext from django.views import generic from django.views.decorators.csrf import ensure_csrf_cookie +from django.views.decorators.http import require_http_methods from modoboa.core import signals as core_signals from modoboa.lib.exceptions ...
"""Domain related views.""" from functools import reduce from reversion import revisions as reversion from django.contrib.auth import mixins as auth_mixins from django.contrib.auth.decorators import ( login_required, permission_required, user_passes_test ) from django.db.models import Q, Sum from django.http imp...
PYSEC-2023-282
src/lxml/tests/test_etree.py
@@ -1460,6 +1460,26 @@ def test_iterwalk_getiterator(self): [1,2,1,4], counts) + def test_walk_after_parse_failure(self): + # This used to be an issue because libxml2 can leak empty namespaces + # between failed parser runs. iterwalk() failed to handle such a tree. + ...
# -*- coding: utf-8 -*- """ Tests specific to the extended etree API Tests that apply to the general ElementTree API should go into test_elementtree """ from __future__ import absolute_import from collections import OrderedDict import os.path import unittest import copy import sys import re import gc import operato...
PYSEC-2022-230
svglib/svglib.py
@@ -1403,7 +1403,7 @@ def applyStyleOnShape(self, shape, node, only_explicit=False): shape.fillColor.alpha = shape.fillOpacity -def svg2rlg(path, **kwargs): +def svg2rlg(path, resolve_entities=False, **kwargs): "Convert an SVG file to an RLG Drawing object." # unzip .svgz file into .svg @@ ...
#!/usr/bin/env python """A library for reading and converting SVG. This is a converter from SVG to RLG (ReportLab Graphics) drawings. It converts mainly basic shapes, paths and simple text. The intended usage is either as module within other projects: from svglib.svglib import svg2rlg drawing = svg2rlg("foo.s...
GHSA-3vcg-8p79-jpcv
mistral/event_engine/default_event_engine.py
@@ -23,7 +23,6 @@ from oslo_service import threadgroup from oslo_utils import fnmatch import six -import yaml from mistral import context as auth_ctx from mistral.db.v2 import api as db_api @@ -33,6 +32,7 @@ from mistral import messaging as mistral_messaging from mistral.rpc import clients as rpc from mistral...
# Copyright 2016 Catalyst IT Ltd # Copyright 2017 - Brocade Communications Systems, Inc. # # 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 # # http://www.apache.org/licenses/LI...
GHSA-443j-6p7g-6v4w
mistral/lang/parser.py
@@ -15,7 +15,6 @@ import cachetools import threading -import yaml from yaml import error import six @@ -27,6 +26,7 @@ from mistral.lang.v2 import tasks as tasks_v2 from mistral.lang.v2 import workbook as wb_v2 from mistral.lang.v2 import workflows as wf_v2 +from mistral.utils import safe_yaml V2_0 = '2.0'...
# Copyright 2013 - Mirantis, Inc. # Copyright 2015 - StackStorm, Inc. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
GHSA-443j-6p7g-6v4w
mistral/services/workflows.py
@@ -12,12 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import yaml from mistral.db.v2 import api as db_api from mistral import exceptions as exc from mistral.lang import parser as spec_parser from mistral import services +from mistral....
# Copyright 2013 - Mirantis, Inc. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
GHSA-443j-6p7g-6v4w
mistral/tests/unit/lang/v2/base.py
@@ -14,11 +14,11 @@ import copy -import yaml from mistral import exceptions as exc from mistral.lang import parser as spec_parser from mistral.tests.unit import base +from mistral.utils import safe_yaml from mistral_lib import utils @@ -75,9 +75,10 @@ def _parse_dsl_spec(self, dsl_file=None, add_tasks=Fa...
# Copyright 2015 - StackStorm, Inc. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
GHSA-443j-6p7g-6v4w
django/contrib/sessions/backends/file.py
@@ -26,6 +26,8 @@ def __init__(self, session_key=None): self.file_prefix = settings.SESSION_COOKIE_NAME super(SessionStore, self).__init__(session_key) + VALID_KEY_CHARS = set("abcdef0123456789") + def _key_to_file(self, session_key=None): """ Get the file associated with t...
import errno import os import tempfile from django.conf import settings from django.contrib.sessions.backends.base import SessionBase, CreateError from django.core.exceptions import SuspiciousOperation, ImproperlyConfigured class SessionStore(SessionBase): """ Implements a file based session store. """ ...
GHSA-7g9h-c88w-r7h2
django/contrib/sessions/tests.py
@@ -129,6 +129,17 @@ >>> file_session = FileSession(file_session.session_key) >>> file_session.save() +# Ensure we don't allow directory traversal +>>> FileSession("a/b/c").load() +Traceback (innermost last): + ... +SuspiciousOperation: Invalid characters in session key + +>>> FileSession("a\\b\\c").load() +Trac...
r""" >>> from django.conf import settings >>> from django.contrib.sessions.backends.db import SessionStore as DatabaseSession >>> from django.contrib.sessions.backends.cache import SessionStore as CacheSession >>> from django.contrib.sessions.backends.cached_db import SessionStore as CacheDBSession >>> from django.con...
GHSA-7g9h-c88w-r7h2
tensorflow/python/kernel_tests/sparse_serialization_ops_test.py
@@ -16,10 +16,12 @@ import numpy as np +from tensorflow.python.eager import def_function from tensorflow.python.framework import dtypes from tensorflow.python.framework import sparse_tensor as sparse_tensor_lib from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops +from ...
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
GHSA-x3v8-c8qx-3j3r
django/utils/http.py
@@ -16,9 +16,20 @@ from django.utils.functional import keep_lazy_text from django.utils.six.moves.urllib.parse import ( quote, quote_plus, unquote, unquote_plus, urlencode as original_urlencode, - urlparse, ) +if six.PY2: + from urlparse import ( + ParseResult, SplitResult, _splitnetloc, _splitpa...
from __future__ import unicode_literals import base64 import calendar import datetime import re import sys import unicodedata from binascii import Error as BinasciiError from email.utils import formatdate from django.core.exceptions import TooManyFieldsSent from django.utils import six from django.utils.datastructure...
GHSA-37hp-765x-j95x
tests/utils_tests/test_http.py
@@ -104,6 +104,8 @@ def test_is_safe_url(self): r'http://testserver\me:pass@example.com', r'http://testserver\@example.com', r'http:\\testserver\confirm\me@example.com', + 'http:999999999', + 'ftp:9999999999', '\n', ) for bad_ur...
# -*- encoding: utf-8 -*- from __future__ import unicode_literals import sys import unittest from datetime import datetime from django.utils import http, six from django.utils.datastructures import MultiValueDict class TestUtilsHttp(unittest.TestCase): def test_urlencode(self): # 2-tuples (the norm) ...
GHSA-37hp-765x-j95x
python/paddle/tensor/manipulation.py
@@ -543,6 +543,8 @@ def unstack(x, axis=0, num=None): raise ValueError( '`axis` must be in the range [-{0}, {0})'.format(x.ndim) ) + if num is not None and (num < 0 or num > x.shape[axis]): + raise ValueError(f'`num` must be in the range [0, {x.shape[axis]})') if in_dynamic...
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
GHSA-2wcj-qr76-9768
Tests/test_imagefont.py
@@ -1038,6 +1038,25 @@ def test_render_mono_size(): assert_image_equal_tofile(im, "Tests/images/text_mono.gif") +def test_too_many_characters(font): + with pytest.raises(ValueError): + font.getlength("A" * 1000001) + with pytest.raises(ValueError): + font.getbbox("A" * 1000001) + with py...
import copy import os import re import shutil import sys from io import BytesIO import pytest from packaging.version import parse as parse_version from PIL import Image, ImageDraw, ImageFont, features from .helper import ( assert_image_equal, assert_image_equal_tofile, assert_image_similar_tofile, is...
GHSA-8ghj-p4vj-mr35
src/PIL/ImageFont.py
@@ -41,6 +41,9 @@ class Layout(IntEnum): RAQM = 1 +MAX_STRING_LENGTH = 1000000 + + try: from . import _imagingft as core except ImportError as ex: @@ -49,6 +52,12 @@ class Layout(IntEnum): core = DeferredError(ex) +def _string_length_check(text): + if MAX_STRING_LENGTH is not None and len(te...
# # The Python Imaging Library. # $Id$ # # PIL raster font management # # History: # 1996-08-07 fl created (experimental) # 1997-08-25 fl minor adjustments to handle fonts from pilfont 0.3 # 1999-02-06 fl rewrote most font management stuff in C # 1999-03-17 fl take pth files into account in load_path (from Rich...
GHSA-8ghj-p4vj-mr35
libs/community/langchain_community/document_loaders/sitemap.py
@@ -1,6 +1,16 @@ import itertools import re -from typing import Any, Callable, Generator, Iterable, Iterator, List, Optional, Tuple +from typing import ( + Any, + Callable, + Dict, + Generator, + Iterable, + Iterator, + List, + Optional, + Tuple, +) from urllib.parse import urlparse fro...
import itertools import re from typing import Any, Callable, Generator, Iterable, Iterator, List, Optional, Tuple from urllib.parse import urlparse from langchain_core.documents import Document from langchain_community.document_loaders.web_base import WebBaseLoader def _default_parsing_function(content: Any) -> str...
PYSEC-2024-118
mlflow/store/artifact/ftp_artifact_repo.py
@@ -106,10 +106,10 @@ def list_artifacts(self, path=None): if not self._is_dir(ftp, list_dir): return [] artifact_files = ftp.nlst(list_dir) - artifact_files = list(filter(lambda x: x != "." and x != "..", artifact_files)) # Make sure artifact_files is ...
import ftplib import os import posixpath import urllib.parse from contextlib import contextmanager from ftplib import FTP from urllib.parse import unquote from mlflow.entities.file_info import FileInfo from mlflow.exceptions import MlflowException from mlflow.store.artifact.artifact_repo import ArtifactRepository from...
GHSA-hh8p-p8mp-gqhm
tests/store/artifact/test_ftp_artifact_repo.py
@@ -67,6 +67,18 @@ def test_list_artifacts(ftp_mock): assert artifacts[1].file_size is None +def test_list_artifacts_malicious_path(ftp_mock): + artifact_root_path = "/experiment_id/run_id/" + repo = FTPArtifactRepository("ftp://test_ftp" + artifact_root_path) + repo.get_ftp_client = MagicMock() + ...
# pylint: disable=redefined-outer-name import ftplib import posixpath from ftplib import FTP from unittest.mock import MagicMock import pytest from mlflow.store.artifact.artifact_repository_registry import get_artifact_repository from mlflow.store.artifact.ftp_artifact_repo import FTPArtifactRepository @pytest.fixt...
GHSA-hh8p-p8mp-gqhm
tensorflow/python/ops/bincount_ops_test.py
@@ -25,7 +25,9 @@ from tensorflow.python.framework import errors from tensorflow.python.framework import ops from tensorflow.python.framework import sparse_tensor +from tensorflow.python.framework import test_util from tensorflow.python.ops import bincount_ops +from tensorflow.python.ops import gen_count_ops from ...
# Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
PYSEC-2020-315
tests/parser/functions/test_interfaces.py
@@ -6,7 +6,7 @@ from vyper.builtin_interfaces import ERC20, ERC721 from vyper.cli.utils import extract_file_interface_imports from vyper.compiler import compile_code, compile_codes -from vyper.exceptions import InterfaceViolation, StructureException +from vyper.exceptions import ArgumentException, InterfaceViolation...
from decimal import Decimal import pytest from vyper.ast.signatures.interface import extract_sigs from vyper.builtin_interfaces import ERC20, ERC721 from vyper.cli.utils import extract_file_interface_imports from vyper.compiler import compile_code, compile_codes from vyper.exceptions import InterfaceViolation, Struct...
PYSEC-2022-198
vyper/codegen/core.py
@@ -123,10 +123,7 @@ def _dynarray_make_setter(dst, src): # for ABI-encoded dynamic data, we must loop to unpack, since # the layout does not match our memory layout - should_loop = ( - src.encoding in (Encoding.ABI, Encoding.JSON_ABI) - and src.typ.subtype.abi_type.is_d...
from vyper import ast as vy_ast from vyper.address_space import CALLDATA, DATA, IMMUTABLES, MEMORY, STORAGE from vyper.codegen.ir_node import Encoding, IRnode from vyper.codegen.types import ( DYNAMIC_ARRAY_OVERHEAD, ArrayLike, BaseType, ByteArrayLike, DArrayType, MappingType, SArrayType, ...
PYSEC-2022-198
vyper/codegen/external_call.py
@@ -6,10 +6,12 @@ check_assign, check_external_call, dummy_node_for_type, - get_element_ptr, + make_setter, + needs_clamp, ) from vyper.codegen.ir_node import Encoding, IRnode from vyper.codegen.types import InterfaceType, TupleType, get_type_for_exact_size +from vyper.codegen.types.convert i...
import vyper.utils as util from vyper.address_space import MEMORY from vyper.codegen.abi_encoder import abi_encode from vyper.codegen.core import ( calculate_type_for_external_return, check_assign, check_external_call, dummy_node_for_type, get_element_ptr, ) from vyper.codegen.ir_node import Encodin...
PYSEC-2022-198
vyper/codegen/function_definitions/external_function.py
@@ -3,36 +3,14 @@ import vyper.utils as util from vyper.address_space import CALLDATA, DATA, MEMORY from vyper.ast.signatures.function_signature import FunctionSignature, VariableRecord +from vyper.codegen.abi_encoder import abi_encoding_matches_vyper from vyper.codegen.context import Context -from vyper.codegen.co...
from typing import Any, List import vyper.utils as util from vyper.address_space import CALLDATA, DATA, MEMORY from vyper.ast.signatures.function_signature import FunctionSignature, VariableRecord from vyper.codegen.context import Context from vyper.codegen.core import get_element_ptr, getpos, make_setter from vyper.c...
PYSEC-2022-198
vyper/codegen/ir_node.py
@@ -47,8 +47,6 @@ class Encoding(Enum): VYPER = auto() # abi encoded, default for args/return values from external funcs ABI = auto() - # abi encoded, same as ABI but no clamps for bytestrings - JSON_ABI = auto() # future: packed
import re from enum import Enum, auto from typing import Any, List, Optional, Tuple, Union from vyper.address_space import AddrSpace from vyper.codegen.types import BaseType, NodeType, ceil32 from vyper.compiler.settings import VYPER_COLOR_OUTPUT from vyper.evm.opcodes import get_ir_opcodes from vyper.exceptions impor...
PYSEC-2022-198
vyper/codegen/types/convert.py
@@ -32,7 +32,7 @@ def new_type_to_old_type(typ: new.BasePrimitive) -> old.NodeType: if isinstance(typ, new.DynamicArrayDefinition): return old.DArrayType(new_type_to_old_type(typ.value_type), typ.length) if isinstance(typ, new.TupleDefinition): - return old.TupleType(typ.value_type) + r...
# transition module to convert from new types to old types import vyper.codegen.types as old import vyper.semantics.types as new from vyper.exceptions import InvalidType def new_type_to_old_type(typ: new.BasePrimitive) -> old.NodeType: if isinstance(typ, new.BoolDefinition): return old.BaseType("bool") ...
PYSEC-2022-198
tensorflow/python/ops/image_ops_test.py
@@ -4175,6 +4175,25 @@ def testPad(self): self._assertReturns(x, x_shape, y, y_shape) +class ResizeNearestNeighborGrad(test_util.TensorFlowTestCase): + + def testSizeTooLarge(self): + align_corners = True + half_pixel_centers = False + grads = constant_op.constant(1, shape=[1, 8, 16, 3], dtype=dtypes...
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
GHSA-368v-7v32-52fx
tests/test_rencode.py
@@ -401,6 +401,11 @@ def test_version_exposed(self): "version number does not match", ) + def test_invalid_typecode(self): + s = b";\x2f\x7f" + with self.assertRaises(ValueError): + rencode.loads(s) + if __name__ == "__main__": unittest.main()
# -*- coding: utf-8 -*- # # test_rencode.py # # Copyright (C) 2010 Andrew Resch <andrewresch@gmail.com> # # rencode is free software. # # You may redistribute it and/or modify it under the terms of the # GNU General Public License, as published by the Free Software # Foundation; either version 3 of the License, or (at ...
PYSEC-2021-345
tensorflow/python/ops/bincount_ops_test.py
@@ -831,6 +831,25 @@ def test_ragged_input_different_shape_fails(self): self.evaluate(bincount_ops.sparse_bincount(x, weights=weights, axis=-1)) +class RawOpsHeapOobTest(test.TestCase, parameterized.TestCase): + + @test_util.run_v1_only("Test security error") + def testSparseCountSparseOutputBadIndicesShap...
# Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
PYSEC-2021-619
alerta/auth/basic_ldap.py
@@ -27,6 +27,9 @@ def login(): except KeyError: raise ApiError("must supply 'username' and 'password'", 401) + if not password: + raise ApiError('password not allowed to be empty', 401) + try: if '\\' in login: domain, username = login.split('\\')
import sys import ldap # pylint: disable=import-error from flask import current_app, jsonify, request from flask_cors import cross_origin from alerta.auth.utils import create_token, get_customers from alerta.exceptions import ApiError from alerta.models.permission import Permission from alerta.models.user import Use...
PYSEC-2020-159
alerta/models/note.py
@@ -55,7 +55,7 @@ def serialize(self) -> Dict[str, Any]: 'updateTime': self.update_time, '_links': dict(), 'customer': self.customer - } + } # type: Dict[str, Any] if self.alert: note['_links'] = { 'alert': absolute_url('/alert...
from datetime import datetime from typing import Any, Dict, List, Optional, Tuple, Union from uuid import uuid4 from flask import g from alerta.app import db from alerta.database.base import Query from alerta.models.enums import ChangeType, NoteType from alerta.models.history import History from alerta.utils.format i...
PYSEC-2020-159
tensorflow/python/distribute/sharded_variable_test.py
@@ -175,8 +175,9 @@ def func(): 'scatter_update') def test_scatter_ops_even_partition(self, op): v = variables_lib.Variable(array_ops.zeros((30, 1))) + # Make sure values does not contain 0 due to testing `scatter_div`! sparse_delta = ops.IndexedSlices( - values=const...
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
PYSEC-2021-264
tensorflow/python/kernel_tests/sparse_serialization_ops_test.py
@@ -16,10 +16,12 @@ import numpy as np +from tensorflow.python.eager import def_function from tensorflow.python.framework import dtypes from tensorflow.python.framework import sparse_tensor as sparse_tensor_lib from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops +from ...
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
PYSEC-2021-822
synapse/config/tls.py
@@ -17,7 +17,7 @@ import warnings from datetime import datetime from hashlib import sha256 -from typing import List, Optional +from typing import List, Optional, Pattern from unpaddedbase64 import encode_base64 @@ -124,7 +124,7 @@ def read_config(self, config: dict, config_dir_path: str, **kwargs): ...
# Copyright 2014-2016 OpenMarket 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
PYSEC-2021-135
synapse/push/push_rule_evaluator.py
@@ -19,6 +19,7 @@ from synapse.events import EventBase from synapse.types import UserID +from synapse.util import glob_to_regex, re_word_boundary from synapse.util.caches.lrucache import LruCache logger = logging.getLogger(__name__) @@ -183,7 +184,7 @@ def _contains_display_name(self, display_name: str) -> bool...
# Copyright 2015, 2016 OpenMarket Ltd # Copyright 2017 New Vector 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
PYSEC-2021-135
synapse/util/__init__.py
@@ -15,6 +15,7 @@ import json import logging import re +from typing import Pattern import attr from frozendict import frozendict @@ -26,6 +27,9 @@ logger = logging.getLogger(__name__) +_WILDCARD_RUN = re.compile(r"([\?\*]+)") + + def _reject_invalid_json(val): """Do not allow Infinity, -Infinity, or N...
# Copyright 2014-2016 OpenMarket 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
PYSEC-2021-135
tests/federation/test_federation_server.py
@@ -74,6 +74,25 @@ def test_block_ip_literals(self): self.assertFalse(server_matches_acl_event("[1:2::]", e)) self.assertTrue(server_matches_acl_event("1:2:3:4", e)) + def test_wildcard_matching(self): + e = _create_acl_event({"allow": ["good*.com"]}) + self.assertTrue( + ...
# Copyright 2018 New Vector Ltd # Copyright 2019 Matrix.org Federation 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
PYSEC-2021-135
tests/push/test_push_rule_evaluator.py
@@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Any, Dict + from synapse.api.room_versions import RoomVersions from synapse.events import FrozenEvent from synapse.push import push_rule_evaluator @@ -66,6 +68,170 @@ def t...
# 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. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
PYSEC-2021-135
tests/tests.py
@@ -88,8 +88,8 @@ def test_list(self): user_agent='Firefox') response = self.client.get(reverse('user_sessions:session_list')) self.assertContains(response, 'Active Sessions') - self.assertContains(response, 'End Session', 3) self.assertContains(re...
import sys from datetime import datetime, timedelta from unittest import skipUnless import django from django.conf import settings from django.contrib import auth from django.contrib.auth.models import User from django.contrib.sessions.backends.base import CreateError from django.core.management import call_command fr...
PYSEC-2020-230
rdiffweb/controller/page_mfa.py
@@ -105,10 +105,10 @@ def send_code(self): "Multi-factor authentication is enabled for your account, but your account does not have a valid email address to send the verification code to. Check your account settings with your administrator." ) ) - else: - ...
# -*- coding: utf-8 -*- # rdiffweb, A web interface to rdiff-backup repositories # Copyright (C) 2012-2021 rdiffweb contributors # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
PYSEC-2022-42978
rdiffweb/controller/page_pref_mfa.py
@@ -126,7 +126,7 @@ def send_code(self): return code = cherrypy.tools.auth_mfa.generate_code() body = self.app.templates.compile_template( - "email_mfa.html", **{"header_name": self.app.cfg.header_name, 'user': userobj, 'code': code} + "email_verification_code.html",...
# -*- coding: utf-8 -*- # rdiffweb, A web interface to rdiff-backup repositories # Copyright (C) 2012-2021 rdiffweb contributors # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
PYSEC-2022-42978
rdiffweb/controller/tests/test_page_prefs_mfa.py
@@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -from unittest.mock import MagicMock +from unittest.mock import ANY, MagicMock import cherrypy from parameterized import parameterized @@ -34,47 +34,49 @@...
# -*- coding: utf-8 -*- # rdiffweb, A web interface to rdiff-backup repositories # Copyright (C) 2012-2021 rdiffweb contributors # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
PYSEC-2022-42978
rdiffweb/core/config.py
@@ -159,7 +159,7 @@ def get_parser(): '--emailsendchangednotification', help='True to send notification when sensitive information get change in user profile.', action='store_true', - default=False, + default=True, ) parser.add_argument(
# -*- coding: utf-8 -*- # rdiffweb, A web interface to rdiff-backup repositories # Copyright (C) 2012-2021 rdiffweb contributors # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
PYSEC-2022-42978
rdiffweb/core/model/_user.py
@@ -24,7 +24,7 @@ from sqlalchemy import Column, Integer, SmallInteger, String, and_, event, inspect, or_ from sqlalchemy.exc import IntegrityError from sqlalchemy.ext.hybrid import hybrid_property -from sqlalchemy.orm import deferred, relationship +from sqlalchemy.orm import deferred, relationship, validates from ...
# -*- coding: utf-8 -*- # rdiffweb, A web interface to rdiff-backup repositories # Copyright (C) 2012-2021 rdiffweb contributors # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
PYSEC-2022-42978
rdiffweb/core/model/tests/test_user.py
@@ -36,11 +36,6 @@ class UserObjectTest(rdiffweb.test.WebCase): - - default_config = { - 'email-send-changed-notification': True, - } - def _read_ssh_key(self): """Readthe pub key from test packages""" filename = pkg_resources.resource_filename('rdiffweb.core.tests', 'test_publi...
# -*- coding: utf-8 -*- # rdiffweb, A web interface to rdiff-backup repositories # Copyright (C) 2012-2021 rdiffweb contributors # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
PYSEC-2022-42978
rdiffweb/core/notification.py
@@ -78,19 +78,31 @@ def user_attr_changed(self, userobj, attrs={}): return # Leave if the mail was not changed. - if 'email' not in attrs: - return - - old_email = attrs['email'][0] - if not old_email: - logger.info("can't sent mail to user [%s] without...
# -*- coding: utf-8 -*- # rdiffweb, A web interface to rdiff-backup repositories # Copyright (C) 2012-2021 rdiffweb contributors # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
PYSEC-2022-42978
rdiffweb/core/tests/test_notification.py
@@ -118,10 +118,13 @@ def test_email_changed(self): # Given a user with an email address user = UserObject.get_user(self.USERNAME) user.email = 'original_email@test.com' + user.add() self.listener.queue_email.reset_mock() # When updating the user's email + us...
# -*- coding: utf-8 -*- # rdiffweb, A web interface to rdiff-backup repositories # Copyright (C) 2012-2021 rdiffweb contributors # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
PYSEC-2022-42978
tensorflow/python/kernel_tests/array_ops/stack_op_test.py
@@ -16,12 +16,16 @@ import numpy as np +from tensorflow.python import tf2 from tensorflow.python.eager import context +from tensorflow.python.eager import def_function from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes +from tensorflow.python.framework import erro...
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
PYSEC-2021-816
beaker/crypto/pycrypto.py
@@ -15,17 +15,18 @@ def aesEncrypt(data, key): except ImportError: from Crypto.Cipher import AES + from Crypto.Util import Counter def aesEncrypt(data, key): - cipher = AES.new(key) + cipher = AES.new(key, AES.MODE_CTR, + counter=Counter.new(128, initial_value=0))...
"""Encryption module that uses pycryptopp or pycrypto""" try: # Pycryptopp is preferred over Crypto because Crypto has had # various periods of not being maintained, and pycryptopp uses # the Crypto++ library which is generally considered the 'gold standard' # of crypto implementations from pycrypto...
PYSEC-2012-1
bottle.py
@@ -16,7 +16,7 @@ from __future__ import with_statement __author__ = 'Marcel Hellkamp' -__version__ = '0.12.19' +__version__ = '0.12.20' __license__ = 'MIT' # The gevent server adapter needs to patch some modules before they are imported
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Bottle is a fast and simple micro-framework for small web applications. It offers request dispatching (Routes) with url parameter support, templates, a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and template engines - all in a single file an...
PYSEC-2022-227
django/contrib/gis/db/models/aggregates.py
@@ -1,7 +1,7 @@ from django.contrib.gis.db.models.fields import ( ExtentField, GeometryCollectionField, GeometryField, LineStringField, ) -from django.db.models import Aggregate +from django.db.models import Aggregate, Value from django.utils.functional import cached_property __all__ = ['Collect', 'Extent', ...
from django.contrib.gis.db.models.fields import ( ExtentField, GeometryCollectionField, GeometryField, LineStringField, ) from django.db.models import Aggregate from django.utils.functional import cached_property __all__ = ['Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union'] class GeoAggregate(Aggregate): ...
GHSA-3gh2-xw74-jmcw
django/contrib/gis/db/models/functions.py
@@ -111,12 +111,14 @@ class OracleToleranceMixin: tolerance = 0.05 def as_oracle(self, compiler, connection, **extra_context): - tol = self.extra.get('tolerance', self.tolerance) - return self.as_sql( - compiler, connection, - template="%%(function)s(%%(expressions)s, %s)...
from decimal import Decimal from django.contrib.gis.db.models.fields import BaseSpatialField, GeometryField from django.contrib.gis.db.models.sql import AreaField, DistanceField from django.contrib.gis.geos import GEOSGeometry from django.core.exceptions import FieldError from django.db import NotSupportedError from d...
GHSA-3gh2-xw74-jmcw
tests/gis_tests/distapp/tests.py
@@ -434,6 +434,37 @@ def test_distance_function_d_lookup(self): ).filter(d=D(m=1)) self.assertTrue(qs.exists()) + @unittest.skipUnless( + connection.vendor == 'oracle', + 'Oracle supports tolerance paremeter.', + ) + def test_distance_function_tolerance_escaping(self): + ...
import unittest from django.contrib.gis.db.models.functions import ( Area, Distance, Length, Perimeter, Transform, Union, ) from django.contrib.gis.geos import GEOSGeometry, LineString, Point from django.contrib.gis.measure import D # alias for Distance from django.db import NotSupportedError, connection from dja...
GHSA-3gh2-xw74-jmcw
tests/gis_tests/geoapp/tests.py
@@ -9,7 +9,7 @@ MultiPoint, MultiPolygon, Point, Polygon, fromstr, ) from django.core.management import call_command -from django.db import NotSupportedError, connection +from django.db import DatabaseError, NotSupportedError, connection from django.db.models import F, OuterRef, Subquery from django.test impor...
import tempfile import unittest from io import StringIO from django.contrib.gis import gdal from django.contrib.gis.db.models import Extent, MakeLine, Union, functions from django.contrib.gis.geos import ( GeometryCollection, GEOSGeometry, LinearRing, LineString, MultiLineString, MultiPoint, MultiPolygon, Poin...
GHSA-3gh2-xw74-jmcw
cms/admin/pageadmin.py
@@ -928,6 +928,7 @@ def change_template(self, request, object_id): helpers.make_revision_with_plugins(page, request.user, message) return HttpResponse(force_unicode(_("The template was successfully changed"))) + @require_POST @wrap_transaction def move_page(self, request, page_id, e...
# -*- coding: utf-8 -*- import copy from functools import wraps import json import sys import django from django.contrib.admin.helpers import AdminForm from django.conf import settings from django.contrib import admin, messages from django.contrib.admin.models import LogEntry, CHANGE from django.contrib.admin.options ...
PYSEC-2017-11
cms/tests/admin.py
@@ -704,14 +704,14 @@ def test_change_publish_unpublish(self): with self.login_user_context(permless): request = self.get_request() response = self.admin_class.publish_page(request, page.pk, "en") - self.assertEqual(response.status_code, 403) + self.assertEqual(r...
# -*- coding: utf-8 -*- from __future__ import with_statement import json import datetime from cms.utils.urlutils import admin_reverse from djangocms_text_ckeditor.cms_plugins import TextPlugin from djangocms_text_ckeditor.models import Text from django.contrib import admin from django.contrib.admin.models import LogE...
PYSEC-2017-11
cms/tests/publisher.py
@@ -342,7 +342,7 @@ def test_publish_home(self): self.assertEqual(Page.objects.all().count(), 1) superuser = self.get_superuser() with self.login_user_context(superuser): - response = self.client.get(admin_reverse("cms_page_publish_page", args=[page.pk, 'en'])) + respons...
# -*- coding: utf-8 -*- from __future__ import with_statement from django.contrib.sites.models import Site from cms.utils.urlutils import admin_reverse from djangocms_text_ckeditor.models import Text from django.core.cache import cache from django.core.management.base import CommandError from django.core.management im...
PYSEC-2017-11
cms/tests/reversion_tests.py
@@ -246,7 +246,7 @@ def test_publish_limits(self): self.assertEqual(Revision.objects.all().count(), 5) for x in range(10): publish_url = URL_CMS_PAGE + "%s/en/publish/" % page_pk - response = self.client.get(publish_url) + resp...
# -*- coding: utf-8 -*- from __future__ import with_statement import shutil from os.path import join from cms.utils.conf import get_cms_setting from cms.utils.urlutils import admin_reverse from djangocms_text_ckeditor.models import Text from django.conf import settings from django.contrib.contenttypes.models import Co...
PYSEC-2017-11
django/core/files/storage.py
@@ -1,12 +1,12 @@ import os import errno -import itertools from datetime import datetime from django.conf import settings from django.core.exceptions import SuspiciousFileOperation from django.core.files import locks, File from django.core.files.move import file_move_safe +from django.utils.crypto import get_r...
import os import errno import itertools from datetime import datetime from django.conf import settings from django.core.exceptions import SuspiciousFileOperation from django.core.files import locks, File from django.core.files.move import file_move_safe from django.utils.encoding import force_text, filepath_to_uri fro...
GHSA-296w-6qhq-gf92
tests/file_storage/tests.py
@@ -35,6 +35,9 @@ Image = None +FILE_SUFFIX_REGEX = '[A-Za-z0-9]{7}' + + class GetStorageClassTests(SimpleTestCase): def test_get_filesystem_storage(self): @@ -430,10 +433,9 @@ def test_race_condition(self): self.thread.start() name = self.save_file('conflict') self.thread.jo...
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import errno import os import shutil import sys import tempfile import time import zlib from datetime import datetime, timedelta from io import BytesIO try: import threading except ImportError: import dummy_threading as threading...
GHSA-296w-6qhq-gf92
tests/files/tests.py
@@ -13,12 +13,15 @@ from django.core.files.uploadedfile import SimpleUploadedFile from django.core.files.temp import NamedTemporaryFile from django.test import TestCase -from django.utils import unittest +from django.utils import six, unittest from django.utils.six import StringIO from .models import Storage, te...
from __future__ import absolute_import from io import BytesIO import os import gzip import shutil import tempfile from django.core.cache import cache from django.core.files import File from django.core.files.move import file_move_safe from django.core.files.base import ContentFile from django.core.files.uploadedfile ...
GHSA-296w-6qhq-gf92
tensorflow/python/kernel_tests/collective_ops_test.py
@@ -1182,6 +1182,69 @@ def f(): self.assertAllEqual(self.evaluate(f()), [[3.], [3.]]) +@combinations.generate( + combinations.times( + combinations.combine(collective_op=[ + combinations.NamedObject('all_reduce_v2', + CollectiveOpsV2.all_reduce), + ...
# Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
PYSEC-2021-629
tensorflow/python/kernel_tests/math_ops/bincount_op_test.py
@@ -366,7 +366,7 @@ def test_sparse_bincount_all_count(self, dtype): num_rows = 128 size = 1000 n_elems = 4096 - inp_indices = np.random.randint(0, num_rows, (n_elems,)) + inp_indices = np.random.randint(0, num_rows, (n_elems, 1)) inp_vals = np.random.randint(0, size, (n_elems,), dtype=dtype) ...
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
GHSA-397c-5g2j-qxpv
synapse/rest/media/v1/_base.py
@@ -29,7 +29,7 @@ from synapse.http.server import finish_request, respond_with_json from synapse.http.site import SynapseRequest from synapse.logging.context import make_deferred_yieldable -from synapse.util.stringutils import is_ascii +from synapse.util.stringutils import is_ascii, parse_and_validate_server_name ...
# Copyright 2014-2016 OpenMarket Ltd # Copyright 2019-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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
GHSA-3hfw-x7gx-437c
synapse/rest/media/v1/filepath.py
@@ -16,7 +16,8 @@ import functools import os import re -from typing import Any, Callable, List, TypeVar, cast +import string +from typing import Any, Callable, List, TypeVar, Union, cast NEW_FORMAT_ID_RE = re.compile(r"^\d\d\d\d-\d\d-\d\d") @@ -37,6 +38,85 @@ def _wrapped(self: "MediaFilePaths", *args: Any, **k...
# Copyright 2014-2016 OpenMarket Ltd # Copyright 2020-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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
GHSA-3hfw-x7gx-437c
synapse/util/stringutils.py
@@ -19,6 +19,8 @@ from collections.abc import Iterable from typing import Optional, Tuple +from netaddr import valid_ipv6 + from synapse.api.errors import Codes, SynapseError _string_with_symbols = string.digits + string.ascii_letters + ".,;:^&*-_+=#~@" @@ -97,7 +99,10 @@ def parse_server_name(server_name: str)...
# Copyright 2014-2016 OpenMarket Ltd # 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. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
GHSA-3hfw-x7gx-437c
tests/http/test_endpoint.py
@@ -36,8 +36,11 @@ def test_validate_bad_server_names(self): "localhost:http", # non-numeric port "1234]", # smells like ipv6 literal but isn't "[1234", + "[1.2.3.4]", "underscore_.com", "percent%65.com", + "newline.com\n", + ...
# Copyright 2018 New Vector 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
GHSA-3hfw-x7gx-437c
tests/rest/media/v1/test_filepath.py
@@ -11,6 +11,9 @@ # 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. +import inspect +from typing import Iterable + from synapse.rest.media.v1.filepath import MediaFilePaths from tests i...
# 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
GHSA-3hfw-x7gx-437c
pyshop/helpers/download.py
@@ -33,7 +33,12 @@ def __call__(self, value, system): if not os.path.exists(dir_): os.makedirs(dir_, 0750) - resp = requests.get(value['url']) + if value['url'].startswith('https://pypi.python.org'): + verify = os.path.join(os.path...
import os import os.path import mimetypes import requests from zope.interface import implements from pyramid.interfaces import ITemplateRenderer class ReleaseFileRenderer(object): implements(ITemplateRenderer) def __init__(self, repository_root): self.repository_root = repository_root def __cal...
PYSEC-2013-10
pyshop/views/repository.py
@@ -6,8 +6,12 @@ def get_release_file(root, request): session = DBSession() f = ReleaseFile.by_id(session, int(request.matchdict['file_id'])) + url = f.url + if url.startswith('http://pypi.python.org'): + url = 'https' + url[4:] + rv = {'id': f.id, - 'url': f.url, + 'url'...
# -*- coding: utf-8 -*- from pyshop.models import DBSession, ReleaseFile def get_release_file(root, request): session = DBSession() f = ReleaseFile.by_id(session, int(request.matchdict['file_id'])) rv = {'id': f.id, 'url': f.url, 'filename': f.filename, } f.downloads += ...
PYSEC-2013-10