diff --git a/tools/Cargo.toml b/tools/Cargo.toml index 1a5ec3412..bd9b41262 100644 --- a/tools/Cargo.toml +++ b/tools/Cargo.toml @@ -39,10 +39,13 @@ serde_json = "1.0" # bao1x-api = { path = "../libs/bao1x-api" } bao1x-api = "0.1.0" # use crates.io to refer to this -# for remote resolution of github version in out-of-tree builds -reqwest = { version = "0.11", features = ["blocking", "json"] } -anyhow = "1.0" -toml = "0.8" +# for remote resolution of github version in out-of-tree builds. Note that pulling +# in this dependency tree *greatly* increases the attack surface of the SBOM. I don't +# think the convenience is worth it. But these are noted here in case we need to revisit +# this decision later. +# reqwest = { version = "0.11", features = ["blocking", "json"] } +# anyhow = "1.0" +# toml = "0.8" [[bin]] name = "xous-copy-object" diff --git a/tools/src/bin/xous-app-uf2.rs b/tools/src/bin/xous-app-uf2.rs index ab3605eac..3d2d6bc07 100644 --- a/tools/src/bin/xous-app-uf2.rs +++ b/tools/src/bin/xous-app-uf2.rs @@ -109,7 +109,20 @@ fn main() -> Result<(), Box> { let mut source = Cursor::new(Vec::new()); args.write(&mut source).expect("Couldn't write out ELF files"); - let version = xous_tools::git_remote_version::get_xous_version().unwrap_or("v0.0.0".to_string()); + // whack a dummy version into the image. This will cause version compatibility checks to fail, + // if and when they happen. The alternatives are: + // - force the user to specify a version. I think this annoys the user and they probably won't get it + // right + // - automatically resolve the version from the web. A commit + // e41195e3495cb27b447f0aec897c8928f29ced9d temporarily pulls in the code to do this, but the + // problem is that querying github to automatically resolve versions pulls in a *huge* attack + // surface, and also builds now try to tickle network resources which feels distasteful to me and + // not the right direction to go. + // + // So between two bad options, the decision for now is to do nothing and leave this field at 0, which + // as of now doesn't cause trouble but if in the future we want to do something where a kernel checks + // the version of a binary to make sure it's compatible before running it - it'll break. + let version = "v0.0.0".to_string(); let semver: [u8; 16] = SemVer::from_str(&version)?.into(); let result = xous_tools::sign_image::sign_image( diff --git a/tools/src/git_remote_version.rs b/tools/src/git_remote_version.rs index d85a566e8..32fc3d72f 100644 --- a/tools/src/git_remote_version.rs +++ b/tools/src/git_remote_version.rs @@ -1,3 +1,9 @@ +// This code is noted as an option we could pull into the tool set, but the problem with it is +// that its dependence on `reqwest` to interface with github to try and guess semantic versions +// pulls a huge amount of code into the dependency tree that I prefer not to have in the SBOM. +// Thus to get a semantic version users have to either check out tags, assign a version manually, +// or just go with a nil-rev on the versioning. + use std::collections::HashMap; use std::fs; diff --git a/tools/src/lib.rs b/tools/src/lib.rs index 05ab4131c..80b5b7d92 100644 --- a/tools/src/lib.rs +++ b/tools/src/lib.rs @@ -3,8 +3,11 @@ extern crate log; #[macro_use] pub mod xous_arguments; pub mod elf; -pub mod git_remote_version; pub mod sign_image; pub mod swap_writer; pub mod tags; pub mod utils; + +// This option is "hard-commented" out because we're trying to avoid even having +// the dependencies for this feature in our build system. +// pub mod git_remote_version;