Skip to content

feat(kas): emit INFO log of supported mechanisms at startup (DSPX-3456)#3564

Merged
dmihalcik-virtru merged 14 commits into
mainfrom
DSPX-3456-log-supported-kao-mechanisms-at-info-during-startu
Jun 4, 2026
Merged

feat(kas): emit INFO log of supported mechanisms at startup (DSPX-3456)#3564
dmihalcik-virtru merged 14 commits into
mainfrom
DSPX-3456-log-supported-kao-mechanisms-at-info-during-startu

Conversation

@dmihalcik-virtru
Copy link
Copy Markdown
Member

@dmihalcik-virtru dmihalcik-virtru commented Jun 4, 2026

Summary

  • Adds INFO msg="kas trust mechanisms initialized" mechanisms=[...] log line at KAS startup and on hot config reload
  • Algorithm list sourced from static metadata declared at manager registration time
  • Filtered by preview-feature gating to match rewrap.o\ acceptance logic (ec/hybrid types suppressed unless the corresponding flag is enabled)
  • Gives operators and integration tests an authoritative, low-noise view of which cryptographic mechanisms this KAS instance will serve

Implementation

Extended NamedKeyManagerCtxFactory with a SupportedAlgorithms []ocrypto.KeyType field (optional; empty means the manager contributes nothing to capability listings)

🤖 Generated with Claude Code

dmihalcik-virtru and others added 2 commits June 3, 2026 15:41
log supported kao mechanisms at info during startup
Adds a single `INFO msg="kas initialized" mechanisms=[...]` log line at
service startup and on hot config reload, giving operators and the xtest
integration suite an authoritative, low-noise way to discover which
cryptographic mechanisms this KAS will serve.

The mechanism list reflects what the registered trust KeyManagers are
*capable* of serving (independent of currently provisioned keys) via a
new optional `trust.AlgorithmAdvertiser` interface, then is filtered to
match the gating in `rewrap.go` so the log only advertises algorithms
rewrap would actually accept (drops `ec:*` unless ECTDFEnabled, drops
`hpqt:*` unless HybridTDFEnabled — top-level or preview flag).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>
@dmihalcik-virtru dmihalcik-virtru requested review from a team as code owners June 4, 2026 13:17
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the KAS observability by emitting an INFO-level log entry at startup and configuration reload that explicitly lists the supported cryptographic mechanisms. This change provides operators and automated test suites with an authoritative, low-noise way to discover capabilities without needing to enable DEBUG logging or perform external HTTP probes. The implementation introduces a new capability interface for key managers and ensures that the advertised algorithm list respects current preview-feature gating.

Highlights

  • New Capability Interface: Introduced the trust.AlgorithmAdvertiser interface to allow KeyManagers to report their supported cryptographic algorithms.
  • Mechanism Discovery: Implemented SupportedAlgorithms() across BasicManager and InProcessProvider, with an aggregator in DelegatingKeyService to provide a unified, deduplicated list.
  • Startup Logging: Added an INFO-level log entry at KAS startup and config reload that lists all supported mechanisms, filtered by active preview-feature gates.
  • Testing: Added comprehensive unit tests for mechanism filtering, log output verification, and the new aggregation logic in DelegatingKeyService.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.


At startup the KAS takes a look, At algorithms written in the book. With an INFO log line, It makes the state shine, And helps all the tests off the hook.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions Bot added the comp:kas Key Access Server label Jun 4, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR introduces cryptographic algorithm advertisement throughout the KAS trust system. Key managers export canonical supported-algorithm lists; DelegatingKeyService aggregates them without instantiating managers; KAS logs mechanisms at startup, filtering by preview gates. Comprehensive test coverage validates deduplication, sorting, and nil-safety.

Changes

Algorithm Advertisement and KAS Mechanism Initialization

