You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[ci] Add DevSkim banned-API analysis to CI and PR builds - #26957
Add explicit DevSkim coverage to the branch and PR pipelines so banned-API findings are visible and blocking, rather than relying on implicit governance configuration. This supports the quoted Microsoft.Security.SystemsADM.10082 requirement; running the scanner alone does not establish compliance.
Approach
Run pinned DevSkim 1.0.100 in an independent Linux stage, without Xcode or a product build. Scan production sources, build tooling, templates, vendored headers, and recursively checked-out MacDev sources.
Evaluate the API.DangerousAPI.BannedFunction result tag at every severity and confidence, including moderate, best-practice, and manual-review findings. Disable inline suppressions and add no baselines or blanket exceptions.
Fail on scanner errors or missing/malformed expected reports. Publish SARIF and scanner logs even when the gate fails, using the existing 1ES artifact helper.
Initial rollout is intentionally blocking: the local scan found 145 banned-function findings: 121 in the runtime and 24 in tooling/vendored headers (139 Moderate, five Important, one BestPractice). These require remediation or narrowly scoped security-owner approval; they are not claims of exploitable vulnerabilities. Tests, documentation, translations, and dependencies downloaded/generated by later build jobs are outside this source scan.
CodeQL configuration and the existing native-symbol/P/Invoke checks are unchanged.
Validation
Ten report-gate regression tests pass, covering all severity levels, suppression handling, multiple runs/reports, execution errors, malformed reports, and missing expected reports.
Executed the CI scan command locally across all nine source trees and verified all SARIF/log outputs plus the expected failing gate.
Verified clean and banned fixtures, scanner-error propagation through tee/pipefail, YAML syntax, and pipeline wiring/artifact conditions.
Two distinct-model code reviews completed; the missing-report warning was fixed and both follow-up reviews found no remaining errors or warnings.
A live Azure Pipelines run and server-side 1ES template expansion have not yet been performed.
Note
This pull request description and implementation were generated with GitHub Copilot.
Run the pinned DevSkim 1.0.100 CLI in an independent Linux stage, covering production sources, build tooling, templates, and checked-out dependencies without requiring an Apple build. Publish SARIF reports and scanner logs even when findings fail the job.
Evaluate the banned-function result tag at every severity and confidence, including moderate findings, rather than relying on the CLI's default success exit code. Keep scanner errors distinct from findings, disable inline suppressions, and add regression coverage and local reproduction instructions.
Existing runtime and vendored-header findings intentionally remain visible and blocking pending security-owner triage; this change adds no baseline or blanket exceptions and leaves CodeQL and symbol checks unchanged.
Co-authored-by: Copilot App <[email protected]>
Pass the expected SARIF paths explicitly instead of expanding only the reports that exist. This keeps a missing source-tree report from silently disappearing from the compliance gate when other reports are present.
Add regression coverage for a missing report alongside a valid clean report and keep the documented local reproduction command consistent with CI.
Co-authored-by: Copilot App <[email protected]>
Use a dedicated NuGet configuration that clears inherited package sources and selects only dotnet-public. The isolated CI agent cannot load api.nuget.org, while the Azure Artifacts mirror contains the pinned DevSkim 1.0.100 package.
Initialize the artifact directory before provisioning and capture installation output with pipefail enabled. Installation failures now retain diagnostics without triggering a secondary missing-artifact-directory error. Update the local reproduction instructions to use the same source configuration.
Co-authored-by: Copilot App <[email protected]>
Pass the top-level NuGet.config explicitly when installing the pinned CLI. Its existing dotnet-public source provides DevSkim, and its clear element excludes inherited nuget.org sources without duplicating feed configuration.
Remove the dedicated DevSkim NuGet configuration and update local reproduction instructions. Preserve installation diagnostics and the pre-provisioning artifact directory.
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The checkout path is duplicated in the installation path and scan working directories, causing NuGet.config lookup to fail and preventing the scan from running.
System.DefaultWorkingDirectory already points to s/macios in the DevSkim job, so appending the repository title produces s/macios/macios and prevents NuGet.config from being found. Anchor the configuration path to Pipeline.Workspace and the explicit s/<repository> checkout path instead.
Correct the test and scan working directories at the same time so both steps run from the actual checkout once installation succeeds.
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
DevSkim failures do not block either release-publishing path, and scanner installation can fail on clean checkouts because an enabled local NuGet feed is absent.
❌ The top-level NuGet.config enables local-tests-feed at tests/.nuget/packages, which is git-ignored and absent from a clean checkout, so tool installation can fail before scanning even when dotnet-public is reachable. Add --ignore-failed-sources or use a mirror-only scanner config. Apply the same change to the local installation command in tools/devops/README.md:157.
Render SARIF into a self-contained searchable HTML report with blocking and non-blocking counts, severity/category filters, source links at the scanned revision, excerpts, and rule guidance. Escape scanner-provided content and show missing or invalid reports as incomplete coverage rather than success.
Generate the report even after scanner failures and include it in the existing DevSkim artifact. A separate Windows job publishes the report and diagnostics to VSDrops using the existing Artifact Services Drop task, then posts a PR comment only for banned findings or scan errors. Clean scans and branch builds do not create PR comments, and publication failures are not swallowed.
Add regression coverage for rendering, untrusted SARIF, incomplete scans, report summaries, failure links, and the clean-run no-comment path. Document the report and local rendering workflow.
Co-authored-by: Copilot App <[email protected]>
Read path exclusions from a shared DevSkim options file and exclude imported tools/sharpie/clang/include headers, while retaining the existing Git metadata exclusions. Use the same options in CI and documented local scans; previously generated SARIF is not retroactively filtered.
Append the matched function name from SARIF excerpts to generic banned-API messages so reviewers can identify the API without expanding guidance. Preserve messages that already name the function and add regression coverage for bare names, calls, and missing excerpts.
Co-authored-by: Copilot App <[email protected]>
Parse Objective-C array lengths with strtoul and validate the numeric prefix, range, alignment, and final size multiplication before using the result. Invalid encodings now fail explicitly instead of producing wrapped sizes.
Add native runtime regression cases for zero, multi-digit, and nested array encodings.
Co-authored-by: Copilot App <[email protected]>
Search protocol wrapper and assembly location maps with bounded half-open ranges and overflow-safe midpoint calculations. Validate map counts and storage, preserve not-found results, and compare protocol tokens without casting packed records to integer pointers.
Co-authored-by: Copilot App <[email protected]>
Validate registration map counts and storage before sorting, handle sort failure explicitly, and publish the map only after sorting succeeds.
Replace pointer subtraction in the comparator with relational comparisons. Keep signed pointer ordering to match Class.FindMapIndex in managed code, including handles with the high bit set.
Co-authored-by: Copilot App <[email protected]>
Use the Darwin strerror_r contract with per-call value storage instead of shared error-description pointers. Preserve errno and retain a numeric diagnostic if description conversion fails.
Share the pure-C helper with the spawner, capture error codes before Objective-C message evaluation, and cover normal and unknown errors in native runtime tests.
Co-authored-by: Copilot App <[email protected]>
Read the optional bundle configuration through Foundation with explicit I/O and decoding diagnostics, then parse complete lines instead of 127-byte chunks. Preserve settings precedence and duplicate-host handling.
Validate numeric port and timeout values, including range and trailing data, before applying them. Missing optional files remain expected.
Co-authored-by: Copilot App <[email protected]>
CI build 16056025 detected the intentional printf call, uploaded its HTML report to VSDrops, created the detailed gist, and posted the PR comment successfully. Remove the compiled-out call now that the failure path has been exercised.
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Retrying a failed scan republishes the same non-overwritable artifact name, causing publication to fail and allowing downstream jobs to consume stale reports instead of the retry’s results.
Allow gist publication only from the public CI and PR pipelines after confirming repository visibility with GitHub. Private, MSRC, and unknown builds retain their reports in authenticated artifacts and VSDrops.
Validate the SARIF fields consumed by the gate and renderers. Parse each report independently so malformed input becomes an explicit scan error without losing valid reports or failure-report outputs.
Qualify pipeline artifacts with the scan job attempt and pass that producer output to both download jobs, regardless of their own retry counts.
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because unpublished findings include a critical native-linkage mismatch that prevents interop resolution, plus runtime-selection, scan-reporting, and assembly-lookup risks.
monotouch-test/iOS - simulator/Release (trimmable static registrar, NativeAOT): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/iOS - simulator/Debug (managed static registrar): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/iOS - simulator/Debug (trimmable static registrar): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/iOS - simulator/Release (managed static registrar, all optimizations): BuildFailure
monotouch-test/iOS - simulator/Debug (trimmable static registrar, all optimizations): BuildFailure
monotouch-test/iOS - simulator/Release (trimmable static registrar, all optimizations): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/iOS - simulator/Release (compat inline Class.GetHandle): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/iOS - simulator/Release (strict inline dlfcn, link sdk): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/iOS - simulator/Release (NativeAOT, .NET 11 defaults): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/Mac Catalyst/Debug (Trimmable Static Registrar, link sdk): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/Mac Catalyst/Debug (managed static registrar): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/Mac Catalyst/Debug (trimmable static registrar): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/Mac Catalyst/Debug (static registrar): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/Mac Catalyst/Release (managed static registrar): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/Mac Catalyst/Release (trimmable static registrar): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/Mac Catalyst/Release (managed static registrar, all optimizations): BuildFailure
monotouch-test/Mac Catalyst/Debug (trimmable static registrar, all optimizations): BuildFailure
monotouch-test/Mac Catalyst/Release (trimmable static registrar, all optimizations): BuildFailure
monotouch-test/Mac Catalyst/Release (NativeAOT): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/Mac Catalyst/Release (trimmable static registrar, NativeAOT): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/Mac Catalyst/Release (static registrar): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/Mac Catalyst/Release (static registrar, all optimizations): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/Mac Catalyst/Release (compat inline dlfcn): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/Mac Catalyst/Release (strict inline dlfcn, link sdk): BuildFailure
monotouch-test/macOS/Release (managed static registrar, all optimizations): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/macOS/Debug (trimmable static registrar, all optimizations): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/macOS/Release (trimmable static registrar, all optimizations): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/macOS/Release (NativeAOT): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/macOS/Release (NativeAOT, .NET 11 defaults): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/macOS/Release (static registrar): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/macOS/Release (static registrar, all optimizations): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/macOS/Release (compat inline dlfcn): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/macOS/Release (strict inline dlfcn, link sdk): BuildFailure
monotouch-test/tvOS - simulator/Release (trimmable static registrar, NativeAOT): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/tvOS - simulator/Debug (managed static registrar): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/tvOS - simulator/Release (managed static registrar, all optimizations): BuildFailure
monotouch-test/tvOS - simulator/Debug (trimmable static registrar, all optimizations): BuildFailure
monotouch-test/tvOS - simulator/Release (trimmable static registrar, all optimizations): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
monotouch-test/tvOS - simulator/Release (strict inline Class.GetHandle): BuildFailure ( (failed to parse the logs: The Writer is closed or in error state.))
Return best-effort stack traces and report debugger port formatting failures without terminating the process. Use managed exceptions for invalid trampoline signatures, allocation failures, array encodings, and protocol wrapper maps.
Keep fatal checks needed before the managed runtime is initialized, and document the distinction.
Co-authored-by: Copilot App <[email protected]>
Run the shared DevSkim scan stage in the test pipelines and make simulator tests depend on it. Keep VSDrops and GitHub reporting in the main CI and PR pipelines to avoid duplicate publications.
Move production scripts into scripts/devskim, update their paths and repository-root lookup, and remove the script tests and their CI step as requested in review.
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
I found two remaining blockers, both already described in the existing threads:
Native test helpers need C linkage: tests/test-libraries/libtest.m is compiled as Objective-C++, but the new x_test_* definitions lack extern "C". The __Internal imports expect unmangled symbols, so the test application cannot resolve them. Declare both helpers with C linkage.
Preserve UTF-8 in resource paths: runtime/runtime.m formats UTF-8 path components using NSString%s, which uses the system default encoding. Non-ASCII bundle or resource paths can be changed and assembly lookup can fail on CoreCLR. Decode explicitly as UTF-8 and use %@, or retain byte-preserving path construction with truncation checks.
The linked threads contain the relevant locations and proposed fixes.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add explicit DevSkim coverage to the branch and PR pipelines so banned-API findings are visible and blocking, rather than relying on implicit governance configuration. This supports the quoted Microsoft.Security.SystemsADM.10082 requirement; running the scanner alone does not establish compliance.
Approach
API.DangerousAPI.BannedFunctionresult tag at every severity and confidence, including moderate, best-practice, and manual-review findings. Disable inline suppressions and add no baselines or blanket exceptions.Initial rollout is intentionally blocking: the local scan found 145 banned-function findings: 121 in the runtime and 24 in tooling/vendored headers (139 Moderate, five Important, one BestPractice). These require remediation or narrowly scoped security-owner approval; they are not claims of exploitable vulnerabilities. Tests, documentation, translations, and dependencies downloaded/generated by later build jobs are outside this source scan.
CodeQL configuration and the existing native-symbol/P/Invoke checks are unchanged.
Validation
tee/pipefail, YAML syntax, and pipeline wiring/artifact conditions.Note
This pull request description and implementation were generated with GitHub Copilot.
🤖 Pull request created by Copilot