code
stringlengths
14
2.05k
label
int64
0
1
programming_language
stringclasses
7 values
cwe_id
stringlengths
6
14
cwe_name
stringlengths
5
98
description
stringlengths
36
379
url
stringlengths
36
48
label_name
stringclasses
2 values
def __init__(self, config, md): """Initialize.""" base = config.get('base_path') if isinstance(base, str): base = [base] self.base_path = base self.encoding = config.get('encoding') self.check_paths = config.get('check_paths') self.auto_a...
0
Python
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the...
https://cwe.mitre.org/data/definitions/22.html
vulnerable
def get_snippet_path(self, path): """Get snippet path.""" snippet = None for base in self.base_path: if os.path.exists(base): if os.path.isdir(base): filename = os.path.join(base, path) if os.path.exists(filename): ...
0
Python
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the...
https://cwe.mitre.org/data/definitions/22.html
vulnerable
def rebuild_proxies(self, prepared_request, proxies): """This method re-evaluates the proxy configuration by considering the environment variables. If we are redirected to a URL covered by NO_PROXY, we strip the proxy configuration. Otherwise, we set missing proxy keys for this URL (...
0
Python
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
def confirm_sns_subscription(notification): logger.info( 'Received subscription confirmation: TopicArn: %s', notification.get('TopicArn'), extra={ 'notification': notification, }, ) # Get the subscribe url and hit the url to confirm the subscription. subscrib...
0
Python
CWE-347
Improper Verification of Cryptographic Signature
The product does not verify, or incorrectly verifies, the cryptographic signature for data.
https://cwe.mitre.org/data/definitions/347.html
vulnerable
def _get_bytes_to_sign(self): """ Creates the message used for signing SNS notifications. This is used to verify the bounce message when it is received. """ # Depending on the message type the fields to add to the message # differ so we handle that here. msg_...
0
Python
CWE-347
Improper Verification of Cryptographic Signature
The product does not verify, or incorrectly verifies, the cryptographic signature for data.
https://cwe.mitre.org/data/definitions/347.html
vulnerable
def BounceMessageVerifier(*args, **kwargs): warnings.warn( 'utils.BounceMessageVerifier is deprecated. It is renamed to EventMessageVerifier.', RemovedInDjangoSES20Warning, ) # parameter name is renamed from bounce_dict to notification. if 'bounce_dict' in kwargs: kwargs['notifi...
0
Python
CWE-347
Improper Verification of Cryptographic Signature
The product does not verify, or incorrectly verifies, the cryptographic signature for data.
https://cwe.mitre.org/data/definitions/347.html
vulnerable
def verify_bounce_message(msg): """ Verify an SES/SNS bounce(event) notification message. """ warnings.warn( 'utils.verify_bounce_message is deprecated. It is renamed to verify_event_message.', RemovedInDjangoSES20Warning, ) return verify_event_message(msg)
0
Python
CWE-347
Improper Verification of Cryptographic Signature
The product does not verify, or incorrectly verifies, the cryptographic signature for data.
https://cwe.mitre.org/data/definitions/347.html
vulnerable
def get_keys(self, lst): """ return a list of pk values from object list """ pk_name = self.get_pk_name() if self.is_pk_composite(): return [[getattr(item, pk) for pk in pk_name] for item in lst] else: return [getattr(item, pk_name) for ite...
0
Python
CWE-209
Generation of Error Message Containing Sensitive Information
The product generates an error message that includes sensitive information about its environment, users, or associated data.
https://cwe.mitre.org/data/definitions/209.html
vulnerable
def get_user_columns_list(self): """ Returns a list of user viewable columns names """ return self.get_columns_list()
0
Python
CWE-209
Generation of Error Message Containing Sensitive Information
The product generates an error message that includes sensitive information about its environment, users, or associated data.
https://cwe.mitre.org/data/definitions/209.html
vulnerable
def get_columns_list(self): """ Returns a list of all the columns names """ return []
0
Python
CWE-209
Generation of Error Message Containing Sensitive Information
The product generates an error message that includes sensitive information about its environment, users, or associated data.
https://cwe.mitre.org/data/definitions/209.html
vulnerable
def get(self, pk, filter=None): """ return the record from key, you can optionally pass filters if pk exits on the db but filters exclude it it will return none. """ pass
0
Python
CWE-209
Generation of Error Message Containing Sensitive Information
The product generates an error message that includes sensitive information about its environment, users, or associated data.
https://cwe.mitre.org/data/definitions/209.html
vulnerable
def get_values_json(self, lst, list_columns): """ Converts list of objects from query to JSON """ result = [] for item in self.get_values(lst, list_columns): for key, value in list(item.items()): if isinstance(value, datetime.datetime) or isins...
0
Python
CWE-209
Generation of Error Message Containing Sensitive Information
The product generates an error message that includes sensitive information about its environment, users, or associated data.
https://cwe.mitre.org/data/definitions/209.html
vulnerable
def add(self, item): """ Adds object """ raise NotImplementedError
0
Python
CWE-209
Generation of Error Message Containing Sensitive Information
The product generates an error message that includes sensitive information about its environment, users, or associated data.
https://cwe.mitre.org/data/definitions/209.html
vulnerable
def get_search_columns_list(self): """ Returns a list of searchable columns names """ return []
0
Python
CWE-209
Generation of Error Message Containing Sensitive Information
The product generates an error message that includes sensitive information about its environment, users, or associated data.
https://cwe.mitre.org/data/definitions/209.html
vulnerable
def get_order_columns_list(self, list_columns=None): """ Returns a list of order columns names """ return []
0
Python
CWE-209
Generation of Error Message Containing Sensitive Information
The product generates an error message that includes sensitive information about its environment, users, or associated data.
https://cwe.mitre.org/data/definitions/209.html
vulnerable
def edit(self, item): """ Edit (change) object """ raise NotImplementedError
0
Python
CWE-209
Generation of Error Message Containing Sensitive Information
The product generates an error message that includes sensitive information about its environment, users, or associated data.
https://cwe.mitre.org/data/definitions/209.html
vulnerable
def get_pk_name(self): """ Returns the primary key name """ raise NotImplementedError
0
Python
CWE-209
Generation of Error Message Containing Sensitive Information
The product generates an error message that includes sensitive information about its environment, users, or associated data.
https://cwe.mitre.org/data/definitions/209.html
vulnerable
def get_values(self, lst, list_columns): """ Get Values: formats values for list template. returns [{'col_name':'col_value',....},{'col_name':'col_value',....}] :param lst: The list of item objects from query :param list_columns: ...
0
Python
CWE-209
Generation of Error Message Containing Sensitive Information
The product generates an error message that includes sensitive information about its environment, users, or associated data.
https://cwe.mitre.org/data/definitions/209.html
vulnerable
def get_related_interface(self, col_name): """ Returns a BaseInterface for the related model of column name. :param col_name: Column name with relation :return: BaseInterface """ raise NotImplementedError
0
Python
CWE-209
Generation of Error Message Containing Sensitive Information
The product generates an error message that includes sensitive information about its environment, users, or associated data.
https://cwe.mitre.org/data/definitions/209.html
vulnerable
def _get_values(self, lst, list_columns): """ Get Values: formats values for list template. returns [{'col_name':'col_value',....},{'col_name':'col_value',....}] :param lst: The list of item objects from query :param list_columns: ...
0
Python
CWE-209
Generation of Error Message Containing Sensitive Information
The product generates an error message that includes sensitive information about its environment, users, or associated data.
https://cwe.mitre.org/data/definitions/209.html
vulnerable
def delete(self, item): """ Deletes object """ raise NotImplementedError
0
Python
CWE-209
Generation of Error Message Containing Sensitive Information
The product generates an error message that includes sensitive information about its environment, users, or associated data.
https://cwe.mitre.org/data/definitions/209.html
vulnerable
def delete(self, item: Model, raise_exception: bool = False) -> bool: try: self._delete_files(item) self.session.delete(item) self.session.commit() self.message = (as_unicode(self.delete_row_message), "success") return True except Integrity...
0
Python
CWE-209
Generation of Error Message Containing Sensitive Information
The product generates an error message that includes sensitive information about its environment, users, or associated data.
https://cwe.mitre.org/data/definitions/209.html
vulnerable
def delete_all(self, items: List[Model]) -> bool: try: for item in items: self._delete_files(item) self.session.delete(item) self.session.commit() self.message = (as_unicode(self.delete_row_message), "success") return True ...
0
Python
CWE-209
Generation of Error Message Containing Sensitive Information
The product generates an error message that includes sensitive information about its environment, users, or associated data.
https://cwe.mitre.org/data/definitions/209.html
vulnerable
def add(self, item: Model, raise_exception: bool = False) -> bool: try: self.session.add(item) self.session.commit() self.message = (as_unicode(self.add_row_message), "success") return True except IntegrityError as e: self.message = (as_uni...
0
Python
CWE-209
Generation of Error Message Containing Sensitive Information
The product generates an error message that includes sensitive information about its environment, users, or associated data.
https://cwe.mitre.org/data/definitions/209.html
vulnerable
def edit(self, item: Model, raise_exception: bool = False) -> bool: try: self.session.merge(item) self.session.commit() self.message = (as_unicode(self.edit_row_message), "success") return True except IntegrityError as e: self.message = (as...
0
Python
CWE-209
Generation of Error Message Containing Sensitive Information
The product generates an error message that includes sensitive information about its environment, users, or associated data.
https://cwe.mitre.org/data/definitions/209.html
vulnerable
def warn( # type: ignore[override] self, msg: str, path_name: str | None = None, func_name: str | None = None, *args: Any, **kwargs: Any, ) -> None: warnings.warn( "The 'warn' method is deprecated, " "use 'warning' instead", Deprec...
0
Python
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
def send_nscript(title, msg, gtype, force=False, test=None): """Run user's notification script""" if test: script = test.get("nscript_script") nscript_parameters = test.get("nscript_parameters") else: script = sabnzbd.cfg.nscript_script() nscript_parameters = sabnzbd.cfg.nscr...
0
Python
NVD-CWE-noinfo
null
null
null
vulnerable
def create_env(nzo: Optional[NzbObject] = None, extra_env_fields: Dict[str, Any] = {}) -> Optional[Dict[str, Any]]: """Modify the environment for pp-scripts with extra information macOS: Return copy of environment without PYTHONPATH and PYTHONHOME other: return None """ env = os.environ.copy() ...
0
Python
NVD-CWE-noinfo
null
null
null
vulnerable
def send_nscript(title, msg, gtype, force=False, test=None): """Run user's notification script""" if test: script = test.get("nscript_script") env = {"notification_parameters": test.get("nscript_parameters")} else: script = sabnzbd.cfg.nscript_script() env = {"notification_pa...
0
Python
NVD-CWE-noinfo
null
null
null
vulnerable
def write_log(self, log_message, ipaddress): # Make entry. db = self.connect_logdb() c = db.cursor() # Insert a row of data. c.execute( f"""insert into log values ({datetime.utcnow().strftime('%Y%m%d')}, {datetime.utcnow().strftime('%H%M%S')}, ?, ...
0
Python
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
def home(): # Get the boards from the database: boards = Database.get_boards() # Write to the log: Database.write_log(f"Request to home page from {request.environ['REMOTE_ADDR']}.", request.environ['REMOTE_ADDR']) # Render the home page, with the boards: return render_template( "home.h...
0
Python
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
def about(): # Write to the log: Database.write_log(f"Request to about page from {request.environ['REMOTE_ADDR']}.", f"{request.environ['REMOTE_ADDR']}") return render_template( "about.html", description=Config.get_config()["long_description"].split("<br>"), )
0
Python
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
def date_filter(s): return datetime.utcnow().strftime('%Y')
0
Python
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
def boardView(): boardID = request.args.get("board", default=1, type=int) pageID = request.args.get("page", default=1, type=int) # Get the board information: boardInfo = Database.get_board_info(boardID) # Get the posts from the board: posts = Database.get_posts_from_board(boardID) # Reduc...
0
Python
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
def postView(): # Get the post ID from the URL: postID = request.args.get("postid", default=1, type=int) # Get the post information: postInfo = Database.get_post_info(postID) # Get the comments from the post: comments = Database.get_comments_from_post(postID) # Get the user information: ...
0
Python
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
def set(self, name, value, force=False): """Set a form element identified by ``name`` to a specified ``value``. The type of element (input, textarea, select, ...) does not need to be given; it is inferred by the following methods: :func:`~Form.set_checkbox`, :func:`~Form.set_...
0
Python
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
def test_upload_file(httpbin): browser = mechanicalsoup.StatefulBrowser() browser.open(httpbin + "/forms/post") # Create two temporary files to upload def make_file(content): path = tempfile.mkstemp()[1] with open(path, "w") as fd: fd.write(content) return path p...
0
Python
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
def _make_cmd(self, tmpfilename, info_dict): cmd = [self.exe, '-O', tmpfilename, '-nv', '--no-cookies', '--compression=auto'] if info_dict.get('http_headers') is not None: for key, val in info_dict['http_headers'].items(): cmd += ['--header', f'{key}: {val}'] cmd ...
0
Python
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
def redirect_request(self, req, fp, code, msg, headers, newurl): if code not in (301, 302, 303, 307, 308): raise urllib.error.HTTPError(req.full_url, code, msg, headers, fp) new_method = req.get_method() new_data = req.data remove_headers = [] # A 303 must either...
0
Python
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
def _calc_headers(self, info_dict): res = merge_headers(self.params['http_headers'], info_dict.get('http_headers') or {}) if 'Youtubedl-No-Compression' in res: # deprecated res.pop('Youtubedl-No-Compression', None) res['Accept-Encoding'] = 'identity' cookies = self.c...
0
Python
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
def download(self, filename, info_dict, subtitle=False): """Download to a filename using the info from info_dict Return True on success and False otherwise """ nooverwrites_and_exists = ( not self.params.get('overwrites', True) and os.path.exists(encodeFilena...
0
Python
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
vulnerable
def compat_shlex_quote(s): import re return s if re.match(r'^[-_\w./]+$', s) else '"%s"' % s.replace('"', '\\"')
0
Python
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
vulnerable
def run(self, info): for tmpl in self.exec_cmd: cmd = self.parse_cmd(tmpl, info) self.to_screen('Executing command: %s' % cmd) retCode = subprocess.call(encodeArgument(cmd), shell=True) if retCode != 0: raise PostProcessingError('Command return...
0
Python
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
vulnerable
def __init__(self, *args, env=None, text=False, **kwargs): if env is None: env = os.environ.copy() self._fix_pyinstaller_ld_path(env) self.__text_mode = kwargs.get('encoding') or kwargs.get('errors') or text or kwargs.get('universal_newlines') if text is True: ...
0
Python
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
vulnerable
def _real_extract(self, url): activity_id, enrollment_id = self._match_valid_url(url).group('id', 'enrollment') course = self._call_api('enrollment', enrollment_id)['content'] activity = traverse_obj(course, ('learning_modules', ..., 'activities', lambda _, v: int(activity_id) == v['id']), g...
0
Python
CWE-444
Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling')
The product acts as an intermediary HTTP agent (such as a proxy or firewall) in the data flow between two entities such as a client and server, but it does not interpret malformed HTTP requests or responses in ways that are consistent with how the messages will be processed by ...
https://cwe.mitre.org/data/definitions/444.html
vulnerable
def _real_extract(self, url): qs = parse_qs(url) src = urllib.parse.unquote(traverse_obj(qs, ('url', 0)) or '') if src and YoutubeTabIE.suitable(src): return self.url_result(src, YoutubeTabIE) return self.url_result(smuggle_url( urllib.parse.unquote(traverse_o...
0
Python
CWE-444
Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling')
The product acts as an intermediary HTTP agent (such as a proxy or firewall) in the data flow between two entities such as a client and server, but it does not interpret malformed HTTP requests or responses in ways that are consistent with how the messages will be processed by ...
https://cwe.mitre.org/data/definitions/444.html
vulnerable
def _parse_video(self, video): title = video['title'] vimeo_id = self._search_regex( r'https?://player\.vimeo\.com/external/(\d+)', video['vimeoVideoURL'], 'vimeo id') uploader_id = video.get('hostID') return { '_type': 'url_transparent', ...
0
Python
CWE-444
Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling')
The product acts as an intermediary HTTP agent (such as a proxy or firewall) in the data flow between two entities such as a client and server, but it does not interpret malformed HTTP requests or responses in ways that are consistent with how the messages will be processed by ...
https://cwe.mitre.org/data/definitions/444.html
vulnerable
def _unsmuggle_headers(self, url): """@returns (url, smuggled_data, headers)""" url, data = unsmuggle_url(url, {}) headers = self.get_param('http_headers').copy() if 'http_headers' in data: headers.update(data['http_headers']) return url, data, headers
0
Python
CWE-444
Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling')
The product acts as an intermediary HTTP agent (such as a proxy or firewall) in the data flow between two entities such as a client and server, but it does not interpret malformed HTTP requests or responses in ways that are consistent with how the messages will be processed by ...
https://cwe.mitre.org/data/definitions/444.html
vulnerable
def _smuggle_referrer(url, referrer_url): return smuggle_url(url, {'http_headers': {'Referer': referrer_url}})
0
Python
CWE-444
Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling')
The product acts as an intermediary HTTP agent (such as a proxy or firewall) in the data flow between two entities such as a client and server, but it does not interpret malformed HTTP requests or responses in ways that are consistent with how the messages will be processed by ...
https://cwe.mitre.org/data/definitions/444.html
vulnerable
def test_recovery_flow(self): """Test that recovery flow is linked correctly""" flow = create_test_flow() self.stage.recovery_flow = flow self.stage.save() FlowStageBinding.objects.create( target=flow, stage=self.stage, order=0, ) ...
0
Python
CWE-203
Observable Discrepancy
The product behaves differently or sends different responses under different circumstances in a way that is observable to an unauthorized actor, which exposes security-relevant information about the state of the product, such as whether a particular operation was successful or not.
https://cwe.mitre.org/data/definitions/203.html
vulnerable
def get_network_params( json_body: Dict[str, Any], agent_id: str ) -> Tuple[Optional[str], Optional[int], Optional[str]]: # Validate ip and port ip = json_body.get("ip") if ip is not None: try: ipaddress.ip_address(ip) except ValueError: ...
0
Python
NVD-CWE-noinfo
null
null
null
vulnerable
def update_bundles(inner_bundles: Set[Tuple[int, datetime, int]]): for (bundle_id, date_added, file_id) in inner_bundles: used_artifact_bundles[bundle_id] = date_added bundle_file_ids.add(file_id)
0
Python
CWE-863
Incorrect Authorization
The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
def get_legacy_release_bundles(release: Release, dist: Optional[Distribution]): return set( ReleaseFile.objects.select_related("file") .filter( release_id=release.id, dist_id=dist.id if dist else None, # a `ReleaseFile` with `0` artifacts represents a release arch...
0
Python
CWE-863
Incorrect Authorization
The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
def download_file(self, file_id, project: Project): rate_limited = ratelimits.is_limited( project=project, key=f"rl:ArtifactLookupEndpoint:download:{file_id}:{project.id}", limit=10, ) if rate_limited: logger.info( "notification...
0
Python
CWE-863
Incorrect Authorization
The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
def url_for_file_id(self, file_id: int) -> str: # NOTE: Returning a self-route that requires authentication (via Bearer token) # is not really forward compatible with a pre-signed URL that does not # require any authentication or headers whatsoever. # This also requires a workaround ...
0
Python
CWE-863
Incorrect Authorization
The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
def download(self, debug_file_id, project): rate_limited = ratelimits.is_limited( project=project, key=f"rl:DSymFilesEndpoint:download:{debug_file_id}:{project.id}", limit=10, ) if rate_limited: logger.info( "notification.rate_l...
0
Python
CWE-863
Incorrect Authorization
The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
def allow_cors_options_wrapper(self, request: Request, *args, **kwargs): if request.method == "OPTIONS": response = HttpResponse(status=200) response["Access-Control-Max-Age"] = "3600" # don't ask for options again for 1 hour else: response = func(self, request, ...
0
Python
CWE-697
Incorrect Comparison
The product compares two entities in a security-relevant context, but the comparison is incorrect, which may lead to resultant weaknesses.
https://cwe.mitre.org/data/definitions/697.html
vulnerable
def test_allow_credentials_incorrect(self): org = self.create_organization() apikey = ApiKey.objects.create(organization_id=org.id, allowed_origins="*") request = self.make_request(method="GET") request.META["HTTP_ORIGIN"] = "http://acme.example.com" request.META["HTTP_AUTHO...
0
Python
CWE-697
Incorrect Comparison
The product compares two entities in a security-relevant context, but the comparison is incorrect, which may lead to resultant weaknesses.
https://cwe.mitre.org/data/definitions/697.html
vulnerable
def _register_template( cls, template: CustomConnectorTemplate, ) -> None: """ Registers a custom connector template by converting it to a ConnectorTemplate, registering any custom functions, and adding it to the loader's template dictionary. """ connector...
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def _register_template( cls, template: CustomConnectorTemplate, ) -> None: """ Registers a custom connector template by converting it to a ConnectorTemplate, registering any custom functions, and adding it to the loader's template dictionary. """ connector...
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def register_custom_functions(script: str) -> None: """ Registers custom functions by executing the given script in a restricted environment. The script is compiled and executed with RestrictedPython, which is designed to reduce the risk of executing untrusted code. It provides a set of safe builtins t...
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def register_custom_functions(script: str) -> None: """ Registers custom functions by executing the given script in a restricted environment. The script is compiled and executed with RestrictedPython, which is designed to reduce the risk of executing untrusted code. It provides a set of safe builtins t...
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def visit_AnnAssign(self, node: AnnAssign) -> AST: return self.node_contents_visit(node)
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def visit_AnnAssign(self, node: AnnAssign) -> AST: return self.node_contents_visit(node)
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def custom_guarded_import( name: str, _globals: Optional[dict] = None, _locals: Optional[dict] = None, fromlist: Optional[Tuple[str, ...]] = None, level: int = 0, ) -> Any: """ A custom import function that prevents the import of certain potentially unsafe modules. """ if name in [ ...
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def custom_guarded_import( name: str, _globals: Optional[dict] = None, _locals: Optional[dict] = None, fromlist: Optional[Tuple[str, ...]] = None, level: int = 0, ) -> Any: """ A custom import function that prevents the import of certain potentially unsafe modules. """ if name in [ ...
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def _load_connector_templates(self) -> None: logger.info("Loading connectors templates from the data/saas directory") for file in os.listdir("data/saas/config"): if file.endswith(".yml"): config_file = os.path.join("data/saas/config", file) config_dict = l...
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def _load_connector_templates(self) -> None: logger.info("Loading connectors templates from the data/saas directory") for file in os.listdir("data/saas/config"): if file.endswith(".yml"): config_file = os.path.join("data/saas/config", file) config_dict = l...
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def connector_template_invalid_dataset( self, planet_express_config, planet_express_invalid_dataset, planet_express_functions, planet_express_icon, ): return create_zip_file( { "config.yml": planet_express_config, "datas...
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def connector_template_invalid_dataset( self, planet_express_config, planet_express_invalid_dataset, planet_express_functions, planet_express_icon, ): return create_zip_file( { "config.yml": planet_express_config, "datas...
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def connector_template_no_icon( self, planet_express_config, planet_express_dataset, planet_express_functions, ): return create_zip_file( { "config.yml": planet_express_config, "dataset.yml": planet_express_dataset, ...
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def connector_template_no_icon( self, planet_express_config, planet_express_dataset, planet_express_functions, ): return create_zip_file( { "config.yml": planet_express_config, "dataset.yml": planet_express_dataset, ...
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def connector_template_duplicate_icons( self, planet_express_config, planet_express_dataset, planet_express_functions, planet_express_icon, ): return create_zip_file( { "config.yml": planet_express_config, "dataset.yml":...
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def connector_template_duplicate_icons( self, planet_express_config, planet_express_dataset, planet_express_functions, planet_express_icon, ): return create_zip_file( { "config.yml": planet_express_config, "dataset.yml":...
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def connector_template_no_functions( self, planet_express_config, planet_express_dataset, planet_express_icon, ): return create_zip_file( { "config.yml": planet_express_config, "dataset.yml": planet_express_dataset, ...
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def connector_template_no_functions( self, planet_express_config, planet_express_dataset, planet_express_icon, ): return create_zip_file( { "config.yml": planet_express_config, "dataset.yml": planet_express_dataset, ...
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def test_register_connector_template_wrong_scope( self, api_client: TestClient, register_connector_template_url, generate_auth_header, complete_connector_template, ): CONFIG.security.allow_custom_connector_functions = True auth_header = generate_auth_heade...
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def test_register_connector_template_wrong_scope( self, api_client: TestClient, register_connector_template_url, generate_auth_header, complete_connector_template, ): CONFIG.security.allow_custom_connector_functions = True auth_header = generate_auth_heade...
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def connector_template_missing_dataset( self, planet_express_config, planet_express_functions, planet_express_icon, ): return create_zip_file( { "config.yml": planet_express_config, "functions.py": planet_express_functions, ...
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def connector_template_missing_dataset( self, planet_express_config, planet_express_functions, planet_express_icon, ): return create_zip_file( { "config.yml": planet_express_config, "functions.py": planet_express_functions, ...
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def complete_connector_template( self, planet_express_config, planet_express_dataset, planet_express_functions, planet_express_icon, ): return create_zip_file( { "config.yml": planet_express_config, "dataset.yml": planet...
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def complete_connector_template( self, planet_express_config, planet_express_dataset, planet_express_functions, planet_express_icon, ): return create_zip_file( { "config.yml": planet_express_config, "dataset.yml": planet...
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def connector_template_duplicate_configs( self, planet_express_config, planet_express_dataset, planet_express_functions, planet_express_icon, ): return create_zip_file( { "1_config.yml": planet_express_config, "2_config....
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def connector_template_duplicate_configs( self, planet_express_config, planet_express_dataset, planet_express_functions, planet_express_icon, ): return create_zip_file( { "1_config.yml": planet_express_config, "2_config....
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def connector_template_wrong_contents_config( self, planet_express_dataset, planet_express_functions, planet_express_icon, ): return create_zip_file( { "config.yml": "planet_express_config", "dataset.yml": planet_express_dataset...
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def connector_template_wrong_contents_config( self, planet_express_dataset, planet_express_functions, planet_express_icon, ): return create_zip_file( { "config.yml": "planet_express_config", "dataset.yml": planet_express_dataset...
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def connector_template_duplicate_datasets( self, planet_express_config, planet_express_dataset, planet_express_functions, planet_express_icon, ): return create_zip_file( { "config.yml": planet_express_config, "1_dataset....
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def connector_template_duplicate_datasets( self, planet_express_config, planet_express_dataset, planet_express_functions, planet_express_icon, ): return create_zip_file( { "config.yml": planet_express_config, "1_dataset....
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def connector_template_invalid_config( self, planet_express_invalid_config, planet_express_dataset, planet_express_functions, planet_express_icon, ): return create_zip_file( { "config.yml": planet_express_invalid_config, ...
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def connector_template_invalid_config( self, planet_express_invalid_config, planet_express_dataset, planet_express_functions, planet_express_icon, ): return create_zip_file( { "config.yml": planet_express_invalid_config, ...
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def test_register_connector_template_allow_custom_connector_functions( self, mock_register_custom_functions: MagicMock, api_client: TestClient, register_connector_template_url, generate_auth_header, zip_file, status_code, details, request, ...
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def test_register_connector_template_allow_custom_connector_functions( self, mock_register_custom_functions: MagicMock, api_client: TestClient, register_connector_template_url, generate_auth_header, zip_file, status_code, details, request, ...
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def test_register_connector_template_disallow_custom_connector_functions( self, api_client: TestClient, register_connector_template_url, generate_auth_header, zip_file, status_code, details, request, ): CONFIG.security.allow_custom_connecto...
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def test_register_connector_template_disallow_custom_connector_functions( self, api_client: TestClient, register_connector_template_url, generate_auth_header, zip_file, status_code, details, request, ): CONFIG.security.allow_custom_connecto...
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def connector_template_missing_config( self, planet_express_dataset, planet_express_functions, planet_express_icon, ): return create_zip_file( { "dataset.yml": planet_express_dataset, "functions.py": planet_express_functions, ...
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def connector_template_missing_config( self, planet_express_dataset, planet_express_functions, planet_express_icon, ): return create_zip_file( { "dataset.yml": planet_express_dataset, "functions.py": planet_express_functions, ...
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def connector_template_wrong_contents_dataset( self, planet_express_config, planet_express_functions, planet_express_icon, ): return create_zip_file( { "config.yml": planet_express_config, "dataset.yml": "planet_express_dataset"...
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def connector_template_wrong_contents_dataset( self, planet_express_config, planet_express_functions, planet_express_icon, ): return create_zip_file( { "config.yml": planet_express_config, "dataset.yml": "planet_express_dataset"...
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable
def connector_template_duplicate_functions( self, planet_express_config, planet_express_dataset, planet_express_functions, planet_express_icon, ): return create_zip_file( { "config.yml": planet_express_config, "dataset.y...
0
Python
CWE-693
Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
https://cwe.mitre.org/data/definitions/693.html
vulnerable
def connector_template_duplicate_functions( self, planet_express_config, planet_express_dataset, planet_express_functions, planet_express_icon, ): return create_zip_file( { "config.yml": planet_express_config, "dataset.y...
0
Python
CWE-94
Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable