Title: id(directory): DirectoryAuth::sessions is unbounded while sibling maps are hard-capped · Issue #10643 · developing-today/code · GitHub
Open Graph Title: id(directory): DirectoryAuth::sessions is unbounded while sibling maps are hard-capped · Issue #10643 · developing-today/code
X Title: id(directory): DirectoryAuth::sessions is unbounded while sibling maps are hard-capped · Issue #10643 · developing-today/code
Description: Evidence pkgs/id/crates/id-directory/src/directory_auth.rs: open_session (:161-174) inserts one SessionRecord per call after only an expired-entry retain — no limit constant, no refusal path. SESSION_TTL_MS is 12h (:23), and principal() ...
Open Graph Description: Evidence pkgs/id/crates/id-directory/src/directory_auth.rs: open_session (:161-174) inserts one SessionRecord per call after only an expired-entry retain — no limit constant, no refusal path. SESSI...
X Description: Evidence pkgs/id/crates/id-directory/src/directory_auth.rs: open_session (:161-174) inserts one SessionRecord per call after only an expired-entry retain — no limit constant, no refusal path. SESSI...
Opengraph URL: https://github.com/developing-today/code/issues/10643
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"id(directory): DirectoryAuth::sessions is unbounded while sibling maps are hard-capped","articleBody":"## Evidence\n\n`pkgs/id/crates/id-directory/src/directory_auth.rs`:\n\n- `open_session` (`:161-174`) inserts one `SessionRecord` per call after only an expired-entry `retain` — no limit constant, no refusal path. `SESSION_TTL_MS` is 12h (`:23`), and `principal()` (`:177-185`) only removes the single token looked up, so every unexpired entry survives until the next `open_session`.\n- The same struct hard-caps its siblings: pending email codes (`CODE_PENDING_LIMIT` 4096 + `CODE_PENDING_PER_ACCOUNT` 16, `:31-36`, enforced `:235-251`, introduced in #5749) and signed-request replay nonces (`SIGNED_NONCE_LIMIT` 4096 + per-key sub-limit, `:38-45`, enforced `:373-383`), each refusing with `Refusal::RateLimited`.\n- Reachability: `DirectoryAction::OpenSession` (`directory_view.rs:1195-1202`) mints a session for any resolved account/admin viewer — one valid credential yields unlimited 12-hour entries.\n\n## Why it matters\n\nOne authenticated caller can grow `sessions` without bound (memory exhaustion / degraded `retain` scans on every open). The crate already decided this class of map must be bounded (#5749); sessions are the odd one out.\n\n## Acceptance criteria / suggested fix\n\nMirror the code/nonce pattern: a global `SESSION_LIMIT` plus a per-principal sub-limit, checked after the expired-entry sweep in `open_session`, refusing with `Refusal::RateLimited`. Add cap tests analogous to `pending_codes_are_capped_globally…` (`:786`) and the nonce cap tests (`:1063` region); the existing session test (`a_session_lasts_its_ttl_and_closes_on_request`, `:519-528`) covers TTL + close only.\n\nDeduped: `gh search issues` for session caps in this repo returns only unrelated claimant/queue items; no open PR touches `directory_auth.rs`. Verified against origin/main `81d10205bf` (read-only worktree).","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-11-16T08:58:13Z","url":"https://github.com/developing-today/code/issues/10643"}
| 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 | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bcb95099-8f59-1cb1-c606-c14e1f52d1f3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AA6E:2E4E6F:1D031F:272097:6B0612F7 |
| html-safe-nonce | fc5641862a126203f0c8e0cb37c1d8919c3a7223aea814a0ccbbe4f4fd174f96 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQTZFOjJFNEU2RjoxRDAzMUY6MjcyMDk3OjZCMDYxMkY3IiwidmlzaXRvcl9pZCI6IjY5MTY0OTUyMDkzMzM2NTgzNTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 98e40a6be71a0141cb0c6f27bdc544362f55c59bf6933c37b8d471bcac049d1a |
| hovercard-subject-tag | issue:6417741053 |
| 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/developing-today/code/10643/issue_layout |
| twitter:image | https://opengraph.githubassets.com/960fe9e41de0daadf6015b85c81756783a849385f07032c04aadfe902dd13fed/developing-today/code/issues/10643 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/960fe9e41de0daadf6015b85c81756783a849385f07032c04aadfe902dd13fed/developing-today/code/issues/10643 |
| og:image:alt | Evidence pkgs/id/crates/id-directory/src/directory_auth.rs: open_session (:161-174) inserts one SessionRecord per call after only an expired-entry retain — no limit constant, no refusal path. SESSI... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | e58943f0186bb8d97b217393c2724a49ab47e4aefefc43595a90fa04699066c9 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| 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 | 23517473abc6d5da019b4958bd421644e98a418b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width