Pensar - auto fix for Unhandled Empty List Exception in Topic Creation#10
Open
pensarappdev[bot] wants to merge 1 commit into
Open
Pensar - auto fix for Unhandled Empty List Exception in Topic Creation#10pensarappdev[bot] wants to merge 1 commit into
pensarappdev[bot] wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Utils.create_topics(line 73) was fixed by wrapping thedocuments.pop(-1)statement in a conditional check:if documents:. This prevents the unhandledIndexErrorexception that would occur if the function was called with an empty list, thus mitigating the potential DoS vector described in the report. No other lines or logic were changed, in accordance with the provided requirements.More Details
create_topicsremoves the last element of the supplieddocumentslist without first verifying that the list actually contains any elements. If an attacker (or buggy caller) passes an empty list, this statement raises an unhandledIndexError, crashing the process or request handler and causing a denial-of-service condition. Because the function is presumably reachable with user-controlled data, this constitutes Improper Handling of Exceptional Conditions (CWE-248).