Skip to content

Handle generic exceptions raised in preparation to execute run-condition#3034

Merged
centosinfra-prod-github-app[bot] merged 1 commit intopackit:mainfrom
nforro:run-condition
Mar 4, 2026
Merged

Handle generic exceptions raised in preparation to execute run-condition#3034
centosinfra-prod-github-app[bot] merged 1 commit intopackit:mainfrom
nforro:run-condition

Conversation

@nforro
Copy link
Member

@nforro nforro commented Mar 2, 2026

Report the error to Sentry but proceed with execution.

Fixes https://red-hat-it.sentry.io/issues/7302404510.

@centosinfra-prod-github-app
Copy link
Contributor

@nforro nforro moved this from New to In review in Packit pull requests Mar 2, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to handle exceptions during the preparation for executing a run-condition by wrapping the logic in a try-except block. However, it introduces a bug where an UnboundLocalError can occur if an exception happens before the actions_handler variable is initialized, causing the worker task to crash. This is contrary to the goal of proceeding with execution and can also lead to a NameError if other variables are not initialized. To address this, ensure actions_handler is initialized before the try block, or consider returning True from the except block to safely bypass the run-condition check.

@nforro
Copy link
Member Author

nforro commented Mar 2, 2026

/gemini review

@centosinfra-prod-github-app
Copy link
Contributor

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to handle generic exceptions during the preparation for executing a run-condition to prevent crashes and report them to Sentry. However, it introduces a potential UnboundLocalError because the extra_env variable is initialized inside the try block that might be skipped if an exception occurs. This would lead to a worker crash when the variable is later accessed, failing the primary goal of the PR to proceed with execution after an error. Please see the critical comment for a code suggestion to fix this issue.

@nforro
Copy link
Member Author

nforro commented Mar 2, 2026

/gemini review

@centosinfra-prod-github-app
Copy link
Contributor

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a try...except block to handle generic exceptions during the preparation phase for executing a run-condition, aiming to prevent crashes and allow execution to proceed with error logging. However, a critical vulnerability related to unsafe specfile parsing has been identified, which could lead to Remote Code Execution (RCE) on the worker pod. This pre-existing vulnerability is now encapsulated within the new try...except block, potentially masking the issue while maintaining its exploitability. Additionally, the current error logging needs improvement to include more context for effective debugging.

Report the error to Sentry but proceed with execution.

Signed-off-by: Nikola Forró <nforro@redhat.com>
@centosinfra-prod-github-app
Copy link
Contributor

@centosinfra-prod-github-app
Copy link
Contributor

@nforro nforro added the mergeit Merge via Zuul label Mar 4, 2026
@centosinfra-prod-github-app
Copy link
Contributor

@centosinfra-prod-github-app centosinfra-prod-github-app bot merged commit e04b0fa into packit:main Mar 4, 2026
6 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Packit pull requests Mar 4, 2026
@nforro nforro deleted the run-condition branch March 4, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mergeit Merge via Zuul

Projects

Development

Successfully merging this pull request may close these issues.

2 participants