这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@WashingtonKK
Copy link
Owner

@WashingtonKK WashingtonKK commented Oct 16, 2025

What type of PR is this?

What does this do?

Which issue(s) does this PR fix/relate to?

  • Related Issue #
  • Resolves #

Have you included tests for your changes?

Did you document any new/modified feature?

Notes

Summary by CodeRabbit

  • Refactor
    • Switched attestation quote serialization from JSON to binary protobuf, reducing payload size and improving performance during attestation flows.
    • Updated TEE attestation handling to use direct protobuf unmarshalling for more consistent parsing and reliability.
    • No functional changes expected; users may notice faster responses and lower bandwidth usage in attestation operations.
  • Style
    • Minor formatting cleanup with no user-visible impact.

- Replace abi.ReportCertsToProto() with direct proto.Unmarshal() to bypass
  strict guest policy bit 17 validation that was failing
- Change protojson.Marshal() to proto.Marshal() for binary protobuf output

Signed-off-by: wkk <wkk@example.com>
- Remove fmt.Println debug statements from cmd/agent/main.go
- Remove fmt.Println debug statements from pkg/atls/certificate_provider.go
- Remove fmt.Println debug statements from pkg/attestation/azure/snp.go

Signed-off-by: wkk <wkk@example.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
@coderabbitai
Copy link

coderabbitai bot commented Oct 16, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Switches SEV/SNP attestation serialization from JSON to protobuf binary, updates vTPM TEE attestation handling to unmarshal protobuf directly into sevsnp.Attestation, and performs a minor formatting cleanup in Azure SNP code. No public APIs changed; error messages adjusted accordingly.

Changes

Cohort / File(s) Summary
Formatting cleanup
pkg/attestation/azure/snp.go
Removed an extra blank line; no logic changes.
SEV quote serialization
pkg/attestation/quoteprovider/sev.go
Replaced protojson marshaling with binary protobuf marshaling (protojson.Marshalproto.Marshal); updated imports accordingly.
vTPM TEE attestation unmarshalling
pkg/attestation/vtpm/vtpm.go
Replaced custom conversion (abi.ReportCertsToProto) with direct proto.Unmarshal into sevsnp.Attestation; adjusted error text.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Caller
  participant SEVQuoteProvider as SEV QuoteProvider
  participant vTPM as vTPM Attestation
  participant Proto as Protobuf

  Caller->>SEVQuoteProvider: Request SEV/SNP quote
  SEVQuoteProvider->>Proto: Marshal quote (binary)
  Proto-->>SEVQuoteProvider: []byte (protobuf)
  SEVQuoteProvider-->>Caller: Quote bytes (protobuf)

  Caller->>vTPM: Provide TEE attestation bytes
  vTPM->>Proto: Unmarshal bytes → sevsnp.Attestation
  Proto-->>vTPM: sevsnp.Attestation or error
  vTPM-->>Caller: Processed attestation (unchanged flow)

  note over SEVQuoteProvider,Proto: Changed: JSON → binary protobuf
  note over vTPM,Proto: Changed: direct protobuf unmarshal
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my nose at bytes that gleam,
From JSON’s lace to protobuf’s stream.
I hop through vTPM’s green glen,
Unmarshal truths, then hop again.
Carrots compiled, attestation tight—
A binary feast beneath the night. 🥕✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch snp_test

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 04b0cdf and 7807e38.

📒 Files selected for processing (3)
  • pkg/attestation/azure/snp.go (0 hunks)
  • pkg/attestation/quoteprovider/sev.go (2 hunks)
  • pkg/attestation/vtpm/vtpm.go (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@WashingtonKK WashingtonKK merged commit 3606f35 into main Oct 16, 2025
1 check passed
@WashingtonKK WashingtonKK deleted the snp_test branch October 16, 2025 02:41
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.

2 participants