Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@HarshvMahawar
Copy link

@HarshvMahawar HarshvMahawar commented Jul 4, 2025

Add Conceptual Message Wrapper (CMW) evidence support


Type of Change

(Select all that apply)

  • New feature (non-breaking change)
  • Bug fix (non-breaking change)
  • Breaking change (fix/feature causing existing behavior to change)
  • Documentation update (standalone)
  • Code refactor (no functional changes)
  • Test cases (added/modified)
  • CI/CD changes
  • Other (please specify: ______)

Change Description

Concise Summary

Support CMW-based evidence collection instead of custom quote parsing

This PR adds initial support for receiving attestation evidence encoded using the Conceptual Message Wrapper (CMW), as prescribed by the IETF draft. It introduces decoding logic and replaces custom measurement list parsing when CMW is negotiated.


Technical Details

  • Added decode_cmw.py to handle CMW decoding and extract:

    • TPM quote
    • Signature
    • PCR values
    • Event log (IMA + Measured Boot)
  • Updated integrity quote handler to recognize CMW-formatted responses

  • Preserves compatibility with existing attestation flows:

    • If CMW is not negotiated, falls back to legacy parsing
    • If CMW is present, extracts measurement lists into standard Keylime structures
  • Motivation:

    • Align with standardized evidence formats
    • Improve interoperability
    • Simplify future maintenance of quote decoding logic
  • No breaking changes expected; clients not using CMW remain unaffected


Documentation Updates Required

(Check all that apply)

  • Updated markdown docs (file path: docs/cmw.md)
  • Updated code comments/docstrings
  • Needs user guide updates (docs/)
  • Needs ReadTheDocs updates
  • No docs needed (requires maintainer approval)

Verification Process

  1. Environment:

    • Keylime server (this branch)
    • rust-keylime agent (feature branch with CMW support)
  2. Procedure:

    • Start agent with CMW feature enabled
    • Configure server to request integrity quotes with CMW evidence
    • Validate that:
      • CMW is correctly received and parsed
      • IMA and MB measurement lists are populated
      • No regressions for legacy flows
  3. Expected vs actual results:

    • Quotes with CMW parse successfully
    • Quotes without CMW parse via legacy logic
    • Logs show expected measurement list entries

Checklist

  • Code follows project style guidelines
  • Unit/integration tests added or updated
  • Documentation updated
  • Commit messages follow Chris Beams’ guidelines
  • CHANGELOG updated (if applicable)
  • All tests pass (local & CI)

Additional Context

  • This PR should be merged in coordination with the agent-side CMW support branch
  • e2e test workflows will temporarily point to the agent feature branch until both PRs are merged

Copy link
Member

@THS-on THS-on left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding it!

  • Can you include tests for the decode function?
  • Maybe just rename it to cmw.py?
  • Please fix all the linter and style changes

return base64.urlsafe_b64decode(padded)


def read_tlv(stream: BytesIO):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return type missing

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, will add

tag, _, _ = read_tlv(stream)
if tag is None:
break
if tag != 0:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use constants and refrence the spec what they mean. Makes it more readable

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

}


def fetch_and_decode_cmw(url: str, cert: str, key: str, verify_ssl: bool = False) -> Dict[str, Any]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what is this function needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used this for manual decoding of CMW over API, it returns the decoded CMW to convectional KeylimeQuote object

will add docstrings

else:
try:
json_response = json.loads(response.body)
if agent['supported_version'] == '2.4':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can leave this for now but will need to put a proposal in to update it likely to something different

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

@HarshvMahawar
Copy link
Author

HarshvMahawar commented Jul 27, 2025

  • Please fix all the linter and style changes

idk why there are linting errors, tox didn't gave any errors in local run,

I will look into the errors again

@ansasaki
Copy link
Contributor

Please document the changes to the protocol messages. You can check how the PR #1753 updated the documentation and add there the changes related with these messages.

@ansasaki ansasaki mentioned this pull request Aug 27, 2025
30 tasks
@ansasaki ansasaki mentioned this pull request Sep 24, 2025
30 tasks
@ansasaki
Copy link
Contributor

ansasaki commented Oct 1, 2025

With the withdrawal of the proposal keylime/enhancements#126, the interest on standardized formats increase. Please consider rebasing this, and if possible, also make it work on the /evidence/verify endpoint.

It would be nice if backwards compatibility is kept, and that the cmw format is added as another evidence type, following the model used for the tee evidence type.

Later, when the push attestation PR is also merged, it would be nice to extend it to also accept the cmw evidence type.

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.

3 participants