Repository navigation
trident-acl-agent: verify Node systemUUID matches local hardware #837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bfjelds (bfjelds)
merged 18 commits into
main
from
user/bfjelds/acl-agent-node-uuid-verify
Oct 22, 2026
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
8009dba
trident-acl-agent: verify Node systemUUID matches local hardware
bfjelds d37abd9
storm aclagent tests: seed fake Node with real VM product uuid
bfjelds a846cab
storm aclagent tests: cover systemUUID-mismatch node-gone handling
bfjelds 8e61b43
trident-acl-agent: skip systemUUID check when Node reports empty value
bfjelds 9e1baf7
storm aclagent tests: read VM product_uuid with sudo
bfjelds 352e9af
trident-acl-agent: fix rustfmt formatting
bfjelds 8ee9abc
trident-acl-agent: gate Node systemUUID verification behind an env var
bfjelds 63704fe
acl-agent: cover watch_node identity check, dedupe UUID probe, fix co…
bfjelds 5b375f0
acl-agent: use shared dmi reader in verify_node_identity, fix stale e…
bfjelds 05ca699
acl-agent: add e2e phase exercising watch-stream identity verification
bfjelds 1558e50
acl-agent: migrate node-identity env var to the envy config system
bfjelds 8991272
fix: centralize typed DMI UUID reads and handle missing identity
bfjelds def7f86
test: isolate GET-side Node UUID validation
bfjelds a4bfc49
osutils,trident: preserve product_uuid case in telemetry asset_id
bfjelds ff54168
Merge remote-tracking branch 'origin/main' into user/bfjelds/acl-agen…
Copilot 2852a23
test: use default COSI labels source in UUID validation image
bfjelds cc90bff
trident-acl-agent: log effective Node UUID validation setting
bfjelds 61a4f07
Merge remote-tracking branch 'origin/main' into user/bfjelds/acl-agen…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| //! Helpers for reading hardware identity information exposed by the kernel's | ||
| //! DMI (Desktop Management Interface) sysfs tree. | ||
|
|
||
| use std::path::Path; | ||
|
|
||
| use anyhow::{Context, Error}; | ||
|
|
||
| use sysdefs::osuuid::OsUuid; | ||
|
|
||
| use crate::files; | ||
|
|
||
| /// Path to the hardware product UUID exposed by the kernel. kubelet | ||
| /// populates a Node's `status.nodeInfo.systemUUID` from this same file, and | ||
| /// Trident's tracing metadata uses it as an asset identifier. | ||
| pub const PRODUCT_UUID_PATH: &str = "/sys/class/dmi/id/product_uuid"; | ||
|
|
||
| /// Reads and trims the hardware product UUID from [`PRODUCT_UUID_PATH`]. | ||
| /// Canonicalizes a well-formed UUID (e.g. lowercases its hex digits) - use | ||
| /// this for typed comparisons (e.g. against Kubernetes systemUUID), but see | ||
| /// [`read_product_uuid_raw`] for contexts where that canonicalization itself | ||
| /// would be an unwanted behavior change. | ||
| pub fn read_product_uuid() -> Result<OsUuid, Error> { | ||
| read_uuid_from(PRODUCT_UUID_PATH) | ||
| } | ||
|
|
||
| /// Reads and trims the hardware product UUID from [`PRODUCT_UUID_PATH`] as | ||
| /// its original raw text, preserving casing verbatim. Unlike | ||
| /// [`read_product_uuid`], this does not parse/canonicalize the value - use | ||
| /// it for display-only/telemetry contexts (e.g. `trident`'s tracestream | ||
| /// `asset_id`) where changing an existing uppercase UUID's case across an | ||
| /// upgrade would silently change that identifier's representation. | ||
| pub fn read_product_uuid_raw() -> Result<String, Error> { | ||
| read_raw_from(PRODUCT_UUID_PATH) | ||
| } | ||
|
|
||
| fn read_uuid_from(path: impl AsRef<Path>) -> Result<OsUuid, Error> { | ||
| read_raw_from(path).map(OsUuid::from) | ||
| } | ||
|
|
||
| fn read_raw_from(path: impl AsRef<Path>) -> Result<String, Error> { | ||
| files::read_file_trim(&path.as_ref()) | ||
| .with_context(|| format!("Failed to read UUID from '{}'", path.as_ref().display())) | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
|
|
||
| use std::fs; | ||
|
|
||
| #[test] | ||
| fn reads_and_trims_product_uuid() { | ||
| let dir = tempfile::tempdir().unwrap(); | ||
| let path = dir.path().join("product_uuid"); | ||
| for value in ["1234-ABCD", "6BA7B810-9DAD-11D1-80B4-00C04FD430C8", ""] { | ||
| fs::write(&path, format!(" {value}\n")).unwrap(); | ||
| assert_eq!(read_uuid_from(&path).unwrap(), OsUuid::from(value)); | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn reads_and_trims_raw_product_uuid_preserving_case() { | ||
| let dir = tempfile::tempdir().unwrap(); | ||
| let path = dir.path().join("product_uuid"); | ||
| // An uppercase, well-formed UUID must come back verbatim (not | ||
| // lowercased), unlike read_uuid_from/OsUuid's canonicalized Display. | ||
| fs::write(&path, " 6BA7B810-9DAD-11D1-80B4-00C04FD430C8\n").unwrap(); | ||
| assert_eq!( | ||
| read_raw_from(&path).unwrap(), | ||
| "6BA7B810-9DAD-11D1-80B4-00C04FD430C8" | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn errors_for_missing_file() { | ||
| let dir = tempfile::tempdir().unwrap(); | ||
| let path = dir.path().join("missing"); | ||
| let error = read_uuid_from(&path).unwrap_err(); | ||
| assert!( | ||
| error.to_string().contains(&path.display().to_string()), | ||
| "{error:#}" | ||
| ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.