The vulnerability lies in the Kiota Python code generator's handling of enum descriptions from OpenAPI specifications. The root cause is twofold. First, the PythonConventionService.RemoveInvalidDescriptionCharacters function failed to strip newline characters from the description. This allowed an attacker to craft a malicious description containing newlines, which would then be rendered as multi-line comments in the generated Python code. By injecting newlines, an attacker could break out of the comment and inject arbitrary Python code that would be executed when the generated module is imported. Second, the KiotaBuilder.SetEnumOptions function did not call a cleanup function on the description, allowing the malicious description to be processed by the vulnerable RemoveInvalidDescriptionCharacters function. The patch addresses both issues by adding newline sanitization in RemoveInvalidDescriptionCharacters and by adding a call to CleanupDescription in SetEnumOptions.