Record WebCRT device login/commands and NE exec in operation audit.

Make session lifecycle and typed CLI lines searchable in audit_log with password redaction, and surface summaries plus device filters in the ops UI.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-01 21:36:44 +08:00
parent 497a5e048e
commit 8915455b52
12 changed files with 783 additions and 40 deletions

View file

@ -44,7 +44,8 @@ class WebcrtServiceTests(unittest.TestCase):
def tearDown(self) -> None:
self.setUp()
def test_session_write_resize_and_close(self) -> None:
@patch("netx_api.webcrt_session_model._audit")
def test_session_write_resize_and_close(self, _mock_audit: MagicMock) -> None:
conn = _FakeConn()
sess = svc.WebcrtSession(
session_id="s1",
@ -342,7 +343,8 @@ class WebcrtServiceTests(unittest.TestCase):
self.assertIn("<r1>", echo)
self.assertFalse(sess.needs_live_prompt)
before = list(fake.written)
sess.write_stdin("\n")
with patch("netx_api.webcrt_session_model._audit"):
sess.write_stdin("\n")
self.assertEqual(fake.written[len(before) :], ["\n"])
svc.close_session(out["session_id"], reason="test")