Feature: Add post-build Authenticode signing support for --compile -t exe
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- csharp, typescript
- Ambito
- build-system, ci-cd, cli, documentation, security
Direzione di ricerca
Inizia dal punto di ingresso CLI --compile -t exe e traccia come ManualBundler e SdkBundler passano l'eseguibile finale a PEPacker. Definisci il flusso dello strumento di firma multipiattaforma e la gestione degli errori, quindi aggiorna docs/antivirus-false-positives.md e il README; il lavoro è completato quando gli eseguibili firmati vengono verificati correttamente, i fallimenti sono azionabili e restituiscono un valore diverso da zero, e CI copre un certificato di test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Motivation
Compiled single-file executables (sharpts --compile script.ts -t exe) are unsigned and get flagged by behavioral AV engines as suspected packers/droppers — see #4 (WithSecure DeepGuard quarantines the output as W32/Malware!DeepGuard.n).
This pattern is intrinsic to the apphost-plus-appended-bundle format that both our ManualBundler and the SdkBundler (Microsoft's HostWriter) produce. Rewriting the bundler does not fix it — a differently-shaped unsigned bundle is still an unsigned bundle. Authenticode signing is the real long-term mitigation: once the signing cert earns some reputation, heuristic flags largely stop firing.
Proposed behavior
Add post-build signing as an opt-in step after bundling, for -t exe output only.
CLI surface (rough sketch, open to revision):
sharpts --compile script.ts -t exe \
--sign <path-to-pfx-or-cert-thumbprint> \
[--sign-pass <password>] \
[--sign-timestamp <rfc3161-url>] \
[--sign-digest sha256]
--signaccepts either a.pfxpath or a certificate store thumbprint (sha1:ABCD...). Default digestsha256. Default timestamp server is the DigiCert RFC3161 endpoint; overridable.- Password can also come from
SHARPTS_SIGN_PASSenv var to keep it out of shell history. - Signing runs after the bundler produces the final
.exe. On failure, the.exeremains on disk unsigned and the tool exits non-zero with a clear error.
Implementation notes
- On Windows, shell out to
signtool.exeif it is onPATHor resolvable from a Windows SDK install. Fallback toSignToolfrom the .NET SDK if present. - On Linux/macOS, shell out to
osslsigncodeif available; otherwise emit a clear error saying the platform needsosslsigncodeinstalled and point at install instructions. - Keep the signing logic in
PEPacker(separate repo/package) alongside the bundling code, so the--signflag is thin glue in SharpTS. - The apphost is already signed by Microsoft when shipped in the SDK; our byte-patching invalidates that signature, which is expected. Our re-signing replaces it.
Out of scope for this issue
- EV / OV certificate procurement guidance — covered in a separate docs issue.
- Authenticode signing for DLL output (
-t dll) — possible, but drop-indotnet script.dllexecution does not really need it. Can be a follow-up.
Docs work
- Add
docs/antivirus-false-positives.mdexplaining why single-file .NET outputs trigger behavioral AV and pointing to--signas the fix. - README section on
--signwith a worked example (self-test with a self-signed cert on a dev machine; production example with a real code-signing cert).
Acceptance criteria
sharpts --compile hello.ts -t exe --sign test.pfx --sign-pass ...produces an.exethatsigntool verify /pa /v hello.exereports asSuccessfully verified.- On sign failure (bad password, expired cert, missing
signtool), the tool prints an actionable error and exits non-zero. - CI gains a test that produces a signed exe with a self-generated test cert and verifies the signature. Cross-platform via
osslsigncodeif feasible.
Related
- #4 — WithSecure / F-Secure DeepGuard false-positive on compiled exe. Signing does not guarantee the FP goes away on day one (cert reputation needs to accrue) but is the recognized long-term path.
- Lingua principale
- C#
- Stelle
- 156
- Fork
- 4
- Merge medio
- 2h 32m
- PR unite (30g)
- 178
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nickna/SharpTS
-
documentation enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 1/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di nickna/SharpTS
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
stryker-mutator/stryker-net#3892 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
MobiFlight/MobiFlight-Connector#3419 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Kryptos-FR/MarkView.Avalonia#105 ·
I maintainer di solito rispondono entro 1 giorno
-
[辞書]Aperta提案 辞書
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
microsoft/fluentui-blazor#5410 ·
I maintainer di solito rispondono entro 1 giorno