Layer / File(s) Summary
Algorithm advertisement infrastructure in key managers
service/internal/security/basic_manager.go, service/internal/security/in_process_provider.go, service/trust/key_manager.go
BasicManager and InProcessProvider export canonical []ocrypto.KeyType slices; NamedKeyManagerCtxFactory adds optional SupportedAlgorithms field; BasicManager error logging updated to pass context parameter.
DelegatingKeyService algorithm aggregation and retrieval
service/trust/delegating_key_service.go
Service stores registered factories with optional static algorithm metadata via new registeredFactory wrapper; SupportedAlgorithms(ctx) returns deduplicated sorted union without instantiating managers; RegisterKeyManagerCtxWithAlgorithms defensively clones provided algorithms; getKeyManager uses new metadata structure.
KAS mechanism logging with preview-gate filtering
service/kas/kas.go
KAS imports ocrypto; logSupportedMechanisms queries DelegatingKeyService and emits single INFO log; filterMechanismsByPreview removes EC/hybrid types based on preview gates; OnConfigUpdate and initial registration both emit supported-mechanisms log; key managers registered with explicit algorithm lists.
Test coverage for algorithm aggregation and logging
service/trust/delegating_key_service_test.go, service/kas/kas_test.go
DelegatingKeyService tests validate deduplication, sorting, empty-slice normalization, non-invocation of factories, and slice-copy safety; KAS tests validate mechanism filtering for all preview flag combinations, JSON log output shape, and nil-safety.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • jrschumacher

Poem

🐰 Algorithms now speak their name,

Through registered factories, the same,

KAS logs mechanisms with care,

Preview gates filter with flair,

No instantiation—just metadata flame! 🚀

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 29.03% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and clearly describes the main change: emitting an INFO log of supported mechanisms at KAS startup, which is the primary objective of this pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch DSPX-3456-log-supported-kao-mechanisms-at-info-during-startu

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.

@github-actions github-actions Bot added the size/m label Jun 4, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the AlgorithmAdvertiser interface and implements it across various key managers to allow KAS to log its supported cryptographic mechanisms at the INFO level during startup. Feedback on the changes highlights a resource leak and redundant instantiation issue in DelegatingKeyService.SupportedAlgorithms, where calling getKeyManager caches a dummy manager indefinitely. It is recommended to instantiate the managers directly from factories and close them immediately to release resources.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread service/trust/delegating_key_service.go Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 196.672871ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 98.003762ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 423.044709ms
Throughput 236.38 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 45.071094391s
Average Latency 449.005614ms
Throughput 110.94 requests/second

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
service/internal/security/in_process_provider.go (1)

1-379: ⚠️ Potential issue | 🟠 Major

Fix Go lint failures and ensure gofumpt formatting for in_process_provider.go

  • gofumpt couldn’t be executed here (tool not available), so gofumpt -w service/internal/security/in_process_provider.go should still be applied before finishing.
  • golangci-lint is failing on service/internal/security/... due to goconst (service/internal/security/in_process_provider.go:325 has repeated Type: "PUBLIC KEY") and sloglint (service/internal/security/standard_crypto.go:252 uses slog.Any("kasInfo", ...) which should be snake_case).
  • go test ./service/internal/security/... passes.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@service/internal/security/in_process_provider.go` around lines 1 - 379, The
linter failures are from a repeated PEM type string and a slog key style/usage;
extract a constant (e.g., const publicKeyPEMType = "PUBLIC KEY") and replace the
literal in DeriveKey (pem.Block{Type: "PUBLIC KEY", ...}) and any other
occurrences in this package with that constant to satisfy goconst, and in
standard_crypto.go change the slog call that uses slog.Any("kasInfo", ...) to
use a snake_case key and an appropriate typed slog method (e.g.,
slog.String("kas_info", fmt.Sprintf("%v", kasInfo)) or slog.Any with "kas_info")
so it conforms to sloglint; after edits run gofumpt -w on the file(s) and re-run
golangci-lint and go test to verify all checks pass.
service/internal/security/basic_manager.go (1)

1-307: ⚠️ Potential issue | 🟠 Major

Fix golangci-lint failures (and run gofumpt) for service/internal/security/basic_manager.go

  • gofumpt wasn’t available in this environment—run gofumpt -w service/internal/security/basic_manager.go.
  • golangci-lint run service/internal/security/basic_manager.go fails typecheck: undefined AlgorithmRSA2048/AlgorithmRSA4096/AlgorithmECP256R1/AlgorithmECP384R1/AlgorithmECP521R1/AlgorithmHPQTXWing/AlgorithmHPQTSecp256r1MLKEM768/AlgorithmHPQTSecp384r1MLKEM1024 (lines 33-40) and undefined TDFSalt (lines 210, 236).
  • go test ./service/internal/security/... passes.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@service/internal/security/basic_manager.go` around lines 1 - 307, The file
