Skip to content

Conversation

@sarroutbi
Copy link
Contributor

@sarroutbi sarroutbi commented Jul 2, 2025

This PR enhances the push-model agent by adding the complete logic for IMA and UEFI log collection and submission, making the attestation process asynchronous, and refactoring the agent's main loop for clarity and robustness.

Key Changes:

  • Full IMA and UEFI Log Collection:
    The agent now properly handles requests for IMA and UEFI event logs.

  • Asynchronous Attestation:
    The entire evidence creation process is now asynchronous to prevent blocking.

  • Code Refactoring and Cleanup:
    Added the core perform_attestation function to ContextInfo, centralizing the logic for creating attestation evidence.
    The main agent binary's logic has been significantly refactored. The main.rs file now orchestrates the high-level flow, while the specifics of sending HTTP requests and handling responses have been moved into a dedicated attestation.rs module.

@sarroutbi sarroutbi force-pushed the 202507021315-add-attestation-to-context-info branch 2 times, most recently from 3088cad to 3533b30 Compare July 2, 2025 11:26
@codecov
Copy link

codecov bot commented Jul 2, 2025

Codecov Report

Attention: Patch coverage is 48.81141% with 323 lines in your changes missing coverage. Please review.

Project coverage is 58.46%. Comparing base (9654555) to head (1448822).
Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
keylime-push-model-agent/src/attestation.rs 22.14% 109 Missing ⚠️
keylime/src/context_info.rs 51.51% 48 Missing ⚠️
keylime-push-model-agent/src/main.rs 45.20% 40 Missing ⚠️
keylime-push-model-agent/src/response_handler.rs 42.62% 35 Missing ⚠️
...ylime-push-model-agent/src/context_info_handler.rs 49.12% 29 Missing ⚠️
keylime-push-model-agent/src/struct_filler.rs 52.77% 17 Missing ⚠️
keylime/src/tpm.rs 64.58% 17 Missing ⚠️
keylime/src/ima/ima_log.rs 42.85% 16 Missing ⚠️
keylime/src/uefi/uefi_log_handler.rs 88.40% 8 Missing ⚠️
keylime-push-model-agent/src/url_selector.rs 83.33% 2 Missing ⚠️
... and 1 more
Additional details and impacted files
Flag Coverage Δ
e2e-testsuite 58.46% <48.81%> (-1.03%) ⬇️
upstream-unit-tests 58.46% <48.81%> (-1.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
keylime/src/ima/entry.rs 76.69% <100.00%> (+0.50%) ⬆️
keylime/src/structures/capabilities_negotiation.rs 75.00% <ø> (ø)
keylime-push-model-agent/src/url_selector.rs 66.66% <83.33%> (-3.47%) ⬇️
keylime/src/structures/evidence_handling.rs 64.19% <33.33%> (-1.63%) ⬇️
keylime/src/uefi/uefi_log_handler.rs 81.65% <88.40%> (+3.79%) ⬆️
keylime/src/ima/ima_log.rs 44.00% <42.85%> (-1.46%) ⬇️
keylime-push-model-agent/src/struct_filler.rs 21.75% <52.77%> (-5.35%) ⬇️
keylime/src/tpm.rs 68.26% <64.58%> (-0.08%) ⬇️
...ylime-push-model-agent/src/context_info_handler.rs 49.12% <49.12%> (ø)
keylime-push-model-agent/src/response_handler.rs 42.62% <42.62%> (ø)
... and 3 more

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sarroutbi sarroutbi force-pushed the 202507021315-add-attestation-to-context-info branch 9 times, most recently from 7420194 to 703142b Compare July 3, 2025 13:11
@sarroutbi sarroutbi force-pushed the 202507021315-add-attestation-to-context-info branch 10 times, most recently from 66c83c2 to 7a0bd46 Compare July 4, 2025 14:59
@sarroutbi sarroutbi marked this pull request as ready for review July 4, 2025 16:08
@sarroutbi sarroutbi requested review from ansasaki and sergio-correia and removed request for ansasaki and sergio-correia July 4, 2025 16:08
@sarroutbi sarroutbi marked this pull request as draft July 4, 2025 16:10
@sarroutbi sarroutbi force-pushed the 202507021315-add-attestation-to-context-info branch from 5e0796a to 910c049 Compare July 7, 2025 15:37
@sarroutbi sarroutbi force-pushed the 202507021315-add-attestation-to-context-info branch 2 times, most recently from 6f67573 to 21cebe0 Compare July 9, 2025 08:57
@sarroutbi sarroutbi marked this pull request as ready for review July 9, 2025 10:04
@sarroutbi
Copy link
Contributor Author

@ansasaki , @sergio-correia : Please, don't pay attention to coverage. Locally, files such as handle_response.rs are covered at 100% (checked with Tarpaulin):

image

sarroutbi added 2 commits July 9, 2025 16:46
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
@ansasaki ansasaki force-pushed the 202507021315-add-attestation-to-context-info branch from 21cebe0 to ebfef73 Compare July 9, 2025 16:33
sarroutbi and others added 11 commits July 9, 2025 18:55
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
This includes fixes to tests to avoid race conditions when accessing the
TPM

Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
Annotate unwrap() to allow it in tests

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
@ansasaki ansasaki force-pushed the 202507021315-add-attestation-to-context-info branch from ebfef73 to 1448822 Compare July 9, 2025 17:04
@ansasaki
Copy link
Contributor

ansasaki commented Jul 9, 2025

@sarroutbi I see from the test results that we need to merge #1042 before this one.

EDIT: It seems it won't be necessary. I'll merge this and rebase the other

@ansasaki ansasaki merged commit 8e65144 into keylime:master Jul 10, 2025
11 of 12 checks passed
@sarroutbi
Copy link
Contributor Author

@sarroutbi I see from the test results that we need to merge #1042 before this one.

EDIT: It seems it won't be necessary. I'll merge this and rebase the other

Cool. Thank you so much for your help with the rebase.

@sarroutbi sarroutbi deleted the 202507021315-add-attestation-to-context-info branch July 10, 2025 08:20
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