r/Python • • 5d 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?

40 Upvotes

33 comments sorted by

View all comments

3

u/aayush_satna_dev 5d ago

2. I don't think so it would block. You can check the documentation as well. It says, "if the app intelligence service can't make a prediction, SAC still allows an app signed with a certificate from a CA in the Trusted Root Program."

https://learn.microsoft.com/en-us/windows/apps/develop/smart-app-control/overview
3. try using onedir because it would allow you to sign every file.

1

u/sausix 5d ago

You can still sign containing binaries and the outer container exe. Not a valid reason against onefile.

Cons of onefile:

  • Extraction time
  • More suspicious to heuristic analysis because it's "hiding" something

1

u/Ishannaik 2d ago

that line abt SAC falling back to the cert when it cant make a prediction is the exact part i needed. have u actually signed every file in a onedir build yourself or is that from the docs too?

1

u/aayush_satna_dev 2d ago

that's was also from the doc bro! I spend lot of time with the docs so even if I feel some query is out of my experience, I stick with the doc and that works perfectly.

1

u/Ishannaik 2d ago

sticking with the docs when something is outside ur own experience is honestly the safer move for windows signing stuff, half the forum answers contradict each other. did they say anything abt whether the trusted root fallback still applies to files extracted into temp, or is that one not covered?