Title: Restore Windows API audit boundaries by youknowdot · Pull Request #9873 · RustPython/RustPython · GitHub
Open Graph Title: Restore Windows API audit boundaries by youknowdot · Pull Request #9873 · RustPython/RustPython
X Title: Restore Windows API audit boundaries by youknowdot · Pull Request #9873 · RustPython/RustPython
Description: Summary Restore the twelve _winapi audit sites from CPython 3.15 together: file, pipe, process, event, mutex, junction, and CopyFile2 operations. Audit vetoes run before native side effects, with the corresponding argument payloads. Convert LPCWSTR arguments once at their binding position, preserving the original string owner without an additional reference-count increment. Use C-int semantics for BOOL arguments, preserving their integer audit payload rather than applying Python truth testing. Preserve CreateJunction's invalid-prefix check before audit and CreateProcess's audit-before-startup/environment processing order. Extend the existing audit snippet with eleven APIs' veto/payload checks plus NUL-conversion, BOOL-conversion, and junction-prefix boundaries. Keep the canonical expectedFailure marker until actual Windows execution confirms it can be removed. Reference and limits Reference: CPython 3.15 Modules/_winapi.c and generated Clinic wrappers. This is not a claim of complete _winapi parity. Existing DWORD/UINT argument conversion differences (strict Rust u32 versus CPython bitfield conversion) remain outside this patch. Current CPython 3.15 source passes a PyObject *command_line to a "uuu" CreateProcess audit format. This patch does not reproduce that unsafe pointer interpretation: it emits the intended (application_name, command_line, current_directory) objects safely. The shared snippet deliberately does not exercise that reference-implementation path; Windows runtime comparison for CreateProcess remains outstanding. Validation Windows GNU cross-target VM Clippy with default features and threading: passed; four warnings remain in unchanged nt.rs/os.rs under this package-only configuration. rustfmt, Python syntax, diff checks, and normal repository hooks: passed. Actual Windows execution, full workspace/C-API tests, complete snippets and performance measurement have not run locally; draft CI will provide target execution coverage. No benchmark result is claimed. Independent of #9871, based directly on main. Summary by CodeRabbit Bug Fixes Windows API calls now validate string arguments, reject embedded null characters, and consistently convert integer flags to boolean values. Process creation requires the command line to be a string or None and converts environment mappings during the call. Junction creation rejects paths with an unsupported Windows prefix. Successful process termination now returns None. New Features Added audit events for selected Windows API calls, including process creation, file operations, and process termination. Tests Added Windows-specific tests for audit events and invalid argument handling.
Open Graph Description: Summary Restore the twelve _winapi audit sites from CPython 3.15 together: file, pipe, process, event, mutex, junction, and CopyFile2 operations. Audit vetoes run before native side effects, with t...
X Description: Summary Restore the twelve _winapi audit sites from CPython 3.15 together: file, pipe, process, event, mutex, junction, and CopyFile2 operations. Audit vetoes run before native side effects, with t...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9873
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:32c29474-4049-532a-4128-7683cd2a5336 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E90A:313081:11F68B3:17BB61D:6B01E3F5 |
| html-safe-nonce | 1c7bb4370beaa6eeb846d64cd750449e2a94b3b647a3a6890fab3faa4a7ed1c4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOTBBOjMxMzA4MToxMUY2OEIzOjE3QkI2MUQ6NkIwMUUzRjUiLCJ2aXNpdG9yX2lkIjoiNTAzMDAyNjQyNjI0MjQyNTg0NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9e7924024121313016ebe9d5199b239993e7b1ae76bd4bf6fe9144262dcec383 |
| hovercard-subject-tag | pull_request:5337117357 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/RustPython/RustPython/pull/9873/files |
| twitter:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| og:image:alt | Summary Restore the twelve _winapi audit sites from CPython 3.15 together: file, pipe, process, event, mutex, junction, and CopyFile2 operations. Audit vetoes run before native side effects, with t... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width