code stringlengths 12 2.05k | label_name stringlengths 6 8 | label int64 0 95 |
|---|---|---|
def prepare_context(self, request, context, *args, **kwargs):
""" Hook for adding additional data to the context dict """
pass | CWE-601 | 11 |
def test_login_inactive_user(self):
self.user.is_active = False
self.user.save()
login_code = LoginCode.objects.create(user=self.user, code='foobar')
response = self.client.post('/accounts-rest/login/code/', {
'code': login_code.code,
})
self.assertEqua... | CWE-312 | 71 |
def create(request, comment_id):
comment = get_object_or_404(Comment, pk=comment_id)
form = FlagForm(
user=request.user,
comment=comment,
data=post_data(request))
if is_post(request) and form.is_valid():
form.save()
return redirect(request.POST.get('next', comment.ge... | CWE-601 | 11 |
def async_run(prog, args):
pid = os.fork()
if pid:
os.waitpid(pid, 0)
else:
dpid = os.fork()
if not dpid:
os.system(" ".join([prog] + args))
os._exit(0) | CWE-78 | 6 |
def _hkey(s):
return s.title().replace('_', '-') | CWE-93 | 33 |
def make_homeserver(self, reactor, clock):
hs = self.setup_test_homeserver(
http_client=None, homeserver_to_use=GenericWorkerServer
)
return hs | CWE-601 | 11 |
def test_spinal_case():
assert utils.spinal_case("keep_alive") == "keep-alive" | CWE-22 | 2 |
def testInputParserBothDuplicate(self):
x0 = np.array([[1], [2]])
input_path = os.path.join(test.get_temp_dir(), 'input.npz')
np.savez(input_path, a=x0)
x1 = np.ones([2, 10])
input_str = 'x0=' + input_path + '[a]'
input_expr_str = 'x0=np.ones([2,10])'
feed_dict = saved_model_cli.load_input... | CWE-94 | 14 |
def test_parse_header_11_expect_continue(self):
data = b"GET /foobar HTTP/1.1\nexpect: 100-continue"
self.parser.parse_header(data)
self.assertEqual(self.parser.expect_continue, True) | CWE-444 | 41 |
def job_list(request, client_id, project_name):
"""
get job list of project from one client
:param request: request object
:param client_id: client id
:param project_name: project name
:return: list of jobs
"""
if request.method == 'GET':
client = Client.objects.get(id=client_id)... | CWE-78 | 6 |
def _keyify(key):
return _key_pattern.sub(' ', key.lower()) | CWE-79 | 1 |
def _get_object_element(dataset, seq_no, rel_path, download_link):
"""If rel_path and download_link are not None, we are called from scope.
Otherwise we are called from ID and need to run SQL query to fetch these attrs."""
if rel_path is None:
query = "SELECT rel_path, download_link FROM " + \
... | CWE-22 | 2 |
def vote(request, pk):
# TODO: check if user has access to this topic/poll
poll = get_object_or_404(
CommentPoll.objects.unremoved(),
pk=pk
)
if not request.user.is_authenticated:
return redirect_to_login(next=poll.get_absolute_url())
form = PollVoteManyForm(user=request.us... | CWE-601 | 11 |
def ratings_list():
if current_user.check_visibility(constants.SIDEBAR_RATING):
if current_user.get_view_property('ratings', 'dir') == 'desc':
order = db.Ratings.rating.desc()
order_no = 0
else:
order = db.Ratings.rating.asc()
order_no = 1
entr... | CWE-918 | 16 |
def feed_authorindex():
shift = 0
off = int(request.args.get("offset") or 0)
entries = calibre_db.session.query(func.upper(func.substr(db.Authors.sort, 1, 1)).label('id'))\
.join(db.books_authors_link).join(db.Books).filter(calibre_db.common_filters())\
.group_by(func.upper(func.substr(db.Au... | CWE-918 | 16 |
def validate_and_sanitize_search_inputs(fn, instance, args, kwargs):
kwargs.update(dict(zip(fn.__code__.co_varnames, args)))
sanitize_searchfield(kwargs['searchfield'])
kwargs['start'] = cint(kwargs['start'])
kwargs['page_len'] = cint(kwargs['page_len'])
if kwargs['doctype'] and not frappe.db.exists('DocType', kw... | CWE-79 | 1 |
def _get_index_absolute_path(index):
return os.path.join(INDEXDIR, index) | CWE-22 | 2 |
def format_errormsg(message: str) -> str:
"""Match account names in error messages and insert HTML links for them."""
match = re.search(ACCOUNT_RE, message)
if not match:
return message
account = match.group()
url = flask.url_for("account", name=account)
return (
message.replace(... | CWE-79 | 1 |
def home_get_dat():
d = db.sentences_stats('get_data')
n = db.sentences_stats('all_networks')
('clean_online')
rows = db.sentences_stats('get_clicks')
c = rows[0][0]
rows = db.sentences_stats('get_sessions')
s = rows[0][0]
rows = db.sentences_stats('get_online')
o = rows[0][0]
... | CWE-89 | 0 |
def __new__(cls, sourceName: str):
"""Dispatches to the right subclass."""
if cls != InputSource:
# Only take control of calls to InputSource(...) itself.
return super().__new__(cls)
if sourceName == "-":
return StdinInputSource(sourceName)
if sou... | CWE-78 | 6 |
def testSizeAndClear(self):
with ops.Graph().as_default() as G:
with ops.device('/cpu:0'):
x = array_ops.placeholder(dtypes.float32, name='x')
pi = array_ops.placeholder(dtypes.int64)
gi = array_ops.placeholder(dtypes.int64)
v = 2. * (array_ops.zeros([128, 128]) + x)
wi... | CWE-843 | 43 |
def job_browse(job_id: int, path):
"""
Browse directory of the job.
:param job_id: int
:param path: str
"""
try:
# Query job information
job_info = query_internal_api(f"/internal/jobs/{job_id}", "get")
# Base directory of the job
job_base_dir = os.path.dirname(o... | CWE-22 | 2 |
def test___post_init__(self):
from openapi_python_client.parser.properties import StringProperty
sp = StringProperty(name="test", required=True, default="A Default Value",)
assert sp.default == '"A Default Value"' | CWE-94 | 14 |
async def actset(self, ctx):
"""
Configure various settings for the act cog.
"""
| CWE-502 | 15 |
def get_list(an_enum_value: List[AnEnum] = Query(...), some_date: Union[date, datetime] = Query(...)):
""" Get a list of things """
return | CWE-94 | 14 |
def test_request_body_too_large_with_wrong_cl_http11(self):
body = "a" * self.toobig
to_send = "GET / HTTP/1.1\n" "Content-Length: 5\n\n"
to_send += body
to_send = tobytes(to_send)
self.connect()
self.sock.send(to_send)
fp = self.sock.makefile("rb")
# ... | CWE-444 | 41 |
def test_parse_header_bad_content_length(self):
data = b"GET /foobar HTTP/8.4\r\ncontent-length: abc\r\n"
self.parser.parse_header(data)
self.assertEqual(self.parser.body_rcv, None) | CWE-444 | 41 |
def profile():
languages = calibre_db.speaking_language()
translations = babel.list_translations() + [LC('en')]
kobo_support = feature_support['kobo'] and config.config_kobo_sync
if feature_support['oauth'] and config.config_login_type == 2:
oauth_status = get_oauth_status()
local_oauth_... | CWE-918 | 16 |
def remove_auth_hashes(input: Optional[str]):
if not input:
return input
# If there are no hashes, skip the RE for performance.
if not any([pw_hash in input for pw_hash in PASSWORD_HASHERS_ALL.keys()]):
return input
return re_remove_passwords.sub(r'\1 %s # Filtered for security' % PASSW... | CWE-212 | 66 |
def test_keepalive_http_11(self):
# Handling of Keep-Alive within HTTP 1.1
# All connections are kept alive, unless stated otherwise
data = "Default: Keep me alive"
s = tobytes(
"GET / HTTP/1.1\n" "Content-Length: %d\n" "\n" "%s" % (len(data), data)
)
sel... | CWE-444 | 41 |
def __init__(self, *, openapi: GeneratorData) -> None:
self.openapi: GeneratorData = openapi
self.env: Environment = Environment(loader=PackageLoader(__package__), trim_blocks=True, lstrip_blocks=True)
self.project_name: str = self.project_name_override or f"{openapi.title.replace(' ', '-')... | CWE-22 | 2 |
def testPartialIndexGets(self):
with ops.Graph().as_default() as G:
with ops.device('/cpu:0'):
x = array_ops.placeholder(dtypes.float32)
f = array_ops.placeholder(dtypes.float32)
v = array_ops.placeholder(dtypes.float32)
pi = array_ops.placeholder(dtypes.int64)
pei = ... | CWE-843 | 43 |
async def on_message(self, message):
if message.author.bot:
return
ctx = await self.bot.get_context(message)
if ctx.prefix is None or not ctx.invoked_with.replace("_", "").isalpha():
return
if ctx.valid and ctx.command.enabled:
try:
... | CWE-502 | 15 |
def test_notfilelike_http11(self):
to_send = "GET /notfilelike HTTP/1.1\n\n"
to_send = tobytes(to_send)
self.connect()
for t in range(0, 2):
self.sock.send(to_send)
fp = self.sock.makefile("rb", 0)
line, headers, response_body = read_http(fp)
... | CWE-444 | 41 |
def publish(request, user_id=None):
initial = None
if user_id: # todo: move to form
user_to = get_object_or_404(User, pk=user_id)
initial = {'users': [user_to.st.nickname]}
user = request.user
tform = TopicForPrivateForm(
user=user, data=post_data(request))
cform = CommentF... | CWE-601 | 11 |
def _decompress(compressed_path: Text, target_path: Text) -> None:
with tarfile.open(compressed_path, "r:gz") as tar:
tar.extractall(target_path) # target dir will be created if it not exists | CWE-22 | 2 |
def render(self, name, value, attrs=None):
html = super(AdminURLFieldWidget, self).render(name, value, attrs)
if value:
value = force_text(self._format_value(value))
final_attrs = {'href': mark_safe(smart_urlquote(value))}
html = format_html(
'<p c... | CWE-79 | 1 |
def POST(self, path, body=None, ensure_encoding=True, log_request_body=True):
return self._request('POST', path, body=body, ensure_encoding=ensure_encoding,
log_request_body=log_request_body) | CWE-295 | 52 |
def sql_execute(self, sentence):
self.cursor.execute(sentence)
return self.cursor.fetchall() | CWE-79 | 1 |
def decompile(self):
self.writeln("** Decompiling APK...", clr.OKBLUE)
with ZipFile(self.file) as zipped:
try:
dex = self.tempdir + "/" + self.apk.package + ".dex"
with open(dex, "wb") as classes:
classes.write(zipped.read("classes.dex"))
except Exception as e:
sys.exit(self.writeln(str(e), ... | CWE-88 | 3 |
def login():
from flask_login import current_user
redirect_url = request.args.get("redirect", request.script_root + url_for("index"))
permissions = sorted(
filter(
lambda x: x is not None and isinstance(x, OctoPrintPermission),
map(
lambda x: getattr(Permissi... | CWE-79 | 1 |
def feed_booksindex():
shift = 0
off = int(request.args.get("offset") or 0)
entries = calibre_db.session.query(func.upper(func.substr(db.Books.sort, 1, 1)).label('id'))\
.filter(calibre_db.common_filters()).group_by(func.upper(func.substr(db.Books.sort, 1, 1))).all()
elements = []
if off ==... | CWE-918 | 16 |
def get_install_extras_require():
extras_require = {
'action': ['chevron'],
'browser': ['zeroconf==0.19.1' if PY2 else 'zeroconf>=0.19.1'],
'cloud': ['requests'],
'docker': ['docker>=2.0.0'],
'export': ['bernhard', 'cassandra-driver', 'couchdb', 'elasticsearch',
... | CWE-611 | 13 |
def file(path):
path = secure_filename(path)
if app.interface.encrypt and isinstance(app.interface.examples, str) and path.startswith(app.interface.examples):
with open(os.path.join(app.cwd, path), "rb") as encrypted_file:
encrypted_data = encrypted_file.read()
file_data = encryptor.... | CWE-22 | 2 |
def update_server_key(conf):
"""
Download the server's RSA key and store in the location
specified in the configuration.
:param conf: The consumer configuration object.
:type conf: dict
"""
host = conf['server']['host']
location = conf['server']['rsa_pub']
url = 'https://%s/pulp/stat... | CWE-295 | 52 |
def test_keepalive_http11_connclose(self):
# specifying Connection: close explicitly
data = "Don't keep me alive"
s = tobytes(
"GET / HTTP/1.1\n"
"Connection: close\n"
"Content-Length: %d\n"
"\n"
"%s" % (len(data), data)
)
... | CWE-444 | 41 |
def traverse(cls, base, request, path_items):
"""See ``zope.app.pagetemplate.engine``."""
path_items = list(path_items)
path_items.reverse()
while path_items:
name = path_items.pop()
if name == '_':
warnings.warn('Traversing to the name `_` ... | CWE-22 | 2 |
def get_install_requires():
requires = ['psutil>=5.3.0', 'future']
if sys.platform.startswith('win'):
requires.append('bottle')
requires.append('requests')
return requires | CWE-611 | 13 |
def test_module(self):
body = [ast.Num(42)]
x = ast.Module(body)
self.assertEqual(x.body, body) | CWE-125 | 47 |
def make_homeserver(self, reactor, clock):
self.hs = self.setup_test_homeserver(
"red", http_client=None, federation_client=Mock(),
)
self.hs.get_federation_handler = Mock()
self.hs.get_federation_handler.return_value.maybe_backfill = Mock(
return_value=make... | CWE-601 | 11 |
def get_absolute_path(path):
import os
script_dir = os.path.dirname(__file__) # <-- absolute dir the script is in
rel_path = path
abs_file_path = os.path.join(script_dir, rel_path)
return abs_file_path | CWE-22 | 2 |
def _get_obj_absolute_path(obj_path):
return os.path.join(DATAROOT, obj_path) | CWE-22 | 2 |
def makeTrustRoot(self):
# If this option is specified, use a specific root CA cert. This is useful for testing when it's not
# practical to get the client cert signed by a real root CA but should never be used on a production server.
caCertFilename = self.sydent.cfg.get('http', 'replication... | CWE-770 | 37 |
def stmt(self, stmt, msg=None):
mod = ast.Module([stmt])
self.mod(mod, msg) | CWE-125 | 47 |
def test_get_header_lines_tabbed(self):
result = self._callFUT(b"slam\n\tslim")
self.assertEqual(result, [b"slam\tslim"]) | CWE-444 | 41 |
def make_homeserver(self, reactor, clock):
hs = self.setup_test_homeserver(http_client=None)
self.handler = hs.get_federation_handler()
self.store = hs.get_datastore()
return hs | CWE-601 | 11 |
def test_bind_invalid_entry(topology_st):
"""Test the failing bind does not return information about the entry
:id: 5cd9b083-eea6-426b-84ca-83c26fc49a6f
:customerscenario: True
:setup: Standalone instance
:steps:
1: bind as non existing entry
2: check that bind info does not report 'No s... | CWE-203 | 38 |
def test_expect_continue(self):
# specifying Connection: close explicitly
data = "I have expectations"
to_send = tobytes(
"GET / HTTP/1.1\n"
"Connection: close\n"
"Content-Length: %d\n"
"Expect: 100-continue\n"
"\n"
"%s"... | CWE-444 | 41 |
def update(request, pk):
notification = get_object_or_404(TopicNotification, pk=pk, user=request.user)
form = NotificationForm(data=request.POST, instance=notification)
if form.is_valid():
form.save()
else:
messages.error(request, utils.render_form_errors(form))
return redirect(req... | CWE-601 | 11 |
def feed_get_cover(book_id):
return get_book_cover(book_id) | CWE-918 | 16 |
def get_field_options(self, field):
options = {}
options['label'] = field.label
options['help_text'] = field.help_text
options['required'] = field.required
options['initial'] = field.default_value
return options | CWE-79 | 1 |
def _cbrt(x):
return math.pow(x, 1.0/3) | CWE-94 | 14 |
def pref_set(key, value):
if get_user() is None:
return "Authentication required", 401
get_preferences()[key] = (None if value == 'null' else value)
return Response(json.dumps({'key': key, 'success': ''})), 201 | CWE-79 | 1 |
def _deny_hook(self, resource=None):
app = self.get_app()
if current_user.is_authenticated():
status = 403
else:
status = 401
#abort(status)
if app.config.get('FRONTED_BY_NGINX'):
url = "https://{}:{}{}".format(app.config.get('FQDN'), ... | CWE-601 | 11 |
def another_upload_file(request):
path = tempfile.mkdtemp()
file_name = os.path.join(path, "another_%s.txt" % request.node.name)
with open(file_name, "w") as f:
f.write(request.node.name)
return file_name | CWE-22 | 2 |
def test_received_preq_completed_n_lt_data(self):
inst, sock, map = self._makeOneWithMap()
inst.server = DummyServer()
preq = DummyParser()
inst.request = preq
preq.completed = True
preq.empty = False
line = b"GET / HTTP/1.1\n\n"
preq.retval = len(line... | CWE-444 | 41 |
def testDictionary(self):
with ops.Graph().as_default() as G:
with ops.device('/cpu:0'):
x = array_ops.placeholder(dtypes.float32)
pi = array_ops.placeholder(dtypes.int64)
gi = array_ops.placeholder(dtypes.int64)
v = 2. * (array_ops.zeros([128, 128]) + x)
with ops.devic... | CWE-843 | 43 |
def check_auth(username, password):
try:
username = username.encode('windows-1252')
except UnicodeEncodeError:
username = username.encode('utf-8')
user = ub.session.query(ub.User).filter(func.lower(ub.User.name) ==
username.decode('utf-8').lower())... | CWE-918 | 16 |
def boboAwareZopeTraverse(object, path_items, econtext):
"""Traverses a sequence of names, first trying attributes then items.
This uses zope.traversing path traversal where possible and interacts
correctly with objects providing OFS.interface.ITraversable when
necessary (bobo-awareness).
"""
r... | CWE-22 | 2 |
def test_invalid_identitifer(self):
m = ast.Module([ast.Expr(ast.Name(42, ast.Load()))])
ast.fix_missing_locations(m)
with self.assertRaises(TypeError) as cm:
compile(m, "<test>", "exec")
self.assertIn("identifier must be of type str", str(cm.exception)) | CWE-125 | 47 |
def receivePing():
vrequest = request.form['id']
db.sentences_victim('report_online', [vrequest])
return json.dumps({'status' : 'OK', 'vId' : vrequest}); | CWE-89 | 0 |
def mysql_contains(field: Field, value: str) -> Criterion:
return functions.Cast(field, SqlTypes.CHAR).like(f"%{value}%") | CWE-89 | 0 |
def test_datetime_parsing(value, result):
if result == errors.DateTimeError:
with pytest.raises(errors.DateTimeError):
parse_datetime(value)
else:
assert parse_datetime(value) == result | CWE-835 | 42 |
def delete_book_gdrive(book, book_format):
error = None
if book_format:
name = ''
for entry in book.data:
if entry.format.upper() == book_format:
name = entry.name + '.' + book_format
gFile = gd.getFileFromEbooksFolder(book.path, name)
else:
gFile ... | CWE-918 | 16 |
def get_cms_details(url):
# this function will fetch cms details using cms_detector
response = {}
cms_detector_command = 'python3 /usr/src/github/CMSeeK/cmseek.py -u {} --random-agent --batch --follow-redirect'.format(url)
os.system(cms_detector_command)
response['status'] = False
response['mes... | CWE-78 | 6 |
def testDuplicateHeaders(self):
# Ensure that headers with the same key get concatenated as per
# RFC2616.
data = b"""\
GET /foobar HTTP/8.4
x-forwarded-for: 10.11.12.13
x-forwarded-for: unknown,127.0.0.1
X-Forwarded_for: 255.255.255.255
content-length: 7
Hello.
"""
self.feed(data)
... | CWE-444 | 41 |
def test_login_inactive_user(self):
self.user.is_active = False
self.user.save()
login_code = LoginCode.objects.create(user=self.user, code='foobar')
response = self.client.post('/accounts/login/code/', {
'code': login_code.code,
})
self.assertEqual(res... | CWE-312 | 71 |
def _inject_admin_password_into_fs(admin_passwd, fs, execute=None):
"""Set the root password to admin_passwd
admin_password is a root password
fs is the path to the base of the filesystem into which to inject
the key.
This method modifies the instance filesystem directly,
and does not require ... | CWE-22 | 2 |
def edit_all_cc_data(book_id, book, to_save):
cc = calibre_db.session.query(db.Custom_Columns).filter(db.Custom_Columns.datatype.notin_(db.cc_exceptions)).all()
return edit_cc_data(book_id, book, to_save, cc) | CWE-918 | 16 |
def create_book_on_upload(modif_date, meta):
title = meta.title
authr = meta.author
sort_authors, input_authors, db_author, renamed_authors = prepare_authors_on_upload(title, authr)
title_dir = helper.get_valid_filename(title, chars=96)
author_dir = helper.get_valid_filename(db_author.name, chars=9... | CWE-918 | 16 |
public static void zipFolder(String srcFolder, String destZipFile, String ignore) throws Exception {
try (FileOutputStream fileWriter = new FileOutputStream(destZipFile);
ZipOutputStream zip = new ZipOutputStream(fileWriter)){
addFolderToZip("", srcFolder, zip, ignore);
... | CWE-22 | 2 |
public void install(
String displayName, String description, String[] dependencies,
String account, String password, String config) throws URISyntaxException {
String javaHome = System.getProperty("java.home");
String javaBinary = javaHome + "\\bin\\java.exe";
File ... | CWE-428 | 77 |
public PersistedMapper persistMapper(String sessionId, String mapperId, Serializable mapper, int expirationTime) {
PersistedMapper m = new PersistedMapper();
m.setMapperId(mapperId);
Date currentDate = new Date();
m.setLastModified(currentDate);
if(expirationTime > 0) {
Calendar cal = Calendar.getInstance... | CWE-91 | 78 |
public Document read(File file) throws DocumentException {
try {
/*
* We cannot convert the file to an URL because if the filename
* contains '#' characters, there will be problems with the URL in
* the InputSource (because a URL like
* http://... | CWE-611 | 13 |
public void configure(ServletContextHandler context) {
context.setContextPath("/");
context.getSessionHandler().setMaxInactiveInterval(serverConfig.getSessionTimeout());
context.setInitParameter(EnvironmentLoader.ENVIRONMENT_CLASS_PARAM, DefaultWebEnvironment.class.getName());
context.addEventListener(ne... | CWE-502 | 15 |
public Controller execute(FolderComponent folderComponent, UserRequest ureq, WindowControl wControl, Translator trans) {
VFSContainer currentContainer = folderComponent.getCurrentContainer();
status = FolderCommandHelper.sanityCheck(wControl, folderComponent);
if(status == FolderCommandStatus.STATUS_FAILED) {
... | CWE-22 | 2 |
public static void initializeSsl() {
try {
SSLContext sc = SSLContext.getInstance(SSL);
sc.init(null, trustAllCerts, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
} catch (NoSuchAlgorithmException | KeyMan... | CWE-306 | 79 |
private Style getStyleState() {
return StyleSignatureBasic.of(SName.root, SName.element, SName.stateDiagram, SName.state).withTOBECHANGED(group.getStereotype())
.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
} | CWE-918 | 16 |
void requestResetPassword() throws Exception
{
when(this.authorizationManager.hasAccess(Right.PROGRAM)).thenReturn(true);
UserReference userReference = mock(UserReference.class);
ResetPasswordRequestResponse requestResponse = mock(ResetPasswordRequestResponse.class);
when(this.re... | CWE-640 | 20 |
public int decryptWithAd(byte[] ad, byte[] ciphertext,
int ciphertextOffset, byte[] plaintext, int plaintextOffset,
int length) throws ShortBufferException, BadPaddingException {
int space;
if (ciphertextOffset > ciphertext.length)
space = 0;
else
space = ciphertext.length - ciphertextOffset;
if (l... | CWE-787 | 24 |
public boolean updateConfiguration(String mapperId, Serializable mapper, int expirationTime) {
String configuration = XStreamHelper.createXStreamInstance().toXML(mapper);
Date currentDate = new Date();
Date expirationDate = null;
if(expirationTime > 0) {
Calendar cal = Calendar.getInstance();
cal.setTime... | CWE-91 | 78 |
public void setMergeAdjacentText(boolean mergeAdjacentText) {
this.mergeAdjacentText = mergeAdjacentText;
} | CWE-611 | 13 |
void shouldNotDecodeSlash() {
final PathAndQuery res = PathAndQuery.parse("%2F?%2F");
// Do not accept a relative path.
assertThat(res).isNull();
final PathAndQuery res1 = PathAndQuery.parse("/%2F?%2F");
assertThat(res1).isNotNull();
assertThat(res1.path()).isEqualTo(... | CWE-22 | 2 |
private void securityCheck(String filename) {
Assert.doesNotContain(filename, "..");
} | CWE-22 | 2 |
public static XStream createXStreamInstanceForDBObjects() {
return new EnhancedXStream(true);
} | CWE-91 | 78 |
public InternetAddress requestResetPassword(UserReference user) throws ResetPasswordException
{
if (this.authorizationManager.hasAccess(Right.PROGRAM)) {
ResetPasswordRequestResponse resetPasswordRequestResponse =
this.resetPasswordManager.requestResetPassword(user);
... | CWE-640 | 20 |
public void testCycle_ECDH_ES_Curve_P256_attackPoint1()
throws Exception {
ECKey ecJWK = generateECJWK(ECKey.Curve.P_256);
BigInteger privateReceiverKey = ecJWK.toECPrivateKey().getS();
JWEHeader header = new JWEHeader.Builder(JWEAlgorithm.ECDH_ES,
EncryptionMethod.A128GCM)
.agreementPartyUInfo(... | CWE-347 | 25 |
private boolean isFileWithinDirectory(
final File dir,
final File file
) throws IOException {
final File dir_ = dir.getAbsoluteFile();
if (dir_.isDirectory()) {
final File fl = new File(dir_, file.getPath());
if (fl.isFile()) {
if (... | CWE-22 | 2 |
public SAXReader(String xmlReaderClassName) throws SAXException {
if (xmlReaderClassName != null) {
this.xmlReader = XMLReaderFactory
.createXMLReader(xmlReaderClassName);
}
} | CWE-611 | 13 |
public boolean isIncludeExternalDTDDeclarations() {
return includeExternalDTDDeclarations;
} | CWE-611 | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.