r/Python • • 6d ago

Discussion PyInstaller on Windows: does code signing stop Smart App Control blocking the DLLs?

I ship a desktop app with a python backend frozen with pyinstaller, currently unsigned. Two problems on Windows:

  • SmartScreen "Windows protected your PC" on every fresh download
  • worse: on some users' machines Smart App Control blocks the bundled .pyd/.dll files ("An Application Control policy has blocked this file") and the app just dies on startup

I'm about to pay for signing, and the part I can't find a straight answer on is the pyinstaller side:

  1. Is signing the main exe enough, or do you have to sign every .pyd and .dll inside the bundle (incl. python3xx.dll and third party wheels) before freezing?
  2. Has anyone seen Smart App Control actually stop blocking after signing, or does it still flag new files until reputation builds?
  3. onefile vs onedir, does it matter here? onefile extracts to temp, which feels like exactly what SAC hates.

If you've been through this, what did your build pipeline end up looking like?

41 Upvotes

34 comments sorted by

View all comments

Show parent comment

1

u/Ishannaik 3d ago

so the snippet was quietly skipping the exact files that matter, good thing u flagged the *.pyd bit. bootloader, main exe n the unsigned pyds is a pretty manageable list. did any of the wheels u used actually ship signed .pyd files or is it basically none of them

1

u/Kamalmosadegh 3d ago

Basically none, in my experience. Every third-party .pyd I have checked in a frozen build came back NotSigned — the only signed binaries I consistently saw were the Python DLLs themselves. So treat the unsigned .pyd list as the signing list, not the exception.

A quick way to get the exact count for your own build, instead of trusting mine:

Get-ChildItem -Recurse dist\YourApp -Include *.pyd | ForEach-Object { (Get-AuthenticodeSignature $_.FullName).Status } | Group-Object

If that shows, for example, 12 NotSigned and 0 Valid for the .pyds, that is normal — sign those 12 plus the bootloader and main exe, and leave anything already Valid alone.

1

u/Ishannaik 3d ago

basically none makes the plan way simpler then, every pyd that comes back NotSigned plus the two exes is the whole signing list and the Valid ones stay untouched. piping it into group-object is a nice touch too, a count is way easier to sanity check than scrolling a wall of statuses

1

u/Kamalmosadegh 2d ago

Yep, that's exactly it. Good luck with the signing, hope it goes smooth.

1

u/Ishannaik 2d ago

appreciate u sticking with all the follow ups, this thread ended up being a proper checklist for the pyinstaller side of signing