fails golangci-lint typecheck because the algorithm constants and TDFSalt are
undefined; replace the custom basicManagerSupportedAlgorithms entries with the
corresponding ocrypto constants (e.g., use ocrypto.RSA2048Key,
ocrypto.RSA4096Key, ocrypto.EC256Key, ocrypto.EC384Key, ocrypto.EC521Key,
ocrypto.HybridXWingKey, ocrypto.HybridSecp256r1MLKEM768Key,
ocrypto.HybridSecp384r1MLKEM1024Key) so they match the switch in Decrypt, and
change calls to TDFSalt() to ocrypto.TDFSalt() (or import/implement the same
symbol from the correct package if different); after making these symbol fixes,
run gofumpt -w service/internal/security/basic_manager.go and re-run
golangci-lint to verify the typecheck errors are resolved.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@spec/DSPX-3456.md`:
- Around line 29-46: The spec currently contains placeholder headings ("Problem
/ Motivation", "Proposed Solution", "Inputs / Outputs / Contracts", "Edge Cases
& Constraints", "Out of Scope", "Acceptance Criteria") with no real content;
update DSPX-3456.md by either populating each section with concise, relevant
content (describe the user/business problem and success criteria under Problem /
Motivation, outline the implementation approach and key components under
Proposed Solution, enumerate function signatures/data shapes/API contracts under
Inputs / Outputs / Contracts, list boundary/error/performance/security
considerations under Edge Cases & Constraints, specify what will not be
delivered under Out of Scope, and provide clear, testable items under Acceptance
Criteria) or remove any section that does not apply so the spec contains only
meaningful sections.
- Around line 14-27: The Summary section is a dense, unformatted paragraph;
break it into distinct Problem, Proposed Solution, Why, and Acceptance Criteria
subsections, insert blank lines between paragraphs, wrap the JSON examples in
code blocks, and fix the "CriteriaKAS" spacing to "Criteria\n\nKAS" (or
"Criteria: KAS") so headings read correctly; update the headings "Summary",
"Proposed Solution", "Why", and "Acceptance Criteria" accordingly to improve
readability and ensure the JSON log examples are formatted as code blocks (the
JSON snippets shown after "kas config" and "kas initialized" should be fenced).

---

Outside diff comments:
In `@service/internal/security/basic_manager.go`:
- Around line 1-307: The file fails golangci-lint typecheck because the
algorithm constants and TDFSalt are undefined; replace the custom
basicManagerSupportedAlgorithms entries with the corresponding ocrypto constants
(e.g., use ocrypto.RSA2048Key, ocrypto.RSA4096Key, ocrypto.EC256Key,
ocrypto.EC384Key, ocrypto.EC521Key, ocrypto.HybridXWingKey,
ocrypto.HybridSecp256r1MLKEM768Key, ocrypto.HybridSecp384r1MLKEM1024Key) so they
match the switch in Decrypt, and change calls to TDFSalt() to ocrypto.TDFSalt()
(or import/implement the same symbol from the correct package if different);
after making these symbol fixes, run gofumpt -w
service/internal/security/basic_manager.go and re-run golangci-lint to verify
the typecheck errors are resolved.

In `@service/internal/security/in_process_provider.go`:
- Around line 1-379: The linter failures are from a repeated PEM type string and
a slog key style/usage; extract a constant (e.g., const publicKeyPEMType =
"PUBLIC KEY") and replace the literal in DeriveKey (pem.Block{Type: "PUBLIC
KEY", ...}) and any other occurrences in this package with that constant to
satisfy goconst, and in standard_crypto.go change the slog call that uses
slog.Any("kasInfo", ...) to use a snake_case key and an appropriate typed slog
method (e.g., slog.String("kas_info", fmt.Sprintf("%v", kasInfo)) or slog.Any
with "kas_info") so it conforms to sloglint; after edits run gofumpt -w on the
file(s) and re-run golangci-lint and go test to verify all checks pass.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f3285421-d072-4209-a30b-1cec5edb439b

📥 Commits

Reviewing files that changed from the base of the PR and between 79ab34f and 70996d2.

📒 Files selected for processing (10)
  • service/internal/security/basic_manager.go
  • service/internal/security/basic_manager_test.go
  • service/internal/security/in_process_provider.go
  • service/internal/security/in_process_provider_test.go
  • service/kas/kas.go
  • service/kas/kas_test.go
  • service/trust/delegating_key_service.go
  • service/trust/delegating_key_service_test.go
  • service/trust/key_manager.go
  • spec/DSPX-3456.md

Comment thread spec/DSPX-3456.md Outdated
Comment thread spec/DSPX-3456.md Outdated
dmihalcik-virtru and others added 2 commits June 4, 2026 10:05
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>
@dmihalcik-virtru dmihalcik-virtru requested a review from a team as a code owner June 4, 2026 15:40
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 136.019086ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 70.740117ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 341.780316ms
Throughput 292.59 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 33.964295767s
Average Latency 338.798591ms
Throughput 147.21 requests/second

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@service/internal/security/basic_manager_test.go`:
- Around line 631-634: The test weakened validation of advertised algorithms:
restore an explicit check against the expected algorithm set (e.g., a hardcoded
slice like expectedAlgs := []string{"HS256", "RS256"} or whatever the supported
list should be) and assert equality (or set-equality ignoring order) with
bm.SupportedAlgorithms(); keep the copy behavior test by still mutating the
returned slice (algs[0] = "tampered") and asserting that
bm.SupportedAlgorithms()[0] is not "tampered" afterwards. Use the
bm.SupportedAlgorithms function name and the existing local variable algs to
locate where to add the explicit expected-set assertion.

