Title: [WASI] getpath.py does not handle "Capabilities insufficient" (ENOTCAPABLE) · Issue #96005 · python/cpython · GitHub
Open Graph Title: [WASI] getpath.py does not handle "Capabilities insufficient" (ENOTCAPABLE) · Issue #96005 · python/cpython
X Title: [WASI] getpath.py does not handle "Capabilities insufficient" (ENOTCAPABLE) · Issue #96005 · python/cpython
Description: Bug report WASI has a capability-based security concept. A process must have a valid handle to open a resource. For example WASI runtimes let processes only open files that are inside a directory tree for which the process owns a file de...
Open Graph Description: Bug report WASI has a capability-based security concept. A process must have a valid handle to open a resource. For example WASI runtimes let processes only open files that are inside a directory t...
X Description: Bug report WASI has a capability-based security concept. A process must have a valid handle to open a resource. For example WASI runtimes let processes only open files that are inside a directory t...
Opengraph URL: https://github.com/python/cpython/issues/96005
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[WASI] getpath.py does not handle \"Capabilities insufficient\" (ENOTCAPABLE)","articleBody":"# Bug report\r\n\r\nWASI has a capability-based security concept. A process must have a valid handle to open a resource. For example WASI runtimes let processes only open files that are inside a directory tree for which the process owns a file descriptor. wasmtime implements this with [openat2(2)](https://man7.org/linux/man-pages/man2/openat2.2.html) with flags `RESOLVE_NO_MAGICLINKS | RESOLVE_BENEATH`. Any attempt to open a file outside results in `OSError: [Errno 76] Capabilities insufficient` (`ENOTCAPABLE` / `__WASI_ERRNO_NOTCAPABLE`).\r\n\r\n`getpath.py` runs into the capability issue in several places when the module attempts to read from landmark files `VENV_LANDMARK` and `BUILDDIR_TXT`. On wasmtime the WASI process starts with CWD=`/` (root). By default the process does not have capability to access `/`. Our tests currently work around the problem by mapping on the host `SRCDIR` to `/` inside the WASI environment. Without the mapping, Python startup fails with\r\n\r\n```\r\nException ignored error evaluating path:\r\nTraceback (most recent call last):\r\n File \"\u003cfrozen getpath\u003e\", line 353, in \u003cmodule\u003e\r\nOSError: [Errno 76] Capabilities insufficient\r\nFatal Python error: error evaluating path\r\nPython runtime state: core initialized\r\n```\r\n\r\n# Your environment\r\n\r\n`wasm32-wasi`\r\n\r\n# Fix proposal\r\n\r\n- expose `ENOTCAPABLE` in `errno` module\r\n- map `ENOTCAPABLE` to `PermissionError`. Insufficient capabilities is a sort of permission problem.\r\n- catch `PermissionError` additionally to `FileNotFoundError` at places that read `VENV_LANDMARK` and `BUILDDIR_TXT`","author":{"url":"https://github.com/tiran","@type":"Person","name":"tiran"},"datePublished":"2022-08-15T18:58:47.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/96005/cpython/issues/96005"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7defd50d-8258-cd68-75d7-8875c9b78432 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9D9E:366DBA:173F62C:1F19CDF:6969A848 |
| html-safe-nonce | 3a53be62b9ffe5f6fb8304b69400e89a1ac2912d83b25bb0ffa6bd6bab767dc6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDlFOjM2NkRCQToxNzNGNjJDOjFGMTlDREY6Njk2OUE4NDgiLCJ2aXNpdG9yX2lkIjoiOTE4ODI0NTkxNDg4MDk0NDIwMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c0cfefbca0e7543f0e28df21a158d7808108539c2a5f7118566ec0516e4e0e6b |
| hovercard-subject-tag | issue:1339367646 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/python/cpython/96005/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bd9178915a9a2655e5a0d9f717f81228544b2dfbeef6b90b21ae106675062b2d/python/cpython/issues/96005 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bd9178915a9a2655e5a0d9f717f81228544b2dfbeef6b90b21ae106675062b2d/python/cpython/issues/96005 |
| og:image:alt | Bug report WASI has a capability-based security concept. A process must have a valid handle to open a resource. For example WASI runtimes let processes only open files that are inside a directory t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tiran |
| hostname | github.com |
| expected-hostname | github.com |
| None | 24c4c97a2d520cb286b35e1a4c22d7a4df3c26a2fa28dd7cdf0e65db327b4de7 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 124667f43168afb6c9c03b7c02eb5b1d2e1be3d9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width