text
stringlengths
79
3.72M
<vulnerable_code> throws IOException, RarException { // We always extract archives into a subfolder. Figure out the name of the folder. String base = getBase(aCachedFile.getFileName().toString()); Map<String, Object> cfg = aAction.getConfiguration(); int strip = cfg.containsK...
<vulnerable_code>import org.apache.uima.fit.descriptor.ResourceMetaData; import org.apache.uima.fit.descriptor.TypeCapability; import org.apache.uima.jcas.JCas; import org.lappsgrid.serialization.Serializer; import org.lappsgrid.serialization.lif.Container; Container container; try (InputStream is = re...
<vulnerable_code>import org.apache.uima.fit.descriptor.ResourceMetaData; import org.apache.uima.fit.descriptor.TypeCapability; import org.apache.uima.jcas.JCas; import org.lappsgrid.serialization.Serializer; import org.lappsgrid.serialization.lif.Container; import de.tudarmstadt.ukp.dkpro.core.api.io.JCasFileWriter_Im...
<vulnerable_code> // Paragraph for (Paragraph p : select(aJCas, Paragraph.class)) { view.newAnnotation(id(PARAGRAPH, p), Discriminators.Uri.PARAGRAPH, p.getBegin(), p.getEnd()); } // Sentence for (Sentence s : select(aJCas, Sentence.class)) { ...
<vulnerable_code> public class Lif2DKPro { public void convert(Container aContainer, JCas aJCas) { aJCas.setDocumentLanguage(aContainer.getLanguage()); aJCas.setDocumentText(aContainer.getText()); // Paragraph view.getAnnotations().stream() .filter(a -> Discriminator...
<vulnerable_code> import static de.tudarmstadt.ukp.dkpro.core.testing.IOTestRunner.testOneWay; import static de.tudarmstadt.ukp.dkpro.core.testing.IOTestRunner.testRoundTrip; import org.junit.Rule; import org.junit.Test; throws Exception { testRoundTrip( LifReader.class, // the read...
<vulnerable_code>package de.tudarmstadt.ukp.dkpro.core.io.lif; import static de.tudarmstadt.ukp.dkpro.core.testing.IOTestRunner.testOneWay; import org.junit.Rule; import org.junit.Test; throws Exception { testOneWay( Conll2006Reader.class, // the reader LifWriter.cl...
<vulnerable_code> for (AnnotationFS aFS : annotationsForColumn) { FeatureStructure[] links = getFeature(aFS, col.uimaFeature, FeatureStructure[].class); for (FeatureStructure link : links) { AnnotationFS targetFS ...
<vulnerable_code> FeatureStructure[] links = getFeature(aAnnotation, aCol.uimaFeature.getShortName(), FeatureStructure[].class); assert values.length == links.length; for (int i = 0; i < values.length; i++) { St...
<vulnerable_code> } } else { aOut.print(NULL_COLUMN); } } <commit_title>[PATCH 01/21] #1305 - Update TreeTagger models in build.xml<commit_description>- updated treetagger module paths in build.xml - updated version id of tagger-de-le in pom.xml - commented out...
<vulnerable_code> WebannoTsv3Writer.PARAM_SLOT_TARGETS, asList("webanno.custom.SimpleSpan")); } @Test public void testSimpleSlotFeatureWithoutValues() throws Exception { { Type hostType = aJCas.getTypeSystem().getType(aType); AnnotationFS hostA1 = aJCas.getCas().creat...
<vulnerable_code> public final static String APPLICATION_VND_XMI_XML = "application/vnd.xmi+xml"; // DKPro application types public final static String APPLICATION_X_ANCORA_XML = "application/x.org.dkpro.ancora+xml"; public final static String APPLICATION_X_BNC = "application/x.org.dkpro.bnc+xm...
<vulnerable_code> import org.apache.uima.collection.CollectionException; import org.apache.uima.fit.descriptor.ConfigurationParameter; import org.apache.uima.jcas.JCas; import org.dkpro.core.io.webanno.tsv.internal.tsv3x.Tsv3XDeserializer; import de.tudarmstadt.ukp.dkpro.core.api.io.JCasResourceCollectionReader_ImplBa...
<vulnerable_code> import org.apache.uima.analysis_engine.AnalysisEngineProcessException; import org.apache.uima.fit.descriptor.ConfigurationParameter; import org.apache.uima.jcas.JCas; import org.dkpro.core.io.webanno.tsv.internal.tsv3x.Tsv3XCasDocumentBuilder; import org.dkpro.core.io.webanno.tsv.internal.tsv3x.Tsv3XC...
<vulnerable_code>/** * Reads the WebAnno TSV v3.x format. */ @ResourceMetaData(name = "PubAnnotation Reader") @MimeTypeCapability({MimeTypes.TEXT_X_WEBANNO_TSV3}) public class WebannoTsv3XReader extends JCasResourceCollectionReader_ImplBase<commit_title>[PATCH 01/21] #1305 - Update TreeTagger models in build.xml<...
<vulnerable_code> public class DKPro2Lif { private static final String PHRASE_STRUCTURE = "phrasestruct"; private static final String CONSTITUENT = "const"; private static final String DEPENDENCY_STRUCTURE = "depstruct"; for (Paragraph p : select(aJCas, Paragraph.class)) { convertParagra...
<vulnerable_code> public class Lif2DKPro { private Map<String, Token> tokenIdx; public void convert(Container aContainer, JCas aJCas) view.getAnnotations().stream() .filter(a -> Discriminators.Uri.PARAGRAPH.equals(a.getAtType())) .forEach(para -> convertParagraph(aJCas, para...
<vulnerable_code><commit_title>[PATCH 01/21] #1305 - Update TreeTagger models in build.xml<commit_description>- updated treetagger module paths in build.xml - updated version id of tagger-de-le in pom.xml - commented out mongolian tagger in pom.xml (not found) - adjusted TreeTaggerPosTaggerTest.java according to change...
<vulnerable_code><commit_title>[PATCH 01/21] #1305 - Update TreeTagger models in build.xml<commit_description>- updated treetagger module paths in build.xml - updated version id of tagger-de-le in pom.xml - commented out mongolian tagger in pom.xml (not found) - adjusted TreeTaggerPosTaggerTest.java according to change...
<vulnerable_code> */ package de.tudarmstadt.ukp.dkpro.core.io.brat; import static org.apache.uima.fit.util.JCasUtil.selectAll; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.StringWriter; import java.io.Writer; import java.util.ArrayList; import java.util.Ha...
<vulnerable_code><commit_title>[PATCH 01/21] #1305 - Update TreeTagger models in build.xml<commit_description>- updated treetagger module paths in build.xml - updated version id of tagger-de-le in pom.xml - commented out mongolian tagger in pom.xml (not found) - adjusted TreeTaggerPosTaggerTest.java according to change...
<vulnerable_code> throws IOException, RarException { // We always extract archives into a subfolder. Figure out the name of the folder. Path base = Paths.get(getBase(aArchive.toString())).toAbsolutePath(); Map<String, Object> cfg = aAction.getConfiguration(); int strip = cfg....
<vulnerable_code> throws IOException, RarException { // We always extract archives into a subfolder. Figure out the name of the folder. Path base = getPathWithoutFileExtension(aArchive).toAbsolutePath(); Map<String, Object> cfg = aAction.getConfiguration(); int strip = cfg.co...
<vulnerable_code> public void testGalician() throws Exception { String[] tagset = { "A0aa", "A0ap", "A0as", "A0fa", "A0fp", "A0fs", "A0ma", "A0mp", "A0ms", "Acap", "Acas", "Acfp", "Acfs", "Acmp", "Acms", "Asap", "Asas", "Asfp", "Asfs", "Asmp", "Asms", "Cc", "Cs", "...
<vulnerable_code> struct page *page = virt_to_head_page(data); int offset = data - page_address(page); struct sk_buff *skb = q->rx_head; offset += q->buf_offset; skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, offset, len, q->buf_size); if (more) return;<commit_title>[PATCH] mt76: fix array overflow o...
<vulnerable_code> case 0: op[0] = (unsigned char) ((v) << 6); break; \ case 1: op[0] |= (v) << 4; break; \ case 2: op[0] |= (v) << 2; break; \ case 3: *op++ |= (v); break; \ } \ } uint32 imagewidth = tif->tif_dir.td_imagewidth; if( isTiled(tif) ) imagewidth = tif->tif_dir.td_...
<vulnerable_code>import java.io.StringReader; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Set; import javax.inject.Inject; import javax.inject.Singleton; import org.apache.commons.lang3.StringUtils; import org.xwiki.bridge.SkinAccessBridge; import org.xwiki.component...
<vulnerable_code>#include "file.h" #ifndef lint FILE_RCSID("@(#)$File: readelf.c,v 1.156 2018/10/19 00:33:04 christos Exp $") #endif #ifdef BUILTIN_ELF char sbuf[512]; struct NetBSD_elfcore_procinfo pi; memset(&pi, 0, sizeof(pi)); memcpy(&pi, nbuf + doff, descsz); if (file_printf(ms, ", from '%.31s', ...
<vulnerable_code> "Calling command '%s %s'" % (self.cmd, " ".join(hide_secrets(self.args))) ) # lgtm[py/clear-text-logging-sensitive-data] output, ret_code = utils.run_cmd_in_pty( [self.cmd] + self.args, expect_script=(("assword: ", self.password + "\n"),), print_...
<vulnerable_code> reg_cmd = subscription.RegistrationCommand(activation_key="0xDEADBEEF", org="Local Organization") assert reg_cmd() == ("", 0) assert utils.run_subprocess.called_once_with( "subscription-manager", ["register", "--force", "--activationkey=0xDEADBEEF", "--o...
<vulnerable_code> package org.apache.submarine.server.rest.provider; import org.yaml.snakeyaml.LoaderOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.SafeConstructor; import javax.ws.rs.Consumes; import javax.ws.rs.Produces; MediaType mediaType, MultivaluedMap<String, String>...
<vulnerable_code> * under the License. */ package org.apache.submarine.server.submitter.k8s.util; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.datatype.joda.JodaModule; import com.fasterxml.jackson.datatype.jsr310.JavaTim...
<vulnerable_code>import io.kubernetes.client.openapi.models.V1Pod; import io.kubernetes.client.openapi.models.V1PodSpec; import org.apache.submarine.server.submitter.k8s.client.K8sClient; import org.apache.submarine.server.submitter.k8s.util.YamlUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; <commit_ti...
<vulnerable_code>import org.apache.submarine.server.submitter.k8s.model.K8sResource; import org.apache.submarine.server.submitter.k8s.util.JsonUtils; import org.apache.submarine.server.submitter.k8s.util.OwnerReferenceUtils; import org.apache.submarine.server.submitter.k8s.util.YamlUtils; import org.slf4j.Logger; impor...
<vulnerable_code>import org.apache.submarine.server.submitter.k8s.model.K8sResource; import org.apache.submarine.server.submitter.k8s.util.NotebookUtils; import org.apache.submarine.server.submitter.k8s.util.OwnerReferenceUtils; import org.apache.submarine.server.submitter.k8s.util.YamlUtils; import org.slf4j.Logger; i...
<vulnerable_code>import org.apache.submarine.server.submitter.k8s.client.K8sClient; import org.apache.submarine.server.submitter.k8s.K8sSubmitter; import org.apache.submarine.server.submitter.k8s.model.K8sResource; import org.apache.submarine.server.submitter.k8s.util.YamlUtils; import org.slf4j.Logger; import org.slf4...
<vulnerable_code>import org.apache.submarine.server.submitter.k8s.parser.NotebookSpecParser; import org.apache.submarine.server.submitter.k8s.util.NotebookUtils; import org.apache.submarine.server.submitter.k8s.util.OwnerReferenceUtils; import org.apache.submarine.server.submitter.k8s.util.YamlUtils; import org.joda.ti...
<vulnerable_code>import org.apache.submarine.server.submitter.k8s.parser.ExperimentSpecParser; import org.apache.submarine.server.submitter.k8s.util.JsonUtils; import org.apache.submarine.server.submitter.k8s.util.MLJobConverter; import org.apache.submarine.server.submitter.k8s.util.YamlUtils; import java.util.HashMap...
<vulnerable_code>import org.apache.submarine.server.submitter.k8s.client.K8sClient; import org.apache.submarine.server.submitter.k8s.model.istio.IstioVirtualService; import org.apache.submarine.server.submitter.k8s.util.OwnerReferenceUtils; import org.apache.submarine.server.submitter.k8s.util.YamlUtils; import org.slf...
<vulnerable_code>import org.apache.submarine.server.submitter.k8s.parser.ExperimentSpecParser; import org.apache.submarine.server.submitter.k8s.util.JsonUtils; import org.apache.submarine.server.submitter.k8s.util.MLJobConverter; import org.apache.submarine.server.submitter.k8s.util.YamlUtils; import java.util.HashMap...
<vulnerable_code>import org.apache.submarine.server.submitter.k8s.model.seldon.SeldonDeploymentPytorchServing; import org.apache.submarine.server.submitter.k8s.model.seldon.SeldonDeploymentTFServing; import org.apache.submarine.server.submitter.k8s.model.seldon.SeldonResource; import org.apache.submarine.server.submitt...
<vulnerable_code> 'login_view-current_step': 'auth'}) self.assertRedirects(response, reverse('two_factor:profile'), fetch_redirect_response=False) def test_valid_login_with_redirect_authenticated_user(self): user = self.create_user() # Check that the signal was fired. m...
<vulnerable_code>import warnings from base64 import b32encode from binascii import unhexlify import django_otp import qrcode from django.contrib.auth.forms import AuthenticationForm from django.contrib.auth.views import SuccessURLAllowedHostsMixin from django.contrib.sites.shortcuts import get_current_site from django...
<vulnerable_code>import logging from django.core.exceptions import SuspiciousOperation from django.utils.decorators import method_decorator from django.utils.translation import gettext as _ def _set_validated_step_data(self, validated_step_data): self.data[self.validated_step_data_key] = validated_step_dat...
<vulnerable_code> 'backup': False, } redirect_authenticated_user = False def has_token_step(self): return default_device(self.get_user())<commit_title>[PATCH 1/4] Discontinue storing credentials in the session store<commit_description>Previously the credentials in the "auth" form were being ...
<vulnerable_code> def _set_validated_step_data(self, validated_step_data): self.data[self.validated_step_data_key] = validated_step_data def _get_authenticated_user(self): # Ensure that both user_pk and user_backend exist in the session if not all([self.data.get("user_pk"), self.data.get...
<vulnerable_code> The user can select a particular device to challenge, being the backup devices added to the account. """ wizard_goto_step = self.request.POST.get('wizard_goto_step', None) if self.expired and self.steps.current != 'auth' and wizard_goto_step != 'auth': ...
<vulnerable_code>from unittest import mock from django.conf import settings # view should return HTTP 400 Bad Request self.assertEqual(response.status_code, 400) class BackupTokensTest(UserMixin, TestCase): def setUp(self):<commit_title>[PATCH 1/4] Discontinue storing credentials in the session s...
<vulnerable_code> if (val) { gen_move(s, top, cursp(), 1); } if (n < 14) { n++; } else { pop();<commit_title>[PATCH] codegen.c: fix a argument generation bug in array assignment.<commit_description><fixed_code> if (val) { gen_move(s, top, cursp(), 1); ...
<vulnerable_code><commit_title>[PATCH] Add IT test which verifies that unsynced property update<commit_description><fixed_code> /* * Copyright 2000-2018 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a...
<vulnerable_code><commit_title>[PATCH] Add IT test which verifies that unsynced property update<commit_description><fixed_code> /* * Copyright 2000-2018 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a...
<vulnerable_code><commit_title>[PATCH] Add IT test which verifies that unsynced property update<commit_description><fixed_code> /* * Copyright 2000-2018 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a...
<vulnerable_code>const expect = require("expect.js"); const request = require("superagent"); const cookieMod = require("cookie"); /** * Tests. }); }); }); }); describe("handshake", () => {<commit_title>[PATCH] fix: prevent crash when provided with an invalid query param<commit_description>A s...
<vulnerable_code> private boolean isUpdateFromClientAllowedByFilter(StateNode node, String key) { ElementPropertyMap propertyMap = node .getFeature(ElementPropertyMap.class); if (propertyMap.updateFromClientFilter != null) { return propertyMap.updateFromClient...
<vulnerable_code> // Recurse if it's a bean ModelType propertyType = unwrapTypes(property.getType()); if (propertyType instanceof BeanModelType) { ((BeanModelType<?>) propertyType).collectAllowedProperties( fullName + ".", allowedProperties, tw...
<vulnerable_code>import com.vaadin.flow.component.polymertemplate.PolymerTemplate; import com.vaadin.flow.router.Route; import com.vaadin.flow.templatemodel.AllowClientUpdates; import com.vaadin.flow.templatemodel.ClientUpdateMode; import com.vaadin.flow.templatemodel.TemplateModel; import com.vaadin.flow.uitest.servle...
<vulnerable_code>import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Set; import java.util.Vector; import java.util.stream.Collectors; import javax.inject.Inject; import javax.inject.Provider; import javax.inject.Singleton; import javax.xml.parsers.ParserConfigurationException; i...
<vulnerable_code>import java.util.Map; import java.util.Set; import java.util.Vector; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import org.mockito.Mock; import org.xwiki.component.manager.ComponentManager; import org.xwiki.mode...
<vulnerable_code> */ public ClassPathResource(String path, ClassLoader classLoader) { Assert.notNull(path, "Path must not be null"); String pathToUse = StringUtils.cleanPath(path); if (pathToUse.startsWith("/")) { pathToUse = pathToUse.substring(1); } this.pat...
<vulnerable_code>import discourseComputed from "discourse-common/utils/decorators"; import { iconHTML } from "discourse-common/lib/icon-library"; import { htmlSafe } from "@ember/template"; const TITLES = { [PRIVATE_MESSAGE]: "topic.private_message", }, _formatReplyToUserPost(avatar, link) { const htmlLink ...
<vulnerable_code> test("Reply to post use full name", async function (assert) { await visit("/t/short-topic-with-two-posts/54079"); await click("article#post_2 button.reply"); assert.strictEqual( query(".action-title .user-link").innerText.trim(), "james, john, the third" ); }); <commit...
<vulnerable_code> }, { id: 419, name: "Tim Stone", username: "tms", avatar_template: "/letter_avatar_proxy/v4/letter/t/3be4f8/{size}.png", uploaded_avatar_id: 40181,<commit_title>[PATCH] SECURITY: Fix XSS in full name composer reply<commit_description>We ...
<vulnerable_code> """ Create a ServerAclEvaluator from a m.room.server_acl event's content. This does up-front parsing of the content to ignore bad data and pre-compile regular expressions. """ # first of all, check if literal IPs are blocked, and if so, whether the # server name is a liter...
<vulnerable_code> @Contract(pure = false) public static <T> T throw0(Throwable throwable) { if (throwable == null) throw new NullPointerException(); getUnsafe().throwException(throwable); throw new RuntimeException(); } /**<commit_title>[PATCH] Fix UnsafeAccess perm checking<comm...
<vulnerable_code> static final UnsafeAccess INSTANCE = new UnsafeAccess(); public static UnsafeAccess getInstance() { SecurityCheck.getInstance(); return INSTANCE; } <commit_title>[PATCH] Fix UnsafeAccess perm checking<commit_description><fixed_code> static final UnsafeAccess INSTANCE = ...
<vulnerable_code> private FileReadingIterator createBatchIterator(S3ObjectInputStream inputStream, String ... fileUris) { String compression = null; return new FileReadingIterator( Arrays.asList(fileUris), compression, Map.of( S3FileInputFactory.NAM...
<vulnerable_code> package io.crate.exceptions; public class UnauthorizedException extends RuntimeException implements UnscopedException { public UnauthorizedException(String message) { super(message); } }<commit_title>[PATCH] Restrict `COPY FROM` using local files to superuser<commit_description>Fixi...
<vulnerable_code> } } public FileReadingIterator(Collection<String> fileUris, String compression, Map<String, FileInputFactory> fileInputFactories, Boolean shared, } @Nullable private FileInput toFi...
<vulnerable_code> package io.crate.execution.engine.collect.sources; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import io.crate.data.BatchIterator; import io.crate.data.Row; import io.crate.data.SkippingBatchIterator; import io.crate.execution.dsl.phases.CollectPhase; import io...
<vulnerable_code> io.crate.exceptions.OperationOnInaccessibleRelationException.class, io.crate.exceptions.OperationOnInaccessibleRelationException::new, 176, Version.V_5_6_0); final Class<? extends ElasticsearchException> exceptionClass; final CheckedFunct...
<vulnerable_code>import io.crate.expression.symbol.Literal; import io.crate.metadata.ColumnIdent; import io.crate.metadata.CoordinatorTxnCtx; import io.crate.test.integration.CrateDummyClusterServiceUnitTest; import io.crate.types.DataTypes; createNodeContext(), clusterService, Coll...
<vulnerable_code> private static FileReadingIterator it(Collection<String> fileUris, String compression) { return new FileReadingIterator( fileUris, compression, Map.of(LocalFsFileInputFactory.NAME, new LocalFsFileInputFactory()), false,<commit_title>[PATCH] R...
<vulnerable_code>import java.io.InputStream; import java.io.InputStreamReader; import java.net.SocketTimeoutException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java....
<vulnerable_code> new NodeContext(new Functions(Map.of()), roles), clusterService, Map.of(), THREAD_POOL ); CompletableFuture<BatchIterator<Row>> iterator = fileCollectSource.getIterator(<commit_title>[PATCH] Restrict `COPY FROM` using local files to super...
<vulnerable_code>import static io.crate.testing.Asserts.assertThat; import static io.crate.testing.TestingHelpers.printedTable; import static io.netty.handler.codec.http.HttpResponseStatus.BAD_REQUEST; import java.io.File; import java.io.FileOutputStream; import com.carrotsearch.randomizedtesting.LifecycleScope; imp...
<vulnerable_code> last_h = cpi->oxcf.Height; prev_number_of_layers = cpi->oxcf.number_of_layers; cpi->oxcf = *oxcf; switch (cpi->oxcf.Mode) {<commit_title>[PATCH] VP8: disallow thread count changes<commit_description>Currently allocations are done at encoder creation time. Going from threaded to non-threaded w...
<vulnerable_code>// Load modules const Crypto = require('crypto'); const Boom = require('boom'); exports.randomDigits = function (size) { const buffer = exports.randomBits(size * 8); if (buffer instanceof Error) { return buffer; } const digits = []; for (let i = 0; i < buffer.length; +...
<vulnerable_code> done(); }); it('returns an error on invalid bits size', (done) => { expect(Cryptiles.randomDigits(99999999999999999999).message).to.match(/Failed generating random bits/);<commit_title>[PATCH] Backport fix #34. Closes #35<commit_description><fixed_code> done(); });...
<vulnerable_code> in_place ? DMA_BIDIRECTIONAL : DMA_TO_DEVICE); if (ret) goto e_ctx; if (in_place) { dst = src; op.u.aes.size = 0; ret = cmd_q->ccp->vdata->perform->aes(&op); if (ret) goto e_dst; if (aes->action == CCP_AES_ACTION_ENCRYPT) { /* Put the ciphered tag after the ciphert...
<vulnerable_code>from io import BytesIO import requests import yaml from cookbook.helper.ingredient_parser import IngredientParser if len(images) > 0: try: response = requests.get(images[0]) self.import_recipe_image(recipe, BytesIO(response.content)) ex...
<vulnerable_code>from gettext import gettext as _ import requests from lxml import etree from cookbook.helper.ingredient_parser import IngredientParser if recipe_xml.find('imageurl') is not None: try: response = requests.get(recipe_xml.find('imageurl').text.strip()) ...
<vulnerable_code>from zipfile import ZipFile import requests from django.utils.translation import gettext as _ from cookbook.helper.image_processing import get_filetype self.import_recipe_image(recipe, BytesIO(import_zip.read(image_file_name)), filetype=get_filetype(image_file_name)) ...
<vulnerable_code>from io import BytesIO import requests from cookbook.helper.ingredient_parser import IngredientParser from cookbook.integration.integration import Integration if len(file['image']) > 0: try: response = requests.get(file['image'][0]) self.import_rec...
<vulnerable_code>from datetime import datetime import requests from cookbook.models import Recipe, RecipeImport, SyncLog from cookbook.provider.provider import Provider recipe.link = Dropbox.get_share_link(recipe) recipe.save() response = requests.get(recipe.link.replace('www.dropbox....
<vulnerable_code>from datetime import datetime import requests import webdav3.client as wc from cookbook.models import Recipe, RecipeImport, SyncLog from cookbook.provider.provider import Provider "Content-Type": "application/json" } r = requests.get( url, headers=h...
<vulnerable_code>from collections import OrderedDict import requests from PIL import UnidentifiedImageError from annoying.decorators import ajax_request from annoying.functions import get_object_or_None from django.contrib.postgres.search import TrigramSimilarity from django.core.exceptions import FieldError, Validati...
<vulnerable_code>import com.dotcms.repackage.com.google.common.base.Preconditions; import com.dotcms.repackage.com.google.common.collect.ImmutableList; import com.dotmarketing.portlets.rules.actionlet.ActionParameterDefinition; import com.dotmarketing.portlets.rules.actionlet.InvalidActionInstanceException; import com....
<vulnerable_code>package com.dotmarketing.osgi.ruleengine.actionlet; import com.dotmarketing.portlets.rules.model.RuleAction; import com.dotmarketing.portlets.rules.model.RuleActionParameter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @Test(dataProvider = "urlCases") public vo...
<vulnerable_code>import com.dotcms.repackage.com.google.common.annotations.VisibleForTesting; import com.dotcms.repackage.com.google.common.collect.ImmutableMap; import com.dotmarketing.portlets.rules.conditionlet.Conditionlet; import com.dotmarketing.portlets.rules.conditionlet.EntryOption; import com.dotmarketing.po...
<vulnerable_code> import com.dotmarketing.business.ApiProvider; import com.dotmarketing.portlets.rules.business.RulesAPI; import com.dotmarketing.portlets.rules.model.RuleActionParameter; import java.util.function.Function; public RuleActionParameterTransform(ApiProvider apiProvider) { this.rulesAPI = apiProvide...
<vulnerable_code>import java.util.stream.Collectors; public class ConditionTransform { private final ConditionValueTransform conditionValueTransform = new ConditionValueTransform(); public Condition restToApp(RestCondition rest) { Condition app = new Condition(); app.setPriority(rest.priority)...
<vulnerable_code>import com.dotmarketing.portlets.contentlet.business.HostAPI; import com.dotmarketing.portlets.rules.business.RulesAPI; import com.dotmarketing.portlets.rules.model.Condition; import com.dotmarketing.portlets.rules.model.ConditionValue; import com.dotmarketing.util.Logger; import com.liferay.portal.mod...
<vulnerable_code>package com.dotcms.rest.api.v1.sites.ruleengine.rules.conditions; import com.dotmarketing.portlets.rules.model.ConditionValue; import java.util.function.Function; public class ConditionValueTransform { public final Function<ConditionValue, RestConditionValue> toRest = (app) -> { RestCond...
<vulnerable_code> private final Function<Comparison, RestComparison> toRest = (app) -> new RestComparison.Builder() .id(app.getId()) .label(app.getLabel()) .build(); @Override<commit_title>[PATCH 01/30] Create comparison types.<commit_description><fixed_...
<vulnerable_code> public class ConditionletTransform { private final Function<Conditionlet, RestConditionlet> toRest = (app) -> { ComparisonTransform comparisonTransform = new ComparisonTransform(); RestConditionlet rest = new RestConditionlet.Builder() .id(a...
<vulnerable_code> return Response.ok(getConditionletsInternal()).build(); } /** * <p>Returns a JSON with the Comparisons of a given contentlet. * <br>Each Comparisons node contains the id and label * <p> * Usage: /conditionlets/{id}/comparisons */ @GET @Path("/conditionl...
<vulnerable_code> Enumeration<String> langFiles = context.getBundle().getEntryPaths("messages"); while( langFiles.hasMoreElements() ){ String langFile = (String)langFiles.nextElement(); //We need to verify file is a language file. String languageFilePrefix = "message...
<vulnerable_code><commit_title>[PATCH 01/30] Create comparison types.<commit_description><fixed_code> package com.dotmarketing.portlets.rules; import com.dotcms.repackage.javax.validation.constraints.NotNull; import java.io.Serializable; /** * @author Geoff M. Granum */ public abstract class RuleComponentDefinition...
<vulnerable_code><commit_title>[PATCH 01/30] Create comparison types.<commit_description><fixed_code> package com.dotmarketing.portlets.rules; /** * @author Geoff M. Granum */ public interface RuleComponentInstance { }
<vulnerable_code>package com.dotmarketing.portlets.rules.conditionlet; import java.util.List; return errorMessage; } public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; }<commit_title>[PATCH 01/30] Create comparison types.<commit_description><fixed_code> p...