In `@service/internal/security/in_process_provider_test.go`:
- Around line 237-240: Re-add an explicit assertion that the provider's
SupportedAlgorithms() returns the expected algorithm set in addition to the
non-empty and copy checks: call a.SupportedAlgorithms(), assert it contains (or
equals) the canonical algorithm(s) your implementation must advertise (e.g. the
known algorithm constant(s) used elsewhere in tests), then continue to mutate
the local copy and assert the provider's slice is unchanged; reference the
SupportedAlgorithms() method and the local variable a used in this test to
locate where to add the assertion.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8560eb22-5ded-457b-b81f-5b5763b767c7

📥 Commits

Reviewing files that changed from the base of the PR and between 70996d2 and 39e9746.

📒 Files selected for processing (25)
  • service/entityresolution/keycloak/v2/entity_resolution.go
  • service/integration/main_test.go
  • service/internal/access/v2/evaluate.go
  • service/internal/auth/casbin.go
  • service/internal/fixtures/fixtures.go
  • service/internal/security/basic_manager.go
  • service/internal/security/basic_manager_test.go
  • service/internal/security/in_process_provider.go
  • service/internal/security/in_process_provider_test.go
  • service/internal/security/standard_crypto.go
  • service/kas/access/rewrap_test.go
  • service/kas/kas.go
  • service/kas/kas_test.go
  • service/logger/audit/utils.go
  • service/pkg/db/db.go
  • service/policy/keymanagement/key_management.go
  • service/policy/namespaces/namespaces.go
  • service/policy/obligations/obligations.go
  • service/policy/registeredresources/registered_resources.go
  • service/policy/resourcemapping/resource_mapping.go
  • service/policy/subjectmapping/subject_mapping.go
  • service/tracing/otel.go
  • service/trust/delegating_key_service.go
  • service/trust/delegating_key_service_test.go
  • service/trust/key_manager.go

