{"id":"CVE-2026-49997","title":"SurrealDB: Edge PERMISSIONS FOR delete bypassed when a connected node is deleted","summary":"SurrealDB: Edge PERMISSIONS FOR delete bypassed when a connected node is deleted","severity":"medium","cvss":5.4,"cwe":["CWE-285","CWE-863"],"vendor":"surrealdb","product":"surrealdb","ecosystem":"rust","affected":["surrealdb < 3.1.0"],"patched":["surrealdb 3.1.0"],"published":"2026-07-01","updated":"2026-07-01","source":"GHSA","sourceUrl":"https://github.com/advisories/GHSA-whwg-vh4f-pmmf","references":[{"url":"https://github.com/surrealdb/surrealdb/security/advisories/GHSA-whwg-vh4f-pmmf"},{"url":"https://github.com/surrealdb/surrealdb/pull/242"},{"url":"https://github.com/surrealdb/surrealdb/commit/a80d1784cf75358441978bbd77688855e95f4578"},{"url":"https://github.com/advisories/GHSA-whwg-vh4f-pmmf"}],"tags":["ghsa","rust"],"ingestedAt":"2026-07-01T21:17:11.618Z","epss":0.00347,"epssPercentile":0.28285,"slug":"CVE-2026-49997","body":"## Overview\n\nIn SurrealDB, records can be connected as a graph: a `RELATE` statement creates an edge record between two node records. If either endpoint node is deleted, SurrealDB automatically removes the edge row to keep the graph consistent.\n\nA user with permission to delete a node could also delete the edges connected to that node, even when the edge table's `PERMISSIONS FOR delete` clause should have stopped them.\n\nThe automatic edge removal (`Document::purge_edges`) ran with permissions disabled (`opt.clone().with_perms(false)`), so the edge table's `PERMISSIONS FOR delete` and `PERMISSIONS FOR select` clauses were never consulted. The removal step could also observe edge state that the edge's SELECT clause should have hidden.\n\n### Impact\n\nWhat an attacker **can** do:\n\n- Delete any edge connected to a node they can delete, regardless of the edge table's `PERMISSIONS FOR delete` clause.\n- Observe edge contents that `PERMISSIONS FOR select` should have hidden, as a side effect of the same edge-removal step.\n\nWhat it **can't** do:\n\n- Delete nodes on tables they do not hold `DELETE` on (the edge removal only runs from an authorised node delete).\n- Cross namespace or database isolation boundaries.\n- Escalate to root or operator-level privileges.\n\n### Patches\n\n`Document::purge_edges` now propagates the caller's permission context into the edge removal. Each connected edge `DELETE` is evaluated against the edge table's `PERMISSIONS FOR delete` clause, matching a direct `DELETE`.\n\nVersions 3.1.0 and later are not affected.\n\n### Workarounds\n\n- Restrict node `DELETE` permission to principals trusted to delete all connected edge records.\n- Use namespace or database isolation as the primary boundary where edge-level `PERMISSIONS` is load-bearing for multi-tenant separation.\n\n## Affected packages\n\n- `surrealdb < 3.1.0`\n\n## Remediation\n\nUpgrade to a patched release:\n\n- `surrealdb 3.1.0`","depth":"sunlit","depthScore":30,"depthScoreParts":{"impact":29.7,"likelihood":0.1,"exploitation":0,"ransomware":0},"changes":[]}