openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

Security concerns due to `lazy-imports` package in the python generator

Open Thommy257 opened this issue 1 year ago • 4 comments

I don't want to be a buzzkill or step on someone's toes. Still, with that change, you are potentially pushing a dependency with nine GitHub stars and two maintainers into millions of micro-services. I'd reconsider...

Originally posted by @Thommy257 in https://github.com/OpenAPITools/openapi-generator/issues/21486#issuecomment-3220495818

Hi all,

In your latest release, v7.15.0, you included a package called lazy-imports required to run the generated API client code (see https://github.com/OpenAPITools/openapi-generator/pull/21486). Due to a lack of maintenance and public verification, this package poses a significant security risk. I suggest undoing this change or internalising it into openapi-generator.

Also, this PR probably broke many CI/CD pipelines. And for those that didn't break, many microservices got silently injected with a package not verified by a large open source community.

Thommy257 avatar Aug 28 '25 07:08 Thommy257

Is there a measurable benefit from using lazy-imports that would make the supply chain security risk worth it?

Trolldemorted avatar Sep 05 '25 08:09 Trolldemorted

they package itself is not that important i guess but the effect is: https://github.com/goauthentik/authentik/issues/10865

some generated clients took very long on importing, which makes it really cumbersome for scripts

katrinm86 avatar Sep 05 '25 08:09 katrinm86

The Python generator can preserve deferred model and API imports without introducing a third-party runtime dependency or replacing entries in sys.modules. https://github.com/OpenAPITools/openapi-generator/pull/24402 implements standard-library PEP 562 lazy exports, retains typing, public exports and caching, and removes lazy-imports from all generated Python packaging metadata.

— tamirdex

tamird avatar Jul 23 '26 18:07 tamird

I think this issue can be closed out now? @wing328

tamird avatar Jul 31 '26 14:07 tamird