text stringlengths 79 3.72M |
|---|
<vulnerable_code>from typing import Dict
from autogpt.agent.agent import Agent
def is_valid_int(value: str) -> bool:
return False
def get_command(response_json: Dict):
"""Parse the response and return the command name and arguments
Args:
response_json (json): The response from the AI
... |
<vulnerable_code>import functools
from typing import Any, Callable, Dict, Optional
from autogpt.config import Config
from autogpt.models.command import Command
# Unique identifier for auto-gpt commands
AUTO_GPT_COMMAND_IDENTIFIER = "auto_gpt_command"
def command(
name: str,
description: str,
arguments: ... |
<vulnerable_code> if self.api_budget > 0.0:
full_prompt += f"\nIt takes money to let you run. Your API budget is ${self.api_budget:.3f}"
self.prompt_generator = prompt_generator
full_prompt += f"\n\n{prompt_generator.generate_prompt_string()}"
return full_prompt<commit_title>[... |
<vulnerable_code> if self.openai_organization is not None:
openai.organization = self.openai_organization
self.elevenlabs_api_key = os.getenv("ELEVENLABS_API_KEY")
# ELEVENLABS_VOICE_1_ID is deprecated and included for backwards-compatibility
self.elevenlabs_voice_id = os.get... |
<vulnerable_code>
def llm_response_schema(
schema_name: str = LLM_DEFAULT_RESPONSE_FORMAT,
) -> dict[str, Any]:
filename = os.path.join(os.path.dirname(__file__), f"{schema_name}.json")
with open(filename, "r") as f:
return json.load(f)
def validate_json(
Returns:
bool: Whether the js... |
<vulnerable_code>
from dataclasses import dataclass, field
from math import ceil, floor
from typing import List, Literal, TypedDict
MessageRole = Literal["system", "user", "assistant"]
MessageType = Literal["ai_response", "action_result"]
class ChatModelResponse(LLMResponse):
"""Standard response struct for a resp... |
<vulnerable_code>import time
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from autogpt.agent.agent import Agent
current_tokens_used += count_message_tokens([user_input_msg], model)
current_tokens_used += 500 # Reserve space for new_summary_message
# Add Messages until the token limit is reach... |
<vulnerable_code>import functools
import time
from typing import List
from unittest.mock import patch
import openai
from openai.error import APIError, RateLimitError, Timeout
from openai.openai_object import OpenAIObject
from autogpt.llm.base import (
ChatModelInfo,
EmbeddingModelInfo,
input=input,
... |
<vulnerable_code>from __future__ import annotations
from typing import List, Literal, Optional
from colorama import Fore
from autogpt.logs import logger
from ..api_manager import ApiManager
from ..base import ChatSequence, Message
from ..providers import openai as iopenai
from .token_counter import *
M... |
<vulnerable_code> PROMPT_SUMMARY_FILE_NAME,
)
self.summary = create_chat_completion(prompt, config)
self.agent.log_cycle_handler.log_cycle(
self.agent.ai_name,<commit_title>[PATCH 1/7] Add OpenAI function call support (#4683)<commit_description>Co-authored-by: merwaneham... |
<vulnerable_code>from typing import Any, Callable, Dict, Optional
from autogpt.config import Config
class Command:
"""A class representing a command.
Attributes:
name (str): The name of the command.
description (str): A brief description of what the command does.
signature (str): The ... |
<vulnerable_code><commit_title>[PATCH 1/7] Add OpenAI function call support (#4683)<commit_description>Co-authored-by: merwanehamadi <merwanehamadi@gmail.com>
Co-authored-by: Reinier van der Leer <github@pwuts.nl><fixed_code>
import dataclasses
@dataclasses.dataclass
class CommandParameter:
name: str
type: st... |
<vulnerable_code> directory.
"""
def __init__(self):
self.commands = {}
<commit_title>[PATCH 1/7] Add OpenAI function call support (#4683)<commit_description>Co-authored-by: merwanehamadi <merwanehamadi@gmail.com>
Co-authored-by: Reinier van der Leer <github@pwuts.nl><fixed_code>
directory.
... |
<vulnerable_code>
logger.debug(f"Summarizing with {model}:\n{summarization_prompt.dump()}\n")
summary = create_chat_completion(
summarization_prompt, config, temperature=0, max_tokens=500
)
logger.debug(f"\n{'-'*16} SUMMARY {'-'*17}\n{summary}\n{'-'*42}\n")
return su... |
<vulnerable_code>""" A module for generating custom prompt strings."""
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional
from autogpt.json_utils.utilities import llm_response_schema
if TYPE_CHECKING:
else:
return "\n".join(f"{i+1}. {item}" for i, item in enumerate(items))
... |
<vulnerable_code> ],
),
config,
)
# Debug LLM Output
logger.debug(f"AI Config Generator Raw Output: {output}")<commit_title>[PATCH 1/7] Add OpenAI function call support (#4683)<commit_description>Co-authored-by: merwanehamadi <merwanehamadi@gmail.com>
Co-authored-by: Reinier van ... |
<vulnerable_code>import pytest
from autogpt.agent.agent_manager import AgentManager
from autogpt.llm.chat import create_chat_completion
@pytest.fixture
@pytest.fixture(autouse=True)
def mock_create_chat_completion(mocker):
mock_create_chat_completion = mocker.patch(
"autogpt.agent.agent_manager.create_... |
<vulnerable_code>
import pytest
from autogpt.models.command import Command
from autogpt.models.command_registry import CommandRegistry
SIGNATURE = "(arg1: int, arg2: str) -> str"
class TestCommand:
name="example",
description="Example command",
method=self.example_command_method,... |
<vulnerable_code>from autogpt.agent import Agent
from autogpt.config import AIConfig
from autogpt.config.config import Config
from autogpt.llm.base import ChatSequence, Message
from autogpt.llm.providers.openai import OPEN_AI_CHAT_MODELS
from autogpt.llm.utils import count_string_tokens
from autogpt.memory.message_hist... |
<vulnerable_code>from unittest import TestCase
from autogpt.prompts.generator import PromptGenerator
class TestPromptGenerator(TestCase):
"""
Test cases for the PromptGenerator class, which is responsible for generating
prompts for the AI with constraints, commands, resources, and performance evaluations... |
<vulnerable_code>"""The application entry point. Can be invoked by a CLI or any other front end application."""
import logging
import sys
from pathlib import Path
from colorama import Fore, Style
# TODO: have this directory live outside the repository (e.g. in a user's
# home directory) and have it come in... |
<vulnerable_code>
from pathlib import Path
from autogpt.logs import logger
)
return full_path<commit_title>[PATCH 1/7] Add OpenAI function call support (#4683)<commit_description>Co-authored-by: merwanehamadi <merwanehamadi@gmail.com>
Co-authored-by: Reinier van der Leer <github@pwuts.nl><fixed_... |
<vulnerable_code><commit_title>[PATCH 1/7] Add OpenAI function call support (#4683)<commit_description>Co-authored-by: merwanehamadi <merwanehamadi@gmail.com>
Co-authored-by: Reinier van der Leer <github@pwuts.nl><fixed_code>
|
<vulnerable_code>import os
import subprocess
import sys
def benchmark_entrepreneur_gpt_with_difficult_user():
# Test case to check if the write_file command can successfully write 'Hello World' to a file
# named 'hello_world.txt'.
# Read the current ai_settings.yaml file and store its content.
ai_set... |
<vulnerable_code><commit_title>[PATCH 1/7] Add OpenAI function call support (#4683)<commit_description>Co-authored-by: merwanehamadi <merwanehamadi@gmail.com>
Co-authored-by: Reinier van der Leer <github@pwuts.nl><fixed_code>
from autogpt.agent import Agent
from autogpt.config import AIConfig, Config
from autogpt.memor... |
<vulnerable_code>from typing import List
import pytest
from autogpt.agent import Agent
from autogpt.commands.file_operations import read_file
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import get_workspace_path, run_interaction_loop
CYCLE_COUNT_PER_LEVE... |
<vulnerable_code>from typing import Any, Dict, Optional
import pytest
from _pytest.config import Config
from _pytest.config.argparsing import Parser
from _pytest.fixtures import FixtureRequest
from tests.challenges.challenge_decorator.challenge import Challenge
from tests.vcr import before_record_response
@pytest.fi... |
<vulnerable_code>from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import (
copy_file_into_workspace,
get_workspace_path,
run_interaction_loop,
)
)
output = execute_python_file(
get_workspace_path(debug_code_agent, TEST_FILE_PATH), d... |
<vulnerable_code>
from autogpt.commands.file_operations import read_file
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import get_workspace_path, run_interaction_loop
CYCLE_COUNT = 3
EXPECTED_REVENUES = [["81"], ["81"], ["81", "53", "24", "21", "11", "7", "4... |
<vulnerable_code>from autogpt.agent import Agent
from autogpt.commands.file_operations import read_file
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import get_workspace_path, run_interaction_loop
CYCLE_COUNT = 3
OUTPUT_LOCATION = "2010_nobel_prize_winners.... |
<vulnerable_code>from autogpt.agent import Agent
from autogpt.commands.file_operations import read_file
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import get_workspace_path, run_interaction_loop
CYCLE_COUNT = 3
OUTPUT_LOCATION = "kube.yaml"
monkey... |
<vulnerable_code>from autogpt.agent import Agent
from autogpt.commands.file_operations import read_file, write_to_file
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import get_workspace_path, run_interaction_loop
OUTPUT_LOCATION = "output.txt"
level... |
<vulnerable_code>from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import (
generate_noise,
get_workspace_path,
run_interaction_loop,
)
level_to_run,
)
file_path = get_workspace_path(memory_management_agent, OUTPUT_LOCATION)
cont... |
<vulnerable_code>from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import (
generate_noise,
get_workspace_path,
run_interaction_loop,
)
challenge_name,
level_to_run,
)
file_path = get_workspace_path(memory_management_agent, OU... |
<vulnerable_code>from autogpt.agent import Agent
from autogpt.commands.file_operations import read_file, write_to_file
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import get_workspace_path, run_interaction_loop
LEVEL_CURRENTLY_BEATEN = 1
MAX_LEVEL = 5
... |
<vulnerable_code><commit_title>[PATCH 1/7] Add OpenAI function call support (#4683)<commit_description>Co-authored-by: merwanehamadi <merwanehamadi@gmail.com>
Co-authored-by: Reinier van der Leer <github@pwuts.nl><fixed_code>
from pydantic import BaseModel
class Task(BaseModel):
"""Jsonifiable representation of a... |
<vulnerable_code>
from autogpt.agent import Agent
from autogpt.log_cycle.log_cycle import LogCycleHandler
def generate_noise(noise_size: int) -> str:
)
def get_workspace_path(agent: Agent, file_name: str) -> str:
return str(agent.workspace.get_path(file_name))
def copy_file_into_workspace(
agent: Agen... |
<vulnerable_code> temp_plugins_config_file: str, mocker: MockerFixture, workspace: Workspace
) -> Config:
config = Config()
if not config.openai_api_key:
config.set_openai_api_key("sk-dummy")
config.plugins_dir = "tests/unit/data/test_plugins"
config.plugins_config_file = temp_plugins_config... |
<vulnerable_code> return agent
@pytest.fixture
def file_system_agents(
agent_test_config, memory_json_file: NoMemory, workspace: Workspace
):
agents = []
command_registry = get_command_registry(agent_test_config)
ai_goals = [
"Write 'Hello World' into a file named \"hello_world.txt\".",
... |
<vulnerable_code>"""Configuration class to store the state of bools for different scripts access."""
import os
from typing import List
import openai
+ Fore.RESET
)
print("You can get your key from https://platform.openai.com/account/api-keys")
exit(1)<commit_title>[PATCH 1/7] Add Op... |
<vulnerable_code>from autogpt.agent import Agent
from autogpt.config import AIConfig, Config
from autogpt.memory.vector import get_memory
from autogpt.prompts.prompt import DEFAULT_TRIGGERING_PROMPT
from autogpt.workspace import Workspace
from tests.integration.agent_factory import get_command_registry
def run_task(t... |
<vulnerable_code>import pytest
from autogpt.agent import Agent
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import run_interaction_loop
CYCLE_COUNT = 2
@challenge()
def test_browse_website(
browser_agent: Agent,
patched_api_requestor: None,
m... |
<vulnerable_code>import pytest
from autogpt.workspace import Workspace
from benchmarks import run_task
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.schema import Task
from tests.challenges.utils import (
get_workspace_path,
setup_mock_input,
setup_moc... |
<vulnerable_code>
from autogpt.agent import Agent
from autogpt.commands.execute_code import execute_python_file
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import (
copy_file_into_workspace,
get_workspace_path_from_agent,
run_interaction_loop,
)... |
<vulnerable_code>import pytest
from pytest_mock import MockerFixture
from autogpt.commands.file_operations import read_file
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import get_workspace_path_from_agent, run_interaction_loop
CYCLE_COUNT = 3
EXPECTED_REV... |
<vulnerable_code>import contextlib
import pytest
from pytest_mock import MockerFixture
from autogpt.agent import Agent
from autogpt.commands.file_operations import read_file
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import get_workspace_path_from_agent,... |
<vulnerable_code>import pytest
import yaml
from pytest_mock import MockerFixture
from autogpt.agent import Agent
from autogpt.commands.file_operations import read_file
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import get_workspace_path_from_agent, run_in... |
<vulnerable_code>import pytest
from pytest_mock import MockerFixture
from autogpt.agent import Agent
from autogpt.commands.file_operations import read_file, write_to_file
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import get_workspace_path_from_agent, run... |
<vulnerable_code>import pytest
from pytest_mock import MockerFixture
from autogpt.agent import Agent
from autogpt.commands.file_operations import read_file, write_to_file
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import (
generate_noise,
get_work... |
<vulnerable_code>import pytest
from pytest_mock import MockerFixture
from autogpt.agent import Agent
from autogpt.commands.file_operations import read_file, write_to_file
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import (
generate_noise,
get_work... |
<vulnerable_code>import pytest
from pytest_mock import MockerFixture
from autogpt.agent import Agent
from autogpt.commands.file_operations import read_file, write_to_file
from tests.challenges.challenge_decorator.challenge_decorator import challenge
from tests.challenges.utils import get_workspace_path_from_agent, run... |
<vulnerable_code>
import pytest
from autogpt.agent import Agent
from autogpt.log_cycle.log_cycle import LogCycleHandler
from autogpt.workspace import Workspace
def generate_noise(noise_size: int) -> str:
monkeypatch.setattr("autogpt.utils.session.prompt", lambda _: next(gen))
def run_interaction_loop(
monk... |
<vulnerable_code>
from autogpt.agent import Agent
from autogpt.config import AIConfig, Config
from autogpt.main import COMMAND_CATEGORIES
from autogpt.memory.vector import NoMemory, get_memory
from autogpt.models.command_registry import CommandRegistry
from autogpt.prompts.prompt import DEFAULT_TRIGGERING_PROMPT
from a... |
<vulnerable_code> u32 num_ready=0, num_blocked=0;
for (i=0; i<count; i++) {
GF_DashStream *ds = gf_list_get(ctx->current_period->streams, i);
GF_FilterPacket *pck = gf_filter_pid_get_packet(ds->ipid);
if (!pck) continue;
u64 ts = gf_filter_pck_get_cts(pck);
}
ctx->min_cts_period.num = min_ts;
ctx->... |
<vulnerable_code>
header_offset = gf_ftell(AVI->fdes);
if( avi_read(AVI->fdes,(char *)hdrl_data, (u32) n) != n ) ERR_EXIT(AVI_ERR_READ)
}
else if(strnicmp(data,"movi",4) == 0)
{
AVI->movi_start = gf_ftell(AVI->fdes);
AVI->n_idx = AVI->max_idx = (u32) (n/16);
AVI->idx = (unsigned char((*)[... |
<vulnerable_code> &sptr->par) < 0) {
sptr->m_stream_id = 0;
sptr->m_fd = FDNULL;
}
sptr->ticks_per_frame = (u64)(90000.0 / sptr->frame_rate);
return;
}
get_info_from_frame(sptr, buffer, buflen);
// here - if (sptr->first_pes_has_dts == 0) should be processed
if (sptr->fir... |
<vulnerable_code> }
for(var i in objTypeDef){
if(objTypeDef.hasOwnProperty(i)){
var value = instance[i];
// skip _not_ specified properties
if (value === undefined && options.existingOnly) continue;<commit_title>[PATCH] Don't allow __proto__ property to be used for schema<commit_description... |
<vulnerable_code> 'Json-Ref self-validates': assertSelfValidates('json-ref'),
'Json-Ref/Hyper': assertValidates('json-ref', 'hyper-schema'),
'Json-Ref/Core': assertValidates('json-ref', 'schema')*/
}).export(module);<commit_title>[PATCH] Don't allow __proto__ property to be used for schema<commit_description... |
<vulnerable_code> switch (status)
{
case PARA_VALUE_QUOTED:
switch (*(tmp+1))
{
case '\r':
}/*switch*/
}/*for*/
endofheader:
if (param) {
if (saved_status==S_EQUAL||saved_status==S_PARA_VALUE) {
saved_status = E_PARA_VALUE;<commit_title>[PATCH] [sipmsgops] fix parse_to_param() ... |
<vulnerable_code> if (credentialsPresent(credentials)) {
DefaultBasicAuthentication basicAuthentication = new DefaultBasicAuthentication("basic");
basicAuthentication.setCredentials(credentials);
authentications = Collections.<Authentication>singleton(basicAuthentication);
... |
<vulnerable_code> r_io_submap_set_to (bd, r_io_submap_from (sm) - 1);
entry = r_rbnode_next (entry);
}
while (entry && r_io_submap_to (((RIOSubMap *)entry->data)) <= r_io_submap_to (sm)) {
//delete all submaps that are completly included in sm
RRBNode *next = r_rbnode_next (entry);
// this can be optimized, ... |
<vulnerable_code> r_return_val_if_fail (tree && data && cmp, false);
bool inserted = false;
if (tree->root == NULL) {
tree->root = _node_new (data, NULL);
if (tree->root == NULL) {
return false;
}
inserted = true;<commit_title>[PATCH] Prefer memleak over usaf in io.bank's rbtree bug ##crash<commit_descrip... |
<vulnerable_code> r_return_val_if_fail (res && bf->o && bf->o->bin_obj, res);
RCoreSymCacheElement *element = bf->o->bin_obj;
size_t i;
for (i = 0; i < element->hdr->n_segments; i++) {
RCoreSymCacheElementSegment *seg = &element->segments[i];
RBinSection *s = bin_section_from_segment (seg);
if (s) {
r_list_... |
<vulnerable_code>
package org.jkiss.utils.xml;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.w3c.dom.Document;
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder xmlBuilder = dbf.newDocumentBuilder();
return x... |
<vulnerable_code><commit_title>[PATCH] Provide a test to cover the changes to pip/locations.py<commit_description><fixed_code>
"""
locations.py tests
"""
import os
import sys
import shutil
import tempfile
import getpass
from mock import Mock
import pip
class TestLocations:
def setup(self):
self.tempdir = ... |
<vulnerable_code>static bool checkreturn decode_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field);
static bool checkreturn default_extension_decoder(pb_istream_t *stream, pb_extension_t *extension, uint32_t tag, pb_wire_type_t wire_type);
static bool checkreturn decode_extension(pb_istream_t... |
<vulnerable_code> const auto version = _account->capabilities().clientSideEncryptionVersion();
QJsonObject metadata{
{"version", version},
{metadataKeyJsonKey, QJsonValue::fromVariant(encryptData(_metadataKey.toBase64()))}
};
QJsonObject files;<commit_title>[PATCH] when uploading new e2e... |
<vulnerable_code>fail:
if (item->child != NULL)
{
cJSON_Delete(child);
item->child = NULL;
}
<commit_title>[PATCH] cJSON: fix memory leak on object parsing error<commit_description>Issue discovered during OpenSIPS Security Audit 2021/2022,
by Alfred Farrugia & Sandro Gauci (Enable Security)
... |
<vulnerable_code> for( i = 0, c = space.length; i < c; i++ ){
nextSpace = space[ i ];
if ( isUndefined(curSpace[nextSpace]) ){
curSpace[ nextSpace ] = {};
}
}
function _makeSetter( property, next ){
if ( next ){
return function setter( ctx, value ){
var t = ctx[property];
for( i = 0, c = space.len... |
<vulnerable_code>const bmoor = require('./index.js');
describe('Testing object setting/getting', function() {
it('should have get working', function(){
var t = {
eins : 1,
zwei: {
drei: 3
}
};
expect( bmoor.get(t,'eins') ).to.equal(1);
expect( bmoor.get(t,'zwei.drei') ).to.equal(3);
});
... |
<vulnerable_code>
const bmoor = require('./index.js');
it('should operate explode correctly', function(){
var t = {
'eins.zwei': 12,
'eins.drei': 13,
'fier': 4
};
expect(bmoor.object.explode(t))
.to.deep.equal({
eins: {
zwei: 12,
drei: 13
},
fier: 4
});
});
it('should operate... |
<vulnerable_code> return SPECTRE_V2_USER_CMD_AUTO;
}
static inline bool spectre_v2_in_ibrs_mode(enum spectre_v2_mitigation mode)
{
return mode == SPECTRE_V2_IBRS ||
mode == SPECTRE_V2_EIBRS ||
mode == SPECTRE_V2_EIBRS_RETPOLINE ||
mode == SPECTRE_V2_EIBRS_LFENCE;
}
static void __init
spectre_... |
<vulnerable_code>size_t ieee802154_get_frame_hdr_len(const uint8_t *mhr)
{
/* TODO: include security header implications */
uint8_t tmp;
size_t len = 3; /* 2 byte FCF, 1 byte sequence number */
/* figure out address sizes */
tmp = (mhr[1] & IEEE802154_FCF_DST_ADDR_MASK);
if (tmp == IEEE802154_F... |
<vulnerable_code> if editor.verkey is None: # skip that as well since it doesn't make sense
return
sign_and_validate(looper, txnPoolNodeSet[0], ActionIds.edit, editor, edit_op, did_ledger=edited)<commit_title>[PATCH] changed auth rules check to skip those without verkey and<commit_description><fixed_co... |
<vulnerable_code>// anti-copyright Lucy Phipps 2022
// vi: sw=2 tw=80
#define VERSION "v1.0.4"
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
}
size_t l = ((uint32_t)(i[4] | (i[5] << 8) | (i[6] << 16) | (i[7] << 24))) + 8;
// ^ RIFF header size
x = malloc(l);
if(!x) {
PF("ERROR reading %s: %... |
<vulnerable_code> }
esd = gf_media_map_esd(dumper->file, track_num, 0);
sample_count = gf_isom_get_sample_count(dumper->file, dumper->trackID);
if (esd) {
if (esd->decoderConfig->objectTypeIndication<GF_CODECID_LAST_MPEG4_MAPPING) {
codec_id = gf_codecid_from_oti(esd->decoderConfig->streamType, esd->decod... |
<vulnerable_code>class DisallowedModelAdminLookup(SuspiciousOperation):
"""Invalid filter was passed to admin view via URL querystring"""
pass<commit_title>[PATCH] [1.7.x] Prevented data leakage in contrib.admin via query<commit_description><fixed_code>
class DisallowedModelAdminLookup(SuspiciousOperation):
... |
<vulnerable_code>from django.contrib.admin import validation
from django.contrib.admin.checks import (BaseModelAdminChecks, ModelAdminChecks,
InlineModelAdminChecks)
from django.contrib.admin.utils import (quote, unquote, flatten_fieldsets,
get_deleted_objects, model_format_dict, NestedObjects,
lookup_needs... |
<vulnerable_code>from django.utils.http import urlencode
from django.contrib.admin import FieldListFilter
from django.contrib.admin.exceptions import DisallowedModelAdminLookup
from django.contrib.admin.options import IncorrectLookupParameters, IS_POPUP_VAR, TO_FIELD_VAR
from django.contrib.admin.utils import (quote, ... |
<vulnerable_code>from django.contrib.admin import ModelAdmin
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.contrib.admin.models import LogEntry, DELETION
from django.contrib.admin.templatetags.admin_static import static
from django.contrib.admin.templatetags.admin_urls import add_preserved_f... |
<vulnerable_code>
out_cleanup:
ovl_cleanup(wdir, newdentry);
goto out;
}
/*<commit_title>[PATCH] ovl: fix dentry reference leak<commit_description>In ovl_copy_up_locked(), newdentry is leaked if the function exits through
out_cleanup as this just to out after calling ovl_cleanup() - which doesn't
actually release th... |
<vulnerable_code>Handle adding files and preparing the archive for upload
"""
from __future__ import absolute_import
import glob
from signal import SIGTERM, signal
import sys
import time
config - an InsightsConfig object
tmp_dir - a temporary directory in /var/tmp
archive_dir ... |
<vulnerable_code> sig_kill_bad = 101
cached_branch_info = os.path.join(default_conf_dir, '.branch_info')
pidfile = os.path.join(os.sep, 'var', 'run', 'insights-client.pid')
insights_tmp_path = os.path.join(os.sep, 'var', 'tmp', 'insights-client')
egg_release_file = os.path.join(insights_tmp_path, 'in... |
<vulnerable_code> compliance_client.get_profiles_matching_os = lambda: []
compliance_client.find_scap_policy = lambda ref_id: '/usr/share/xml/scap/foo.xml'
compliance_client.run_scan = lambda ref_id, policy_xml, output_path, tailoring_file_path: None
compliance_client.archive.archive_tmp_dir = '/tmp'
... |
<vulnerable_code>from os.path import join as path_join
from insights.client.archive import InsightsArchive
from mock.mock import patch, Mock, call
from unittest import TestCase
test_timestamp = '000000'
test_hostname = 'testhostname'
test_archive_name = 'insights-testhostname-000000'
test_archive_dir = '/var/tmp/test/i... |
<vulnerable_code>from airflow.providers_manager import ProvidersManager
from airflow.utils import timezone
from airflow.utils.types import DagRunType
from airflow.www.validators import ValidKey
from airflow.www.widgets import (
AirflowDateTimePickerROWidget,
AirflowDateTimePickerWidget,
We don't actually wa... |
<vulnerable_code> helpers.validate_key(field.data, self.max_length)
except Exception as e:
raise ValidationError(str(e))<commit_title>[PATCH] Add read only validation to read only fields<commit_description>Add read only validation to DagRunEditForm and TaskInstanceEditForm
rea... |
<vulnerable_code> match=r"The key has to be less than [0-9]+ characters",
):
self._validate()<commit_title>[PATCH] Add read only validation to read only fields<commit_description>Add read only validation to DagRunEditForm and TaskInstanceEditForm
read only fields.<fixed_code>
... |
<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> SVGProcessStyleElement(context,name,value);
(void) FormatLocaleFile(svg_info->file,"pop class\n");
}
break;
}
if (LocaleCompare((const char *) name,"svg") == 0)<commit_title>[PATCH] https://github.com/ImageMagick/ImageMagick/issues/1533<commit_d... |
<vulnerable_code> uriFreeUriMembersA(&uri);
}
TEST(FailingMemoryManagerSuite, NormalizeSyntaxExMm) {
UriUriA uri = parse("hTTp://example.org/path");
const unsigned int mask = URI_NORMALIZE_SCHEME; // anything but URI_NORMALIZED
FailingMemoryManager failingMemoryManager;
ASSERT_EQ(uriNormalizeSyntaxExMmA(&uri, ... |
<vulnerable_code>)
from .jwks_client import PyJWKClient
__version__ = "2.3.0"
__title__ = "PyJWT"
__description__ = "JSON Web Token implementation in Python"<commit_title>[PATCH] Merge pull request from GHSA-ffqj-6fqr-9h24<commit_description><fixed_code>
)
from .jwks_client import PyJWKClient
__version__ = "2.4.0"
... |
<vulnerable_code> der_to_raw_signature,
force_bytes,
from_base64url_uint,
raw_to_der_signature,
to_base64url_uint,
)
def prepare_key(self, key):
key = force_bytes(key)
invalid_strings = [
b"-----BEGIN PUBLIC KEY-----",
b"-----BEGIN CERTIFICATE-----",
... |
<vulnerable_code>import base64
import binascii
from typing import Any, Union
try:
s = bytes_to_number(raw_sig[num_bytes:])
return encode_dss_signature(r, s)<commit_title>[PATCH] Merge pull request from GHSA-ffqj-6fqr-9h24<commit_description><fixed_code>
import base64
import binascii
import re
from typing impo... |
<vulnerable_code><commit_title>[PATCH] Merge pull request from GHSA-ffqj-6fqr-9h24<commit_description><fixed_code>
import jwt
import pytest
from jwt.exceptions import InvalidKeyError
priv_key_bytes = b'''-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIIbBhdo2ah7X32i50GOzrCr4acZTe6BezUdRIixjTAdL
-----END PRIVATE KEY--... |
<vulnerable_code> def test_okp_ed25519_should_reject_non_string_key(self):
algo = OKPAlgorithm()
with pytest.raises(TypeError):
algo.prepare_key(None)
with open(key_path("testkey_ed25519")) as keyfile:<commit_title>[PATCH] Merge pull request from GHSA-ffqj-6fqr-9h24<commit_descr... |
<vulnerable_code> sbp->namelen,
sbp->valuelen,
&sbp->name[sbp->namelen]);
if (error)
return error;
if (context->seen_enough)
break;
cursor->offset++;
args.rmtblkcnt = xfs_attr3_rmt_blocks(
args.dp->i_mount, valuelen);
retval = xfs_attr_rmtval_get(&args);
if (retval)
ret... |
<vulnerable_code>import org.projectforge.database.InitDatabaseDao;
import org.projectforge.user.UserDao;
import org.projectforge.web.wicket.AbstractForm;
import org.projectforge.web.wicket.WicketUtils;
import org.projectforge.web.wicket.bootstrap.GridBuilder;
import org.projectforge.web.wicket.components.MaxLengthTextF... |
<vulnerable_code>import org.apache.wicket.model.Model;
import org.apache.wicket.util.lang.Bytes;
import org.projectforge.web.wicket.AbstractForm;
import org.projectforge.web.wicket.bootstrap.GridBuilder;
import org.projectforge.web.wicket.components.SingleButtonPanel;
import org.projectforge.web.wicket.flowlayout.Field... |
<vulnerable_code>import org.projectforge.continuousdb.UpdatePreCheckStatus;
import org.projectforge.web.HtmlHelper;
import org.projectforge.web.wicket.AbstractForm;
import org.projectforge.web.wicket.bootstrap.GridBuilder;
import org.projectforge.web.wicket.components.SingleButtonPanel;
import org.projectforge.web.wick... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.