Comment thread service/internal/security/basic_manager_test.go Outdated
Comment thread service/internal/security/in_process_provider_test.go Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 170.38853ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 98.824865ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 411.50789ms
Throughput 243.01 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 44.996923298s
Average Latency 448.622349ms
Throughput 111.12 requests/second

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 205.287674ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 95.68029ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 410.301437ms
Throughput 243.72 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 44.399032883s
Average Latency 441.554759ms
Throughput 112.62 requests/second

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 180.896269ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 102.993691ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 422.343586ms
Throughput 236.77 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 46.351113268s
Average Latency 461.800092ms
Throughput 107.87 requests/second

Replace the runtime AlgorithmAdvertiser interface with static algorithm
metadata captured when a key manager is registered. SupportedAlgorithms
now reads from the registration record and no longer instantiates any
manager just to enumerate capabilities.

- trust: add RegisterKeyManagerCtxWithAlgorithms; SupportedAlgorithms
  reads registration metadata only and never invokes a factory.
- security: drop SupportedAlgorithms methods; export the package-level
  algorithm lists for registration sites.
- kas: register basic and in-process managers with their algorithm sets.
- tests: assert factories are never invoked during capability listing,
  that the registered slice is copied defensively, and switch a
  hand-rolled slices.Equal/t.Fatalf check to assert.Equal for
  consistency.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 191.413708ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 105.78925ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 411.16669ms
Throughput 243.21 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 44.792481643s
Average Latency 445.282949ms
Throughput 111.63 requests/second

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
service/internal/security/in_process_provider.go (1)

20-32: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

InProcessSupportedAlgorithms over-advertises EC support.

InProcessSupportedAlgorithms includes ec:secp384r1 and ec:secp521r1, but Decrypt only handles the EC256 branch, so advertised mechanisms can still fail at runtime with "unsupported key algorithm". Align the list with actual Decrypt coverage (or expand the EC switch cases to match the list).

Suggested minimal fix (advertise only what Decrypt currently supports)
 var InProcessSupportedAlgorithms = []ocrypto.KeyType{
 	ocrypto.RSA2048Key,
 	ocrypto.RSA4096Key,
 	ocrypto.EC256Key,
-	ocrypto.EC384Key,
-	ocrypto.EC521Key,
 	ocrypto.HybridXWingKey,
 	ocrypto.HybridSecp256r1MLKEM768Key,
 	ocrypto.HybridSecp384r1MLKEM1024Key,
 }

Also applies to: 216-225

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@service/internal/security/in_process_provider.go` around lines 20 - 32, The
supported-algorithms list advertises EC384/EC521 but Decrypt only implements the
EC256 branch; update InProcessSupportedAlgorithms to match Decrypt’s actual
coverage by removing ocrypto.EC384Key and ocrypto.EC521Key (and any duplicate
list at the other occurrence) OR alternatively extend the Decrypt switch in
Decrypt to handle ocrypto.EC384Key and ocrypto.EC521Key with the same pattern as
the EC256 branch; touch the InProcessSupportedAlgorithms variable and the
Decrypt method to keep both in sync (refer to the InProcessSupportedAlgorithms
slice and the Decrypt function/switch cases).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@service/kas/kas.go`:
- Line 32: The TraceContext call is logging the full kasCfg which may contain
secrets; change p.Logger.TraceContext(ctx, "kas config reloaded",
slog.Any("config", kasCfg)) to log only a safe/redacted subset or an explicit
safe shape: construct a sanitized struct or map (e.g., safeKasCfg or kasCfgSafe)
containing only non-secret fields (feature flags, booleans, durations) or redact
sensitive fields before passing to p.Logger.TraceContext, and apply the same
change for the other occurrence that logs kasCfg.

