r/Python • u/Ishannaik • 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:
- 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?
- Has anyone seen Smart App Control actually stop blocking after signing, or does it still flag new files until reputation builds?
- 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
View all comments
2
u/Kamalmosadegh 4d ago
One thing worth doing before paying for a cert: check what's actually unsigned in your build first. A quick pass over the dist folder with PowerShell will list it:
Get-ChildItem -Recurse dist\YourApp -Include *.exe, *.dll | ForEach-Object { (Get-AuthenticodeSignature $_.FullName).Status }
Anything that comes back NotSigned is what Smart App Control will actually look at. On a typical PyInstaller onedir build you'll find most of the Python DLLs are already signed by the PSF — don't re-sign those; a second signature adds nothing and you end up vouching for binaries you didn't build.
And keep the two mechanisms apart, because they answer your question 2 differently: Smart App Control blocks binaries it can't classify, and a valid signature gets you past that part. SmartScreen is separate and reputation-based, so a brand-new cert will still trigger the "Windows protected your PC" warning until enough people have installed it without incident. An EV cert skips that reputation-building period, which is the main thing the extra cost buys you. So signing solves the SAC block, but expect SmartScreen warnings on a fresh cert for a while either way.