Skip to content

Conversation

@kallal79
Copy link

Description:
This PR addresses two related issues:

Issue #42: TrustedServices errors when no softwareIds in evidence context

Problem: When attestation schemes return empty reference value IDs (common when no software components are provisioned), GetAttestation fails with "the supplied key is empty" error from kvstore.

Solution: Added validation in GetAttestation to skip empty reference IDs before calling kvstore.Get().

Impact: Allows attestation to succeed in environments without software components provisioned.

Integration Test Base64 Encoding Issue

Problem: PSA integration tests were failing with "illegal base64 data" when evcli psa create processed URL-safe base64 nonces.

Solution: Convert URL-safe base64 nonces to standard base64 before PSA token generation, matching existing CCA implementation.

Impact: Fixes integration test failures for PSA scheme.

Testing

  • All VTS tests pass
  • All PSA and CCA scheme tests pass
  • All verification and provisioning tests pass
  • Policy tests pass
  • Both fixes tested on clean upstream main branch

Related Issues

Fixes #42

@kallal79 kallal79 force-pushed the fix/trusted-services-empty-ref-ids branch from 0787c2e to 25cc480 Compare September 23, 2025 19:00

var multEndorsements []string
for _, refvalID := range appraisal.EvidenceContext.ReferenceIds {
// Skip empty reference IDs (can occur when no software components are provisioned)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This does not seem right. If there are no software compoments, then surely, appraisal.EvidenceContext.ReferenceIds itself should be empty, rather than contain an empty string?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks sir @setrofim — you're absolutely right, and the edge case is now handled.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Updated code still filters out empty string "IDs". My point was that I'm unclear on how they can occur -- when there no s/w components, the ReferenceIds list should just be empty. The fact that empty strings can occur looks like a but, and the correct solution would be to senure they're not inserted in the first place, rather than filtered out here.

Copy link
Author

Choose a reason for hiding this comment

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

New commit hashes:
777571e - Fix integration tests (base64 conversion) .
2f48d8c - Skip empty reference value IDs .
ac343f6 - Filter empty reference IDs at source .

Copy link
Collaborator

@setrofim setrofim Oct 3, 2025

Choose a reason for hiding this comment

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

???

Those are the commits I was refering to in my previsou message. You should NOT be checking for empty refID's when accessing appraisal.EvidenceContext.ReferenceIds. Those should not be in the list to begin with. The correct fix is not to skip/filter them out, but to prevent them from being added in the first place.

Copy link
Author

Choose a reason for hiding this comment

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

FIX

@kallal79 kallal79 force-pushed the fix/trusted-services-empty-ref-ids branch from 1dd4529 to b366f3e Compare October 2, 2025 01:42
@kallal79
Copy link
Author

kallal79 commented Oct 2, 2025

Kindly requesting re-review from @setrofim @yogeshbdeshpande @thomas-fossati for PR #343

…e64 for PSA tokens

- PSA evidence token generation (evcli psa create) expects standard base64 nonces
- Server now returns URL-safe base64 nonces in challenge-response sessions
- Added conversion from URL-safe to standard base64 for PSA claims generation
- Matches existing conversion logic already used for CCA tokens
- Resolves 'illegal base64 data' errors in integration tests

Signed-off-by: Kallal Mukherjee <[email protected]>
Fixes veraison#42. When attestation schemes return empty reference value IDs,
the GetAttestation method now skips them before calling kvstore.Get()
to avoid 'the supplied key is empty' errors.

This commonly occurs when no software components are provisioned
in trust anchors, causing handlers to return []string{""} for
missing software reference IDs.

Signed-off-by: GitHub Copilot <[email protected]>
Signed-off-by: Kallal Mukherjee <[email protected]>
This addresses the reviewer feedback from @setrofim about treating the
root cause rather than symptoms. Empty reference IDs are now filtered
immediately after GetRefValueIDs() to ensure EvidenceContext.ReferenceIds
never contains empty strings, rather than skipping them later in the loop.

This is a cleaner approach that prevents the issue from propagating
throughout the system and maintains data integrity at the source.

Signed-off-by: Kallal Mukherjee <[email protected]>
@kallal79 kallal79 force-pushed the fix/trusted-services-empty-ref-ids branch from b366f3e to ac343f6 Compare October 2, 2025 17:00
kallal79 added a commit to kallal79/services-kallal that referenced this pull request Oct 3, 2025
Previously, various attestation scheme handlers were incorrectly returning
[]string{""} (slice containing an empty string) when encountering errors
in GetTrustAnchorIDs, instead of returning nil or an empty slice. This
caused downstream code in TrustedServices.GetAttestation to receive and
process empty reference IDs.

This fix addresses the root cause by modifying all scheme handlers to:
- Return nil slices instead of slices containing empty strings on errors
- Properly propagate errors without malformed return values

Additionally, fixes base64 encoding in integration tests for PSA scheme
by converting URL-safe base64 nonces to standard base64.

This approach is cleaner than filtering empty strings downstream and
prevents the issue from propagating throughout the system, as suggested
by @setrofim in PR veraison#343.

Fixes veraison#42
@kallal79
Copy link
Author

kallal79 commented Oct 6, 2025

Kindly requesting re-review from @setrofim @yogeshbdeshpande @thomas-fossati for PR #343

}

// Filter out empty reference IDs (can occur when no software components are provisioned)
filteredReferenceIDs := make([]string, 0, len(referenceIDs))
Copy link
Collaborator

Choose a reason for hiding this comment

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

This filtering shoudn't be necessary.

Copy link
Author

Choose a reason for hiding this comment

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

fix

kallal79 added a commit to kallal79/services-kallal that referenced this pull request Oct 7, 2025
…y strings

- Store handlers now return nil/proper errors instead of []string{""}
- Removed unnecessary filtering logic in trustedservices_grpc.go
- Fixes issue mentioned by setrofim in PR veraison#343 review

The filtering shouldn't be necessary as store handlers should not
return empty reference IDs in the first place.
@kallal79
Copy link
Author

Requesting re-review and approval for PR #343 from sir @setrofim , sir @yogeshbdeshpande , sir @thomas-fossati , sir @cowbon ..

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.

Filtering is not the correct solution to handle empty string IDs.

Also, this seems to be conflicting with #338. Should this be closed?

@kallal79
Copy link
Author

Thanks @setrofim . Closing this PR due to conflict with #338, which better addresses the issue. Requesting review on PR #338 instead.

@kallal79 kallal79 requested a review from setrofim October 13, 2025 11:25
@setrofim setrofim closed this Oct 13, 2025
@kallal79 kallal79 deleted the fix/trusted-services-empty-ref-ids branch October 13, 2025 12:43
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.

BUG: Trusted Services errors when there are no softwareIds in the evidence context

2 participants