Skip to content

CHORE: Align native build options and wheel binary validation - #775

Draft
Gaurav Sharma (bewithgaurav) wants to merge 2 commits into
mainfrom
bewithgaurav/native-build-checks
Draft

Gaurav Sharma (bewithgaurav) wants to merge 2 commits into
mainfrom
bewithgaurav/native-build-checks

Conversation

@bewithgaurav

Copy link
Copy Markdown
Collaborator

Summary

Adds explicit native build defaults and platform-specific build options. Adds validation of packaged native libraries, including versioned filenames, and runs checkout-only tests before Linux wheel isolation.

Pending Before Merge

Replacement libraries, remaining scan-result review, and complete Windows and OneBranch validation are pending. This draft is not ready for release.

Copilot AI added 2 commits September 10, 2026 16:17
Set explicit native build defaults and validate extracted wheel payloads before release.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Skip checkout-only tests when source helpers are absent from installed-wheel test layouts, and run the checks before isolation in both Linux build flows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 10, 2026 14:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The wheel scan script and its tests need small but important robustness/coverage fixes to avoid CI failures (notably around missing symbols directories and unexercised SARIF artifact-index parsing).

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Aligns native build defaults/hardening with CMake/build-script entry points and adds a OneBranch stage to validate that all wheel-contained native binaries are covered by BinSkim (including versioned .so.* and resource .rll files). This fits the repo’s packaging/CI layer by tightening build determinism and enforcing binary scan coverage across produced wheels.

Changes:

  • Add hardened native build defaults/options (default Release, stack protector, RELRO/NOW/noexecstack, Linux _FORTIFY_SOURCE default) and ensure build.sh preserves requested CMAKE_BUILD_TYPE.
  • Add wheel payload binary inventory + SARIF coverage validation script, plus OneBranch job/stage wiring to scan consolidated wheels on Windows.
  • Add a new pytest module validating scan behavior and native build option effects (including ELF/Mach-O checks).
File summaries
File Description
tests/test_037_native_build_checks.py Adds tests for wheel binary inventory/scan behavior and native build option verification.
eng/scripts/scan_wheel_binaries.py Implements wheel extraction + BinSkim SARIF coverage enforcement for native binaries.
mssql_python/pybind/native_build_config.h Adds Linux-only _FORTIFY_SOURCE default when optimized and not already set.
mssql_python/pybind/cmake/NativeBuildOptions.cmake Centralizes native hardening flags for GCC/Clang-family compilers.
mssql_python/pybind/CMakeLists.txt Defaults single-config builds to Release and applies native hardening options to ddbc_bindings.
mssql_python/pybind/build.sh Preserves CMAKE_BUILD_TYPE and appends coverage flags without clobbering caller CXXFLAGS/CFLAGS.
OneBranchPipelines/steps/scan-wheel-binaries-step.yml Adds reusable step to download BinSkim and run wheel scan script, publishing reports.
OneBranchPipelines/jobs/scan-wheel-binaries-job.yml Adds a Windows job to download consolidated wheels/symbols and run the scan step.
OneBranchPipelines/build-release-package-pipeline.yml Ensures SDL tasks run for Official builds and expands BinSkim target globs (e.g., .so.*, .rll).
OneBranchPipelines/official-release-pipeline.yml Integrates the wheel payload scan step into the official release flow with expected wheel counts.
OneBranchPipelines/stages/build-linux-single-stage.yml Runs checkout-only native-build checks before wheel-only isolation in Linux build containers.
OneBranchPipelines/stages/build-macos-single-stage.yml Updates BinSkim disablement comment to reflect scanning moved to Windows stage.
OneBranchPipelines/jobs/consolidate-artifacts-job.yml Updates BinSkim disablement comment to reflect downstream scanning stage.
OneBranchPipelines/jobs/consolidate-odbc-artifacts-job.yml Updates BinSkim disablement comment to reflect downstream scanning stage.
Review details
  • Files reviewed: 14/14 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +150 to +152
symbol_dirs = (
sorted({str(p.parent.resolve()) for p in symbols.rglob("*.pdb")}) if symbols else []
)
Comment on lines +104 to +109
def test_complete_report_passes(tmp_path):
uri = (tmp_path / "lib.so.2").as_uri()
report = tmp_path / "scan.sarif"
report.write_text(json.dumps(report_for(uri)))
scan.verify_report(report, {uri: "ELF"})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants