Skip to content

Conversation

Sukuna0007Abhi
Copy link

@Sukuna0007Abhi Sukuna0007Abhi commented Sep 23, 2025

Description:
This PR implements support for TPM vendor and model information in TPM endorsements, addressing Issue #139.

Changes include:

  • Extended TaAttr structure with vendor and model fields
  • Added input validation and sanitization for security
  • Implemented comprehensive test coverage:
    • Real-world TPM vendor/model combinations
    • International character handling
    • Security test cases
    • Edge cases and input validation
  • Updated documentation with new fields and security considerations

Security Considerations:

  • Implemented strict input validation
  • Added sanitization for potentially dangerous inputs
  • Protected against injection attacks
  • Enforced character and length limits

Testing:

  • Added extensive test suite covering:
    • Common TPM vendors (Infineon, STMicroelectronics, etc.)
    • International vendor names (Unicode support)
    • Security test cases (injection attempts)
    • Edge cases and combinations
    • Character type handling

Documentation:

  • Updated README.md with new field descriptions
  • Added security considerations
  • Included usage examples

Resolves: #139

Ready for Review sir @thomas-fossati @setrofim @yogeshbdeshpande

This change implements support for TPM vendor and model information in TPM
endorsements (Issue veraison#139). The implementation includes:

- Extended TaAttr structure with vendor and model fields
- Input validation and sanitization for security
- Comprehensive test coverage including:
  * Real-world TPM vendor/model combinations
  * International character handling
  * Security test cases
  * Edge cases and input validation
- Updated documentation with new fields and security considerations

Signed-off-by: Sukuna0007Abhi <[email protected]>
@Sukuna0007Abhi Sukuna0007Abhi changed the title Title: scheme/parsec-tpm: Add TPM vendor and model information Title: Scheme/parsec-tpm: Add TPM vendor and model information Sep 23, 2025
"key": [{
"type": "pkix-base64-key",
"value": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAETKRFE_RwSXooI8DdatPOYg_uiKm2XrtT_uEMEvqQZrwJHHcfw0c3WVzGoqL3Y_Q6xkHFfdUVqS2WWkPdKO03uw==",
"parameters": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't believe CoRIM crypto keys have additional parameters. Is this some extension or proposed change to the spec?

Copy link
Author

Choose a reason for hiding this comment

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

Hi sir @setrofim You're absolutely right to question this - CoRIM crypto keys in the standard specification do not have additional parameters.

This is indeed a Veraison-specific extension to the CoRIM spec. The standard IETF CoRIM specification defines crypto keys with only type and value fields.

I've implemented this extension because:

TPM-specific needs: TPM vendor/model information doesn't map naturally to the standard environment.class structure used by other schemes (like PSA)

Parsec profile: This follows the custom Parsec TPM profile ("tag:github.com/parallaxsecond,2023-03-03:tpm") which allows for scheme-specific extensions

Optional & backward compatible: Existing CoRIMs continue to work - this only adds optional metadata
I've updated the documentation to clearly indicate this is a Veraison extension and not part of the standard CoRIM specification. The implementation validates against our specific profile rather than claiming standard compliance.

Should I consider an alternative approach that stays closer to standard CoRIM, or is this extension acceptable for the parsec-tpm scheme's specific requirements? Pls reply

Copy link
Collaborator

Choose a reason for hiding this comment

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

crypto-key-type-choice offers "type choice" rather than "map" extension point. Meaning you cannot add fields to existing values, you can only add new types. So you cannot add parameters to, e.g., "pkix-base64-key", you'd need to define a whole new type, "pkix-base64-key-with-params" and register that as an extension to the type choice (and then do the same for every other variant that needs to be extended in this way).

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for guiding sir @setrofim, understood

Copy link
Author

Choose a reason for hiding this comment

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

Ready for review sir

Following @setrofim's feedback that crypto-key-type-choice uses
'type choice' not 'map' extension point, refactored to comply with
standard CoRIM specification.

Changes:
- REMOVED: key.Parameters approach (invalid per CoRIM spec)
- ADDED: Extract vendor/model from environment.class (standard location)
- Follows same pattern as PSA scheme
- Fixed regex backreference issues in sanitization
- Updated README with complete, valid CoRIM examples
- Deleted ta_attrs.go and related test files (wrong approach)
- All tests passing

This addresses the review comment that we cannot add parameters
to existing key types like 'pkix-base64-key'. Instead, vendor/model
are now stored in the standard environment.class location.

Resolves: CoRIM specification compliance issue

Signed-off-by: Sukuna0007Abhi <[email protected]>
@Sukuna0007Abhi Sukuna0007Abhi force-pushed the feature/tpm-vendor-model branch from 67d95ec to 7949f54 Compare October 4, 2025 13:05
@Sukuna0007Abhi
Copy link
Author

Ready for review sir @setrofim sir @yogeshbdeshpande sir @thomas-fossati

Copy link
Collaborator

@setrofim setrofim left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@yogeshbdeshpande yogeshbdeshpande left a comment

Choose a reason for hiding this comment

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

Please check my comments!

@@ -0,0 +1,213 @@
// Copyright 2024 Contributors to the Veraison project.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am wondering this generic implementation of string validation and checking for specific patterns is applicable more generically across entire Services scheme and could be moved to services/common ??

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this validation is particularly generic. For example, dangerousChars set does not include some punctuation that one may want to escape in other contexts (e.g. @, -, =, +, etc). Some checks (hasExcessiveRepitition, 'hasAbnormalDistribution`) use seemingly arbitrary thresholds. This all seems reasonable for Parsec/TPM (at least, for the prespective of someone not intimately familiar with the specs). However, if we want something generic, this is inadequate.

I'm not even sure we want generic santization -- different systems have different restriction on what they accept and what needs to be escaped (e.g. URL vs DB input vs environment/shell variables). It is better to do specific filtering/escaping at the point where it is relevant. Otherwise we just end up with iflters that are overly restrictive or result in excessive escaping.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok, understood, thanks. Are these then coming from a spec reference for restriction in TPM specific scene setting?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not that I'm aware of (as I've said -- I'm not familiar with the specs). But this looks like it's designed specifically to catch "unreasonable" vendor/model names. From that point of view, the implementation looks reasonable. But I would not accept this as a good generic santizer (not do I think it's necesarily a good idea to have one).

Sukuna0007Abhi and others added 2 commits October 6, 2025 22:06
Signed-off-by: Sukuna0007Abhi <[email protected]>

Co-authored-by: Yogesh Deshpande <[email protected]>
Signed-off-by: Sukuna0007Abhi <[email protected]>

Co-authored-by: Yogesh Deshpande <[email protected]>
@yogeshbdeshpande
Copy link
Collaborator

@Sukuna0007Abhi Let us discuss this PR in Veraison Meeting on 07/10/2025

@Sukuna0007Abhi
Copy link
Author

Sure sir, @yogeshbdeshpande will try my best, to explain properly 🙏

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.

Parsec TPM endorsements - consider extending with vendor and model info
3 participants