Skip to content

[Cherry-Pick] Windows ML: Enable Control Flow Guard for cpp-abi sample (BinSkim BA2008) - #653

Merged
Kyaw Thant (kythant) merged 1 commit into
mainfrom
user/kythant/winml-cppabi-enable-cfg-main
Jul 2, 2026
Merged

Kyaw Thant (kythant) merged 1 commit into
mainfrom
user/kythant/winml-cppabi-enable-cfg-main

Conversation

@kythant

Copy link
Copy Markdown
Contributor

Summary

Cherry-pick of #648 (commit 26eddcdf) to main.

Enables Control Flow Guard on the Windows ML cpp-abi sample (CppAbiEPEnumerationSample) so it satisfies SDL/BinSkim BA2008 (EnableControlFlowGuard).

Why

main has the cpp/Directory.Build.props CFG block (from #577) that covers the cpp/ samples, but the separate cpp-abi project (which is not under cpp/ and doesn't inherit those props) was never given CFG on main. #648 fixed it on release/experimental; this brings main to parity.

Change

Adds <ControlFlowGuard>Guard</ControlFlowGuard> to the project's <ClCompile>; the C++ targets propagate it to the compiler (/guard:cf) and linker (/GUARD:CF).

       <AdditionalIncludeDirectories>$(ProjectDir)..\..\Shared\cpp;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <!-- Enable Control Flow Guard (compiler /guard:cf, linker /GUARD:CF) to satisfy SDL/BinSkim BA2008 -->
+      <ControlFlowGuard>Guard</ControlFlowGuard>
     </ClCompile>

Cherry-picked from 26eddcdf (PR #648).

CppAbiEPEnumerationSample.exe was built without Control Flow Guard, tripping BinSkim BA2008 (error severity) in the WindowsAppSDK SamplesCompat SDL gate (Guardian: Post Analysis) once the temporary .gdnsuppress waiver (Bug 60433419) expired on 2026-06-30. Set <ControlFlowGuard>Guard</ControlFlowGuard> so cl receives /guard:cf and link receives /GUARD:CF, matching the other WindowsML C++ samples that already pass BA2008.

(cherry picked from commit 26eddcd)
@kythant
Kyaw Thant (kythant) marked this pull request as ready for review July 2, 2026 20:46
@kythant
Kyaw Thant (kythant) merged commit c4bd030 into main Jul 2, 2026
4 checks passed
@kythant
Kyaw Thant (kythant) deleted the user/kythant/winml-cppabi-enable-cfg-main branch July 2, 2026 23:51
agniuks added a commit that referenced this pull request Jul 21, 2026
#656)

CppAbiEPEnumerationSample.exe was built without Control Flow Guard, tripping BinSkim BA2008 (error severity) in the WindowsAppSDK SamplesCompat SDL gate (Guardian: Post Analysis) once the temporary .gdnsuppress waiver (Bug 60433419) expired on 2026-06-30. Set <ControlFlowGuard>Guard</ControlFlowGuard> so cl receives /guard:cf and link receives /GUARD:CF, matching the other WindowsML C++ samples that already pass BA2008.

(cherry picked from commit 26eddcd)
(cherry picked from commit c4bd030)

Co-authored-by: Kyaw Thant <48363984+kythant@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants