text stringlengths 79 3.72M |
|---|
<vulnerable_code> svc_rdma_put_context(ctxt, 1);
}
/**
* svc_rdma_wc_write - Invoked by RDMA provider for each polled Write WC
* @cq: completion queue
* @wc: completed WR
*
*/
void svc_rdma_wc_write(struct ib_cq *cq, struct ib_wc *wc)
{
struct ib_cqe *cqe = wc->wr_cqe;
struct svc_rdma_op_ctxt *ctx... |
<vulnerable_code> xdr_encode_write_chunk(p, rp_ch, consumed);
}
int svc_rdma_map_xdr(struct svcxprt_rdma *xprt,
struct xdr_buf *xdr,
struct svc_rdma_req_map *vec,
bool write_chunk_present)
{
int sge_no;
u32 sge_bytes;
u32 page_bytes;
u32 page_off;
int page_no;
if (xdr->len !=
(xdr->hea... |
<vulnerable_code> }
}
static struct svc_rdma_req_map *alloc_req_map(gfp_t flags)
{
struct svc_rdma_req_map *map;
map = kmalloc(sizeof(*map), flags);
if (map)
INIT_LIST_HEAD(&map->free);
return map;
}
static bool svc_rdma_prealloc_maps(struct svcxprt_rdma *xprt)
{
unsigned int i;
/* One for each receive buff... |
<vulnerable_code> dprintk("svcrdma: failed to parse transport header\n");
return -EINVAL;
}
/**
* svc_rdma_xdr_get_reply_hdr_length - Get length of Reply transport header
* @rdma_resp: buffer containing Reply transport header
*
* Returns length of transport header, in bytes.
*/
unsigned int svc_rdma_xdr_get_repl... |
<vulnerable_code> if (!(block = nlmsvc_find_block(cookie)))
return;
if (block) {
if (status == nlm_lck_denied_grace_period) {
/* Try again in a couple of seconds */
nlmsvc_insert_block(block, 10 * HZ);
} else {
/* Lock is now held by client, or has been rejected.
* In both cases, the block should b... |
<vulnerable_code> printk(KERN_WARNING "nfs_callback_create_svc: no kthread, %d users??\n",
cb_info->users);
serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE, sv_ops);
if (!serv) {
printk(KERN_ERR "nfs_callback_create_svc: create service failed\n");
return ERR_PTR(-ENOMEM);<commit_title>[PATCH ... |
<vulnerable_code> return task;
}
/*
* Create or destroy enough new threads to make the number
* of threads the given number. If `pool' is non-NULL, applies
* only to threads in that pool, otherwise round-robins between
* all pools. Caller must ensure that mutual exclusion between this and
* server startup or sh... |
<vulnerable_code>
set_freezable();
while (!kthread_should_stop()) {
/*
* Listen for a request on the socket
*/
continue;
svc_process(rqstp);
}
return 0;
}
set_freezable();
while (!kthread_should_stop()) {
if (try_to_freeze())
continue;
prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_INTERRU... |
<vulnerable_code>}
EXPORT_SYMBOL_GPL(svc_set_num_threads);
/*
* Called from a server thread as it's exiting. Caller must hold the "service
* mutex" for the service.<commit_title>[PATCH 02/26] uapi: fix linux/nfsd/cld.h userspace compilation errors<commit_description>Include <linux/types.h> and consistently use types... |
<vulnerable_code>{
int err = 0;
struct svc_rqst *rqstp = vrqstp;
/* try_to_freeze() is called from svc_recv() */
set_freezable();
if (nlmsvc_ops)
nlmsvc_invalidate_all();
nlm_shutdown_hosts();
return 0;
}
if (ln->nlmsvc_users) {
if (--ln->nlmsvc_users == 0) {
nlm_shutdown_hosts_net(net);
cancel_del... |
<vulnerable_code> return NULL;
}
if (!(exp->ex_layout_types & (1 << layout_type))) {
dprintk("%s: layout type %d not supported\n",
__func__, layout_type);
return NULL;<commit_title>[PATCH 02/26] uapi: fix linux/nfsd/cld.h userspace compilation errors<commit_description>Include <linux/types.h> and consistentl... |
<vulnerable_code> struct nfsd4_getdeviceinfo *gdev)
{
struct xdr_stream *xdr = &resp->xdr;
const struct nfsd4_layout_ops *ops =
nfsd4_layout_ops[gdev->gd_layout_type];
u32 starting_len = xdr->buf->len, needed_len;
__be32 *p;
/* If maxcount is 0 then just update notifications */
if (gdev->gd_maxcount != 0) {
... |
<vulnerable_code> }
#endif /* CONFIG_NFSD_PNFS */
if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) {
status = nfsd4_encode_bitmap(xdr, NFSD_SUPPATTR_EXCLCREAT_WORD0,
NFSD_SUPPATTR_EXCLCREAT_WORD1,
NFSD_SUPPATTR_EXCLCREAT_WORD2);
if (status)
goto out;
}<commit_title>[PATCH 02/26] uapi: fix linux/nf... |
<vulnerable_code> /*
* Can't have an unresolved IP address with double-lookups enabled...
*/
httpClose(con->http);
cupsdLogClient(con, CUPSD_LOG_WARN,
"Name lookup failed - connection from %s closed!",
httpGetHostname(con->http, NULL, 0));
free(con);
... |
<vulnerable_code> ssn->flags &=~ STREAMTCP_FLAG_4WHS;
}
/**
* \brief Function to handle the TCP_SYN_SENT state. The function handles
* SYN, SYN/ACK, RST packets and correspondingly changes the connection
SCLogDebug("ssn %p: pkt received: %s", ssn, PKT_IS_TOCLIENT(p) ?
"toclient":"tos... |
<vulnerable_code> "use strict";
$('.make_default').on('click', setDefaultCurrency);
});
function setDefaultCurrency(e) {
}).fail(function () {
console.error('I failed :(');
});
}<commit_title>[PATCH] Convert GET routes to POST.<commit_description><fixed_code>
"use strict";
$('.make_defa... |
<vulnerable_code>$(document).ready(function () {
updateListButtons();
addSort();
});
var fixHelper = function (e, tr) {
if (0 === count) {
$('.action-menu').hide();
}
}<commit_title>[PATCH] Convert GET routes to POST.<commit_description><fixed_code>
$(document).ready(function () {
updateLis... |
<vulnerable_code>$(function () {
"use strict";
$('.link-modal').click(getLinkModal);
$('#linkJournalModal').on('shown.bs.modal', function () {
makeAutoComplete();
})
$('#selected-journal').html('<a href="' + groupURI.replace('%GROUP%', journal.transaction_group_id) + '">' + journal.descripti... |
<vulnerable_code> self.start_service(node, start_rp)
self._started.append(node)
def _log_node_process_state(self, node):
"""
For debugging issues around starting and stopping processes: log<commit_title>[PATCH] duck: add rpc_server_tls ducktape tests in rpk<commit_description>These t... |
<vulnerable_code>
from rptest.services.cluster import cluster
from rptest.tests.redpanda_test import RedpandaTest
from rptest.clients.rpk import RpkTool
from rptest.clients.rpk_remote import RpkRemoteTool
from rptest.services.redpanda import RedpandaService
import os
import yaml
import tempfile
# Skip starting... |
<vulnerable_code> */
void jbd2_journal_wait_updates(journal_t *journal)
{
transaction_t *commit_transaction = journal->j_running_transaction;
if (!commit_transaction)
return;
spin_lock(&commit_transaction->t_handle_lock);
while (atomic_read(&commit_transaction->t_updates)) {
DEFINE_WAIT(wait);
prepare_to_w... |
<vulnerable_code>
#include "blk.h"
#include "blk-mq.h"
/* FLUSH/FUA sequences */
enum {
struct blk_flush_queue *fq = blk_get_flush_queue(q, flush_rq->mq_ctx);
if (q->mq_ops) {
spin_lock_irqsave(&fq->mq_flush_lock, flags);
flush_rq->tag = -1;
}
/*
* Borrow tag from the first request since they can't
* be... |
<vulnerable_code> for (bit = find_first_bit(&bm->word, bm->depth);
bit < bm->depth;
bit = find_next_bit(&bm->word, bm->depth, bit + 1)) {
rq = blk_mq_tag_to_rq(hctx->tags, off + bit);
if (rq->q == hctx->queue)
fn(hctx, rq, data, reserved);
}
for (bit = find_first_bit(&bm->word, bm->dep... |
<vulnerable_code>}
EXPORT_SYMBOL(blk_mq_abort_requeue_list);
static inline bool is_flush_request(struct request *rq,
struct blk_flush_queue *fq, unsigned int tag)
{
return ((rq->cmd_flags & REQ_FLUSH_SEQ) &&
fq->flush_rq->tag == tag);
}
struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag... |
<vulnerable_code>const child_process = require( 'child_process' )
exports.Terminal = command => new Promise((resolve, reject) => {
child_process.exec(command, {maxBuffer : 1500 * 1024}, function(error, stdout, stderr) {
if( !!error ) reject( error )
else resolve( stdout || stderr )
})
})<commit_title>[PATC... |
<vulnerable_code> cryptProvider: null,
queue: null,
token: "",
version: "9.2.17.1",
ID: "AjaxPro",
noActiveX: false,
timeoutPeriod: 15*1000,<commit_title>[PATCH] added allowed customized types<commit_description><fixed_code>
cryptProvider: null,
queue: null,
token: "",
version: "21.10.27.1",
ID: "AjaxPro",
... |
<vulnerable_code>/*!
* jQuery JavaScript Library v1.3.1
* http://jquery.com/
*
* Copyright (c) 2009 John Resig
* Dual licensed under the MIT and GPL licenses.
* http://docs.jquery.com/License
*
* Date: 2009-01-21 20:42:16 -0500 (Wed, 21 Jan 2009)
* Revision: 6158
*/
(function(){
var
// Will speed up refere... |
<vulnerable_code> * Authors:
* Michael Aufreiter (quasipartikel.at)
* Yanick Rochon (yanick.rochon[at]gmail[dot]com)
*
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://www.quasipartikel.at/multiselect/
*
*
* Depends:
* ui.core.js
* ui.sortable.js
* Optio... |
<vulnerable_code> assert(exception->signature == MagickCoreSignature);
image=AcquireImage(image_info,exception);
(void) ResetImagePage(image,"0x0+0+0");
/*
Format caption.
*/<commit_title>[PATCH] https://github.com/ImageMagick/ImageMagick/issues/1519<commit_description><fixed_code>
assert(exception->sign... |
<vulnerable_code> verbprintf(3, "FLEX: idx %u >= MAX_ALN %u\n", idx, MAX_ALN);
return 0;
}
// don't store ETX end of text (0x03)
if (ch != 0x03) {
buf[idx] = ch;
return 1;
}<commit_title>[PATCH] Scrub FLEX ALN messages to be printable on a single line,<commit_description><... |
<vulnerable_code> return(MagickTrue);
}
status=AcquireMagickResource(AreaResource,cache_info->length);
length=number_pixels*(sizeof(PixelPacket)+sizeof(IndexPacket));
if ((status != MagickFalse) && (length == (MagickSizeType) ((size_t) length)))
{
"CacheResourcesExhausted","`%s'",image->filen... |
<vulnerable_code> if (temporary_resources != (SplayTreeInfo *) NULL)
status=DeleteNodeFromSplayTree(temporary_resources, (const void *) path);
UnlockSemaphoreInfo(resource_semaphore);
(void) CopyMagickString(cache_path,path,MaxTextExtent);
AppendImageFormat("cache",cache_path);
(void) ShredFile(cache_path)... |
<vulnerable_code> V2i tileMin = V2i (minX + dx * tileDesc.xSize,
minY + dy * tileDesc.ySize);
V2i tileMax = tileMin + V2i (tileDesc.xSize - 1, tileDesc.ySize - 1);
V2i levelMax = dataWindowForLevel
(tileDesc, minX, maxX, minY, maxY, lx, ly).max;
tileMax = V2i (std::min (tileMax[0], l... |
<vulnerable_code> static void
delete_buff_tail(buffheader_T *buf, int slen)
{
int len = (int)STRLEN(buf->bh_curr->b_str);
if (len >= slen)
{
buf->bh_curr->b_str[len - slen] = NUL;<commit_title>[PATCH] patch 8.2.4233: crash when recording and using Select mode<commit_description>Problem: Crash when r... |
<vulnerable_code>
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4232,
/**/<commit_title>[PATCH] patch 8.2.4233: crash when recording and using Select mode<commit_description>Problem: Crash when recording and using Select mode.
Solution: When deleting the last recorded char... |
<vulnerable_code> */
static const int default_env_vars_count_in_n = -1;
/* This function handles configuration directives which set a
* multivalued string slot in the module configuration (the destination
* strucure is a hash).
return NULL;
}
/* This array contains all the configuration directive which are han... |
<vulnerable_code> return rc;
}
apr_table_setn(r->headers_out, "Location", return_to);
return HTTP_SEE_OTHER;
}
return HTTP_BAD_REQUEST;
}
/* Disable the the local session (in case the IdP doesn't respond). */
mellon_session = am_get_request_session(r);
if(mellon_session != N... |
<vulnerable_code> return url;
}
/* This function builds an array of regexp backreferences
*
* Parameters:<commit_title>[PATCH] Add MellonRedirectDomains option.<commit_description>Limit the domains that we will redirect to after login / logout to a
set of trusted domains. By default we only allow redirects to the... |
<vulnerable_code> break;
case PRIV_SEP_OP_SET_HOSTNAME:
if (sethostname (arg1, strlen(arg1)) != 0)
die_with_error ("Can't set hostname to %s", arg1);
break;<commit_title>[PATCH] Don't allow setting hostname if not unsharing UTS namespace<commit_description>This is normally verified on argu... |
<vulnerable_code> velocityEngine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,
"org.apache.velocity.runtime.log.CommonsLogLogChute");
velocityEngine.setProperty(CommonsLogLogChute.LOGCHUTE_COMMONS_LOG_NAME, "htmlformentry_velocity");
try {
velocityEngine.init();<commit_title>[PATCH] HTML-73... |
<vulnerable_code> new FormValidator().validate(hf.getForm(), errors);
errors.popNestedPath();
}
if (hf.getXmlData() != null) {
try {
@SuppressWarnings("unused")
FormEntrySession session = new FormEntrySession(HtmlFormEntryUtil.getFakePerson(), hf.getXmlData(), null); // can't access an HttpSession h... |
<vulnerable_code>
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.SystemUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openmrs.Patient;
log.debug("In reference data...");
model.addAttribut... |
<vulnerable_code> goto discard;
if (th->syn) {
if (icsk->icsk_af_ops->conn_request(sk, skb) < 0)
return 1;
<commit_title>[PATCH] tcp: drop SYN+FIN messages<commit_description>Denys Fedoryshchenko reported that SYN+FIN attacks were bringing his
linux machines to their limits.
Dont call conn_request() if the... |
<vulnerable_code> case AP4_ATOM_TYPE_HVCE:
if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;
atom = AP4_HvccAtom::Create(size_32, stream);
atom->SetType(AP4_ATOM_TYPE_HVCE);
break;
case AP4_ATOM_TYPE_AVCE:
if (atom_is_large) return AP4_ER... |
<vulnerable_code>}
EXPORT_SYMBOL(v4l_printk_ioctl);
/*
* helper function -- handles userspace copying for ioctl arguments
* Obsolete usercopy function - Should be removed soon
*/
long
video_usercopy(struct file *file, unsigned int cmd, unsigned long arg,
v4l2_kioctl func)
{
char sbuf[128];
void *mbuf = NULL;... |
<vulnerable_code>
if ((pdu_adv->type == PDU_ADV_TYPE_SCAN_REQ) &&
(pdu_adv->len == sizeof(struct pdu_adv_scan_req)) &&
isr_adv_sr_check(_pdu_adv, pdu_adv, devmatch_ok, &rl_idx)) {
#if defined(CONFIG_BT_CTLR_SCAN_REQ_NOTIFY)<commit_title>[PATCH] Bluetooth: controller: Fix scan request when advertising<commit... |
<vulnerable_code> pdu_adv = lll_adv_data_curr_get(lll);
if ((pdu_rx->type == PDU_ADV_TYPE_SCAN_REQ) &&
(pdu_rx->len == sizeof(struct pdu_adv_scan_req)) &&
isr_rx_sr_check(lll, pdu_adv, pdu_rx, devmatch_ok, &rl_idx)) {
radio_isr_set(isr_done, lll);
radio_switch_complete_and_disable();<commit_title>[PATCH]... |
<vulnerable_code> */
private static void processZipStream(File dir, InputStream inputStream) throws IOException
{
ZipInputStream zip = new ZipInputStream(inputStream);
while (true)
{
}
File file = new File(dir, entry.getName());
if (entry.isDirectory())
{
... |
<vulnerable_code>
var jSuites = function(options) {
var obj = {}
var version = '4.4.0';
var find = function(DOMElement, component) {
if (DOMElement[component.type] && DOMElement[component.type] == component) {
}
obj.addImage = function(src, asSnippet) {
if (src.substr(0,4) != 'data... |
<vulnerable_code> menu[i].classList.remove('selected');
if (menu[i].getAttribute('data-id')) {
var state = localStorage.getItem('jmenu-' + menu[i].getAttribute('data-id'));
if (state === null || state == 1) {
menu[i].classLis... |
<vulnerable_code>#include <tee/tee_cryp_pbkdf2.h>
#endif
typedef void (*tee_cryp_ctx_finalize_func_t) (void *ctx, uint32_t algo);
struct tee_cryp_state {
TAILQ_ENTRY(tee_cryp_state) link;
vaddr_t key2;
void *ctx;
tee_cryp_ctx_finalize_func_t ctx_finalize;
};
struct tee_cryp_obj_secret {
TAILQ_INSERT_TAIL(&utc->c... |
<vulnerable_code> if (ret) {
dev_err(s->dev, "Failed to register as video device (%d)\n",
ret);
goto err_unregister_v4l2_dev;
}
dev_info(s->dev, "Registered as %s\n",
video_device_node_name(&s->vdev));
err_free_controls:
v4l2_ctrl_handler_free(&s->hdl);
err_unregister_v4l2_dev:
v4l2_device_unregister(&s... |
<vulnerable_code>class TokenObtainPairView(jwt_views.TokenObtainPairView):
"""We overwrite this view to deal with password scheme update."""
def post(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.data)
try:
"""
An Api View which provides a method to requ... |
<vulnerable_code># Rest framework settings
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'modoboa.core.drf_authentication.JWTAuthenticationWith2FA',
'rest_framework.authentication.TokenAuthentication',<commit_title>[PATCH 01/14] Api throttling<commit_description><fixed_code>
# Rest framewo... |
<vulnerable_code>from rest_framework import (
filters, mixins, parsers, pagination, permissions, response, status, viewsets
)
from rest_framework.decorators import action
from rest_framework.exceptions import PermissionDenied
from modoboa.admin.api.v1 import viewsets as v1_viewsets
from modoboa.core import models ... |
<vulnerable_code>from rest_framework_simplejwt.exceptions import InvalidToken, TokenError
from rest_framework.views import APIView
from modoboa.core.password_hashers import get_password_hasher
from modoboa.core.utils import check_for_updates
from modoboa.parameters import tools as param_tools
class TokenObtainPairView... |
<vulnerable_code>from rest_framework.decorators import action
from modoboa.admin import models as admin_models
from . import serializers
"""A viewset to provide extra routes related to DNS information."""
permission_classes = (permissions.IsAuthenticated, )
def get_queryset(self):
"""Filter que... |
<vulnerable_code><commit_title>[PATCH 01/14] Api throttling<commit_description><fixed_code>
from rest_framework.throttling import UserRateThrottle, AnonRateThrottle
class UserDosThrottle(UserRateThrottle):
"""Custom Throttle class for rest_framework. The throttling is applied on a per view basis for authentificate... |
<vulnerable_code>
from modoboa.admin import models as admin_models
from modoboa.lib import pagination
from ... import models
from ... import signals
"""A viewset to provide extra route related to mail statistics."""
permission_classes = (permissions.IsAuthenticated, )
@extend_schema(
parameters=[... |
<vulnerable_code>from rest_framework import response, viewsets
from rest_framework.decorators import action
from . import serializers
from ... import tools
lookup_value_regex = r"\w+"
serializer_class = None
@extend_schema(responses=serializers.ApplicationSerializer(many=True))
@action(methods=["get... |
<vulnerable_code>from drf_spectacular.utils import extend_schema
from rest_framework import permissions, response, viewsets
from . import serializers
from ... import backends
"""Viewset for Transport."""
permissions = (permissions.IsAuthenticated, )
@extend_schema(
responses={200: serializers.Tr... |
<vulnerable_code>REST_FRAMEWORK = {
'DEFAULT_THROTTLE_CLASSES': [
'rest_framework.throttling.AnonRateThrottle',
'rest_framework.throttling.ScopedRateThrottle'
],
'DEFAULT_THROTTLE_RATES': {
'anon': '100/hour',
'login': '5/hour',
'password_recovery_request': '6/hour',
... |
<vulnerable_code>from rest_framework.throttling import UserRateThrottle, AnonRateThrottle
class UserDosThrottle(UserRateThrottle):
"""Custom Throttle class for rest_framework. The throttling is applied on a per view basis for authentificated users."""
scope = "ddos"
def get_cache_key(self, request, view)... |
<vulnerable_code> 'DEFAULT_THROTTLE_CLASSES': [
'rest_framework.throttling.AnonRateThrottle',
'rest_framework.throttling.ScopedRateThrottle',
'modoboa.lib.throttle.UserDosThrottle',
'modoboa.lib.throttle.AnonDosThrottle'
],
'DEFAULT_THROTTLE_RATES': {
'anon': '100/hour... |
<vulnerable_code> self.assertIn("password", resp.json())
def test_validate(self):
data = {"username": "toto@test.com"}
url = reverse("v2:account-validate")
resp = self.client.post(url, data, format="json")
self.assertEqual(resp.status_code, 204)
def test_random_password(... |
<vulnerable_code> ident = self.get_ident(request)
return self.cache_format % {
'scope': id(view),
'ident': ident
}<commit_title>[PATCH 01/14] Api throttling<commit_description><fixed_code>
ident = self.get_ident(request)
return self.cache_format %... |
<vulnerable_code> 'DEFAULT_THROTTLE_RATES': {
'anon': '100/hour',
'login': '3/minute',
'ddos': '100/minute',
'password_recovery_request': '6/hour',
'password_recovery_totp_check': '20/hour',
'password_recovery_apply': '20/hour'<commit_title>[PATCH 01/14] Api throttling... |
<vulnerable_code>from rest_framework import (
filters, mixins, parsers, pagination, permissions, response, status, viewsets
)
from rest_framework.decorators import action, throttle_classes
from rest_framework.exceptions import PermissionDenied
from modoboa.admin.api.v1 import viewsets as v1_viewsets
from modoboa.c... |
<vulnerable_code>from rest_framework import response, status
from rest_framework_simplejwt import views as jwt_views
from rest_framework_simplejwt.exceptions import InvalidToken, TokenError
from rest_framework.views import APIView
from modoboa.lib.throttle import UserDosThrottle
from modoboa.core.password_hashers impo... |
<vulnerable_code>from rest_framework.throttling import SimpleRateThrottle
class UserDosThrottle(SimpleRateThrottle):
"""Custom Throttle class for rest_framework. The throttling is applied on a per view basis for authentificated users."""
scope = "ddos"
ident = self.get_ident(request)
retu... |
<vulnerable_code>from drf_spectacular.utils import extend_schema
from rest_framework import permissions, response, viewsets
from modoboa.lib.throttle import UserDosThrottle
from . import serializers
from ... import backends
"""Viewset for Transport."""
permissions = (permissions.IsAuthenticated, )
thrott... |
<vulnerable_code># Rest framework settings
REST_FRAMEWORK = {
'DEFAULT_THROTTLE_CLASSES': [
'rest_framework.throttling.AnonRateThrottle',
'rest_framework.throttling.ScopedRateThrottle',
'modoboa.lib.throttle.UserDosThrottle'
],
'DEFAULT_THROTTLE_RATES': {
'anon': '100/hour',... |
<vulnerable_code>from rest_framework.exceptions import ParseError
from rest_framework.permissions import DjangoModelPermissions, IsAuthenticated
from rest_framework.response import Response
from modoboa.core import models as core_models
from modoboa.core import sms_backends
from modoboa.lib import renderers as lib_ren... |
<vulnerable_code>import django_otp
from django_otp.plugins.otp_static.models import StaticDevice, StaticToken
from django_otp.plugins.otp_totp.models import TOTPDevice
from rest_framework import permissions, response, viewsets
from rest_framework.decorators import action
from drf_spectacular.utils import extend_schema
... |
<vulnerable_code>from rest_framework import response, status
from rest_framework_simplejwt import views as jwt_views
from rest_framework_simplejwt.exceptions import InvalidToken, TokenError
from rest_framework.throttling import ScopedRateThrottle
from rest_framework.views import APIView
from modoboa.lib.throttle impor... |
<vulnerable_code>from rest_framework.authtoken.models import Token
from rest_framework.decorators import action
from rest_framework.exceptions import PermissionDenied
from rest_framework_simplejwt.tokens import RefreshToken
from modoboa.admin.api.v1 import serializers as admin_v1_serializers
queryset = models.Log.... |
<vulnerable_code>
from rest_framework import permissions, response, viewsets
from rest_framework.decorators import action
from modoboa.admin import models as admin_models
from modoboa.lib.throttle import UserDosThrottleViewset
from . import serializers
"""A viewset to provide extra routes related to DNS informat... |
<vulnerable_code>
from rest_framework import mixins, viewsets
from rest_framework.permissions import DjangoModelPermissions, IsAuthenticated
from modoboa.core import models as core_models
from . import serializers
permission_classes = [IsAuthenticated, DjangoModelPermissions]
serializer_class = serializers.... |
<vulnerable_code>
from drf_spectacular.utils import extend_schema
from rest_framework import filters, permissions, response, viewsets
from modoboa.admin import models as admin_models
from modoboa.lib import pagination
from modoboa.lib.throttle import UserDosThrottleViewset
from ... import models
from ... import signa... |
<vulnerable_code>from drf_spectacular.utils import extend_schema, OpenApiParameter
from rest_framework import response, viewsets
from rest_framework.decorators import action
from modoboa.lib.throttle import UserDosThrottleViewset
from . import serializers
from ... import tools
lookup_value_regex = r"\w+"
ser... |
<vulnerable_code>
from rest_framework import viewsets
from rest_framework.permissions import DjangoModelPermissions, IsAuthenticated
from modoboa.admin import models as admin_models
from modoboa.lib.viewsets import RevisionModelMixin
from . import serializers
permission_classes = [IsAuthenticated, DjangoModelPer... |
<vulnerable_code>
from drf_spectacular.utils import extend_schema
from rest_framework import permissions, response, viewsets
from modoboa.lib.throttle import UserDosThrottleViewset
from . import serializers
from ... import backends
"""Viewset for Transport."""
permissions = (permissions.IsAuthenticated, )
... |
<vulnerable_code>from modoboa.core import models as core_models
from modoboa.lib import renderers as lib_renderers
from modoboa.lib import viewsets as lib_viewsets
from modoboa.lib.throttle import UserDdosPerView
from ... import lib
from ... import models
permission_classes = (
permissions.IsAuthenticated,... |
<vulnerable_code>from rest_framework import response, status
from rest_framework_simplejwt import views as jwt_views
from rest_framework_simplejwt.exceptions import InvalidToken, TokenError
from rest_framework.throttling import ScopedRateThrottle, UserRateThrottle
from rest_framework.views import APIView
from modoboa.... |
<vulnerable_code>from modoboa.core.api.v1 import serializers as core_v1_serializers
from modoboa.core.api.v1 import viewsets as core_v1_viewsets
from modoboa.lib import pagination
from ... import constants
from ... import models
class AccountViewSet(core_v1_viewsets.AccountViewSet):
"""Account viewset."""
@ex... |
<vulnerable_code> 'scope': hash(f"{view.basename}_{view.name}"),
'ident': ident
}<commit_title>[PATCH 01/14] Api throttling<commit_description><fixed_code>
'scope': hash(f"{view.basename}_{view.name}"),
'ident': ident
}
class UserLesserDdosUser(SimpleRateT... |
<vulnerable_code>from rest_framework.throttling import UserRateThrottle
from modoboa.admin import models as admin_models
from modoboa.lib.throttle import UserDdosPerView
from modoboa.lib.viewsets import RevisionModelMixin
from . import serializers
permission_classes = [IsAuthenticated, DjangoModelPermissions, ]
... |
<vulnerable_code>
REST_FRAMEWORK = {
'DEFAULT_THROTTLE_RATES': {
'anon': '100/hour',
'login': '3/minute',
'ddos': '300/minute',
'password_recovery_request': '6/hour',
'password_recovery_totp_check': '20/hour',
'password_recovery_apply': '20/hour'
},
'DEFAULT_A... |
<vulnerable_code> url = reverse("v2:account-validate")
resp = self.client.post(url, data, format="json")
self.assertEqual(resp.status_code, 204)
for _ in range(500):
resp = self.client.post(url, data, format="json")
self.assertEqual(resp.status_code, 429)
def test... |
<vulnerable_code> ident = request.user.pk
else:
ident = self.get_ident(request)
return self.cache_format % {
'scope': hash(f"{view.basename}_{view.name}"),
'ident': ident
}
ident = request.user.pk
else:
ident = self... |
<vulnerable_code>from rest_framework.throttling import UserRateThrottle
from modoboa.core import models as core_models
from modoboa.lib.throttle import UserDdosPerView
from . import serializers
permission_classes = [IsAuthenticated, DjangoModelPermissions]
serializer_class = serializers.ResourcesSerializer
... |
<vulnerable_code>
permission_classes = [IsAuthenticated, DjangoModelPermissions, ]
serializer_class = serializers.RelayDomainSerializer
def get_throttles(self):
if self.action:
self.throttle_classes.append(UserLesserDdosUser)
return super().get_throttles()
def get_queryset... |
<vulnerable_code>
from modoboa.core.password_hashers import get_password_hasher
from modoboa.core.utils import check_for_updates
from modoboa.lib.throttle import UserLesserDdosUser
from modoboa.parameters import tools as param_tools
from smtplib import SMTPException
class TokenObtainPairView(jwt_views.TokenObtainPairV... |
<vulnerable_code>class AccountViewSet(core_v1_viewsets.AccountViewSet):
"""Account viewset."""
def get_throttles(self):
if self.action in ['me']:
self.throttle_classes.append(UserLesserDdosUser)
return super().get_throttles()
<commit_title>[PATCH 01/14] Api throttling<commit_descri... |
<vulnerable_code>from rest_framework.throttling import SimpleRateThrottle
class UserDdosPerView(SimpleRateThrottle):
"""Custom Throttle class for rest_framework. The throttling is applied on a per view basis for authentificated users."""
else:
ident = self.get_ident(request)
return self... |
<vulnerable_code> }
class LoginThrottle(SimpleRateThrottle):
scope = 'login'
<commit_title>[PATCH 01/14] Api throttling<commit_description><fixed_code>
}
class LoginThrottle(SimpleRateThrottle):
""" Custom throttle to reset the cache counter on success. """
scope = 'login'
|
<vulnerable_code>
import router from '../router'
import store from '../store'
const _axios = axios.create()
router.push({ name: 'TwoFA' })
return Promise.reject(error)
}
if (error.response.status !== 401 || router.currentRoute.path === '/login/') {
return Promise.reject(error)
}<commit_t... |
<vulnerable_code>from modoboa.core import sms_backends
from modoboa.lib import renderers as lib_renderers
from modoboa.lib import viewsets as lib_viewsets
from modoboa.lib.throttle import UserDdosPerView
from ... import lib, models
from . import serializers
summary="Create a new domain"
)
)
class DomainVie... |
<vulnerable_code>from modoboa.core import models as core_models
from modoboa.lib import renderers as lib_renderers
from modoboa.lib import viewsets as lib_viewsets
from modoboa.lib.throttle import UserDdosPerView, UserLesserDdosUser
from ... import lib
from ... import models
summary="Delete a particular domain... |
<vulnerable_code>
from drf_spectacular.utils import extend_schema
from modoboa.lib.throttle import UserDdosPerView
from . import serializers
class AccountViewSet(viewsets.ViewSet):
"""Account viewset.
Contains endpoints used to manipulate current user's account.
permission_classes = (permissions.IsAut... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.