---

Duplicate comments:
In `@service/internal/security/in_process_provider.go`:
- Around line 20-32: The supported-algorithms list advertises EC384/EC521 but
Decrypt only implements the EC256 branch; update InProcessSupportedAlgorithms to
match Decrypt’s actual coverage by removing ocrypto.EC384Key and
ocrypto.EC521Key (and any duplicate list at the other occurrence) OR
alternatively extend the Decrypt switch in Decrypt to handle ocrypto.EC384Key
and ocrypto.EC521Key with the same pattern as the EC256 branch; touch the
InProcessSupportedAlgorithms variable and the Decrypt method to keep both in
sync (refer to the InProcessSupportedAlgorithms slice and the Decrypt
function/switch cases).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 02ad105c-bd4e-4774-9a66-ba35f3ae5dde

📥 Commits

Reviewing files that changed from the base of the PR and between 39e9746 and c0e640e.

📒 Files selected for processing (7)
  • service/internal/security/basic_manager.go
  • service/internal/security/in_process_provider.go
  • service/kas/kas.go
  • service/kas/kas_test.go
  • service/trust/delegating_key_service.go
  • service/trust/delegating_key_service_test.go
  • service/trust/key_manager.go

Comment thread service/kas/kas.go
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 184.961916ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 95.487973ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 420.686998ms
Throughput 237.71 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 43.361112623s
Average Latency 431.729203ms
Throughput 115.31 requests/second

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a low-noise capability discovery log to KAS by aggregating the set of supported cryptographic mechanisms from registered trust KeyManager factories, then filtering that set using the same preview-feature gates enforced by rewrap.go. This helps operators (and integration tests) determine what the instance will actually accept without needing to probe request paths.

Changes:

  • Extend KeyManager factory registration to optionally advertise supported algorithms, and aggregate/dedupe/sort them via DelegatingKeyService.SupportedAlgorithms.
  • Emit an INFO log at startup and on hot config reload listing supported mechanisms, filtered by preview flags.
  • Add unit tests for algorithm aggregation, preview filtering, and structured log emission.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
service/trust/key_manager.go Adds optional SupportedAlgorithms metadata to named KeyManager ctx factories.
service/trust/delegating_key_service.go Stores per-factory algorithm metadata; adds SupportedAlgorithms() union/dedupe/sort helper.
service/trust/delegating_key_service_test.go Adds tests ensuring aggregation is correct and factories are not invoked.
service/kas/kas.go Logs supported mechanisms at startup and config reload; filters by preview feature gates.
service/kas/kas_test.go Adds tests for preview filtering and for the emitted INFO log record structure.
service/internal/security/in_process_provider.go Introduces canonical supported-algorithm list and reuses it for listing keys.
service/internal/security/basic_manager.go Introduces canonical supported-algorithm list for the BasicManager.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread service/kas/kas.go
Comment thread service/kas/kas.go
Comment thread service/kas/kas.go
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 169.2244ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 91.645321ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 448.012249ms
Throughput 223.21 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 42.802190831s
Average Latency 426.881367ms
Throughput 116.82 requests/second

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 154.915704ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 83.200231ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 408.896487ms
Throughput 244.56 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 42.350621267s
Average Latency 421.634507ms
Throughput 118.06 requests/second

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

⚠️ Govulncheck found vulnerabilities ⚠️

The following modules have known vulnerabilities:

  • examples
  • otdfctl
  • sdk
  • service
  • lib/fixtures
  • tests-bdd

See the workflow run for details.

@dmihalcik-virtru dmihalcik-virtru added this pull request to the merge queue Jun 4, 2026
Merged via the queue into main with commit c2b4816 Jun 4, 2026
40 checks passed
@dmihalcik-virtru dmihalcik-virtru deleted the DSPX-3456-log-supported-kao-mechanisms-at-info-during-startu branch June 4, 2026 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:kas Key Access Server size/m

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants