docs: overhaul README.md and snpguest.1.adoc#139
Conversation
bf593dc to
d9277a2
Compare
DGonzalezVillal
left a comment
There was a problem hiding this comment.
A few nit picks and discussion points, but this is an AMAZING pr. I really really appreciate it.
| Without [-p, --platform] or [-r, --random], the user can pass 64 bytes of data in any file format into $REQUEST_FILE to request an attestation report. The request file is interpreted as raw binary, and the first 64 bytes of the binary are sent to the AMD-SP as the request data. The request data will be bound to the REPORT_DATA field in the attestation report. | ||
| With the [-r, --random] flag, this command generates a random data for the request, which will be written into $REQUEST_FILE. | ||
| The [-v, --vmpl] option specifies the Virtual Machine Privilege Level (VMPL) to request an attestation report. The default value is 1. If you specify a higher privilege level (i.e. smaller VMPL value) than the actual one, a firmware error will occur. | ||
| With the [-p, --platform] flag, this command retrieves an attestation report from vTPM instead of the ASP, and writes the Report Data field in the retrieved report into $REQUEST_FILE. This attestation route is available (and mandatory) on Microsoft Azure Confidential VMs with SEV-SNP isolation. This flag requires the `hyperv` feature. Currently, only the pre-generated attestation report can be retrieved with this command. |
There was a problem hiding this comment.
I think this attestation route is currently ONLY available on Azure right? I don't think using platform will work on Linux.
I would clarify that this is a pre-generated report stored on the vTPM and that the Report Data field is pre filled. What goes on REQUEST_FILE is what was already present.
I don't think it's wrong just a little clearer on how this flag works.
There was a problem hiding this comment.
Basically yes. It is only available on CVMs that implement this design using Microsoft's open source OpenVMM/HCL. AFAIK, no other commercial environment uses this. So I think this flag should be called something else, such as openhcl or azurecvm.
| - Verify that the REPORTED_TCB and CHIP_ID fields in the report matches the given certificate. The `-s, --signature` option skips this step. | ||
| - Verify the report signature using the given certificate. The `-t, --tcb` option skips this step. |
There was a problem hiding this comment.
Again subtle difference in functionality. Using -s checks only for signature and -t checks only for t. If they are used jointly, then they both will be checked, not both be skipped.
There was a problem hiding this comment.
In fact, if both -t (or -s) and report content flags (e.g. -m) are specified, snpguest verify attestation will verify not only TCB (or signature) but specified report contents:
Lines 452 to 466 in 5540f31
The flags -t and -s conflicts with each other:
Lines 199 to 205 in 5540f31
Rather than changing the documentation, it might be better to change the code.
Related Issue: #132
There was a problem hiding this comment.
Oh I see, I missed the conflicts_with argument, that is my bad
27e7af8 to
2a56555
Compare
This commit aligns the documentation with the actual CLI implementation and adds several previously missing subcommands. Co-authored-by: DGonzalezVillal <97119524+DGonzalezVillal@users.noreply.github.com> Signed-off-by: Takuma IMAMURA <209989118+hyperfinitism@users.noreply.github.com>
459807b to
4c283cc
Compare
|
@DGonzalezVillal Thank you for your detailed review! All comments except for a few have been addressed and the commits have been squashed. |
|
We now maintain similar content in both |
This is a good point and something I was thinking about while reviewing your PR. I think technically speaking the adoc is supposed to be generally used for more detailed, structured, and feature-rich documentation. The purpose of a README file is to provide a concise, high-level introduction. I've always thought that the best way to organize the documentation would be to put the long description of each command in the adoc and then the readme would point to the adoc. In the readme I would keep the instructions on how to build the project and the different attestation workflows users could follow, but with not as much detail. Let me know your thoughts on that. |
|
Thank you for your feedback. I largely agree. Specifically, I think the following approach makes sense:
The typical usage pattern (e.g. This keeps the README concise, reduces the risk of docs drifting from the implementation, and lowers maintenance costs. As a follow-up, we could also enforce doc hygiene in CI (e.g. rustdoc builds and/or treating doc warnings as errors) so contributors are nudged to keep documentation up to date. |
|
Hello @hyperfinitism I agree with this approach. Do you think you can take care of those changes in this PR? |
|
Hey @hyperfinitism were you able to take a look at those changes? |
|
Since opening this PR, several changes have been merged to the main branch. Because of this, the documentation needs to be updated based on the current state of the codebase. Under the new documentation approach (cargo-rdme + rustdoc), all components of the code should also have proper docstrings, many of which are currently missing. While working on this, I have been rereading the entire codebase to fix existing documentation issues at the same time. So the process is taking some time. Also, #141 introduced relatively large changes. If that PR gets merged, part of the documentation restructuring work in this PR may become unnecessary, so it might be better to wait for that before continuing. |
Add module-level documentation (//!) and doc comments (///) to all source files to support `cargo doc` and prepare for `cargo rdme` README generation. Changes per file: - main.rs: Add top-level crate documentation with usage overview and subcommand table; add #![deny(missing_docs)] to enforce documentation on public items; fix SnpGuestCmd variant descriptions to match actual behavior - report.rs: Document ReportArgs fields accurately; fix --random help (was misleading about default file path); fix --platform help to describe vTPM retrieval on Azure CVMs - certs.rs: Document CertPaths, CertFormat, CertificatesArgs, and all public functions - fetch.rs: Document FetchCmd, Endorsement, ProcType enums; document all submodule Args structs and functions; improve fetch ca/vcek/crl argument descriptions - verify.rs: Fix critical help text errors from issue virtee#132: --tcb now correctly described as "verify TCB only (skip signature)" instead of "run TCB verification exclusively"; --signature now correctly described as "verify signature only (skip TCB)" instead of "run signature verification exclusively"; document decode_hex_or_decimal behavior mismatch (issue virtee#135); document all verification functions - display.rs: Document DisplayCmd and subcommand functions - key.rs: Document KeyArgs with accurate Guest Field Select bit descriptions; document message version auto-selection behavior - ok.rs: Document SEV status MSR bitfield and capability test framework - preattestation.rs: Document all generate subcommands (measurement, ovmf-hash, id-block, key-digest) with accurate argument descriptions - clparser/mod.rs: Document auto-radix parser and FromStrRadix trait - hyperv/mod.rs: Document Hyper-V detection logic and vTPM report retrieval Source of truth: actual code behavior on main branch and the corrected README.md from PR virtee#139 (docs-overhaul branch). https://claude.ai/code/session_01YFz1JMARmZYNFwTQ6juM7Z
The existing documentation (README.md and docs/snpguest.1.adoc) was out of sync with the actual
snpguestCLI: README.md omitted numerous subcommands, and descriptions of flags and summary lines were inaccurate (e.g., #132, #135, #138).This pull request overhauls README.md and docs/snpguest.1.adoc to (partly) resolve these issues.
snpguest oksnpguest generate measurementsnpguest generate ovmf-hashsnpguest generate id-blocksnpguest generate key-digest