Skip to content

feat(zenoh): usrpwd password auth defaulting to machine id#3143

Draft
jeff-hykin wants to merge 6 commits into
mainfrom
jeff/feat/dimos_domain
Draft

feat(zenoh): usrpwd password auth defaulting to machine id#3143
jeff-hykin wants to merge 6 commits into
mainfrom
jeff/feat/dimos_domain

Conversation

@jeff-hykin

Copy link
Copy Markdown
Member

Summary

  • Adds optional Zenoh usrpwd authentication so sessions are scoped by a shared user/password.
  • Password defaults to the host machine id (DIMOS_ZENOH_PASSWORD / zenoh_password config), effectively partitioning discovery per machine.
  • Writes the auth dictionary file zenoh requires (0600, in CACHE_DIR/zenoh_auth) and folds user+password into the session-pool key.

Touches only 3 files: dimos/constants.py, dimos/core/global_config.py, dimos/protocol/service/zenohservice.py.

Notes

  • Includes a temp line silencing benign zenoh_transport::unicast::establishment "close (reason INVALID)" log spam — can drop before merge if unwanted.

Test plan

  • Two peers on the same machine (same machine id) connect and exchange messages.
  • Peers with different DIMOS_ZENOH_PASSWORD fail to establish a session.
  • Verify auth dictionary file is written with 0600 perms.

Adds optional Zenoh usrpwd authentication. Password defaults to the
machine id (via DIMOS_ZENOH_PASSWORD / zenoh_password config), scoping
sessions to a single host. Writes the required auth dictionary file and
folds user/password into the session pool key.
Comment thread dimos/protocol/service/zenohservice.py Fixed
directory.mkdir(parents=True, exist_ok=True)
digest = hashlib.sha256(f"{user}:{password}".encode()).hexdigest()[:16]
path = directory / f"{digest}.txt"
path.write_text(f"{user}:{password}\n")
…lobal config

- Add `dimos_domain` (default machine id, DIMOS_DOMAIN) as the isolation knob.
- `zenoh_password` now defaults to `dimos_domain` instead of the machine id directly.
- Expose `zenoh_username` (default "dimos", DIMOS_ZENOH_USERNAME) on global config.
- ZenohConfig user/password read from global config; drop the temp log-silence hack.
Hashes a domain string to a stable multicast group + port in the safe
admin-scoped space (239.255.76.0/24, dynamic ports). Not yet wired into
the default LCM url.
Derives the dictionary filename from the username only, so no password
hash lands in a filename (clears the CodeQL weak-hash-on-password alert).
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 6 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
dimos/protocol/service/lcmservice.py 33.33% 4 Missing ⚠️
dimos/constants.py 85.71% 0 Missing and 1 partial ⚠️
dimos/protocol/service/zenohservice.py 94.73% 0 Missing and 1 partial ⚠️
@@            Coverage Diff             @@
##             main    #3143      +/-   ##
==========================================
+ Coverage   73.33%   73.44%   +0.10%     
==========================================
  Files        1038     1049      +11     
  Lines       94300    94952     +652     
  Branches     8546     8651     +105     
==========================================
+ Hits        69154    69735     +581     
- Misses      22797    22837      +40     
- Partials     2349     2380      +31     
Flag Coverage Δ
OS-ubuntu-24.04-arm 66.35% <75.00%> (+0.17%) ⬆️
OS-ubuntu-latest 68.89% <75.00%> (+0.14%) ⬆️
Py-3.10 68.88% <75.00%> (+0.15%) ⬆️
Py-3.11 68.88% <75.00%> (+0.15%) ⬆️
Py-3.12 68.88% <75.00%> (+0.15%) ⬆️
Py-3.13 68.88% <75.00%> (+0.15%) ⬆️
Py-3.14 68.89% <75.00%> (+0.14%) ⬆️
Py-3.14t 68.88% <75.00%> (+0.14%) ⬆️
SelfHosted-Large 30.08% <44.44%> (+0.03%) ⬆️
SelfHosted-Linux 37.04% <75.00%> (-0.03%) ⬇️
SelfHosted-macOS 35.95% <77.77%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
dimos/core/global_config.py 83.51% <100.00%> (+0.56%) ⬆️
dimos/constants.py 77.41% <85.71%> (+2.41%) ⬆️
dimos/protocol/service/zenohservice.py 92.95% <94.73%> (+0.50%) ⬆️
dimos/protocol/service/lcmservice.py 85.71% <33.33%> (-4.84%) ⬇️

... and 31 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants