Repository navigation
feat: add realm trust anchor management - #3260
Conversation
|
Note Reviews pausedUse the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdded realm-scoped Trusted CA storage with TypeORM persistence, permission-aware CRUD services, HTTP and client APIs, validation, localized management pages, database migrations, and unit/controller tests. ChangesTrust Anchor functionality
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant Administrator
participant KeysUI
participant TrustAnchorAPI
participant TrustAnchorController
participant TrustAnchorService
participant TrustAnchorRepository
Administrator->>KeysUI: Open Trusted CAs
KeysUI->>TrustAnchorAPI: List or submit Trust Anchor
TrustAnchorAPI->>TrustAnchorController: HTTP CRUD request
TrustAnchorController->>TrustAnchorService: Build actor context and invoke operation
TrustAnchorService->>TrustAnchorRepository: Validate realm, certificate, permissions, and uniqueness
TrustAnchorRepository-->>TrustAnchorService: Persisted Trust Anchor
TrustAnchorService-->>TrustAnchorController: Trust Anchor response
TrustAnchorController-->>TrustAnchorAPI: Entity response
TrustAnchorAPI-->>KeysUI: Render updated state
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
authup
@authup/client-web
@authup/server-core
@authup/access
@authup/client-web-kit
@authup/client-web-kit-theme
@authup/client-web-nuxt
@authup/client-web-theme
@authup/core-http-kit
@authup/core-kit
@authup/core-realtime-kit
@authup/errors
@authup/i18n
@authup/kit
@authup/server-adapter-kit
@authup/server-adapter-node
@authup/server-adapter-socket-io
@authup/server-adapter-web
@authup/server-kit
@authup/server-test-kit
@authup/specs
commit: |
|
@coderabbitai pause |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
apps/server-core/test/unit/core/entities/trust-anchor/service.spec.ts (1)
46-186: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAdd unit tests for
getOne.The test suite thoroughly covers
getMany,create,update, anddelete. However, test coverage for thegetOnemethod implemented inTrustAnchorServiceappears to be missing. Consider adding adescribe('getOne')block to verify successful retrieval, permission evaluation, and theEntityNotFoundErrorwhen the anchor does not exist.🤖 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 `@apps/server-core/test/unit/core/entities/trust-anchor/service.spec.ts` around lines 46 - 186, Add a describe('getOne') block for TrustAnchorService covering successful retrieval of a seeded anchor, permission evaluation for the requested anchor, and rejection with EntityNotFoundError when the ID is absent. Reuse the existing repository, actor factories, and trust-anchor builders, and assert the returned entity and relevant permission behavior.apps/client-web/pages/keys/index.vue (1)
93-106: 🎯 Functional Correctness | 🔵 TrivialVerify locale word-order for concatenated nav labels.
${translationsDefault.add} ${keySingular.value}/${trustAnchorSingular.value}builds "Add X" via raw string concatenation of two independently-translated fragments. This file already has a placeholder-based pattern available (ENTITY_DELETEDwithdata: { entity, name }, lines 113-124) that composes sentences correctly per-locale; concatenation instead hardcodes English word order and can render incorrect grammar in German/French/Spanish where verb/object order differs.🤖 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 `@apps/client-web/pages/keys/index.vue` around lines 93 - 106, Update the concatenated add-navigation labels in the menu definition to use the locale’s placeholder-based translation pattern, passing the translated entity name as interpolation data instead of joining translations manually. Apply this to both the key and trust-anchor entries while preserving their existing icons and URLs.
🤖 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 `@apps/client-web/pages/keys/index/trust-anchors/`[id].vue:
- Around line 2-7: Import the VCNavItems component in the trust-anchor page and
add it to the component’s local registration alongside ATrustAnchorForm. Ensure
the existing template usage of VCNavItems resolves through this explicit
registration.
In `@apps/client-web/pages/keys/index/trust-anchors/index.vue`:
- Line 44: Make the trust-anchor query in the setup logic reactive by wrapping
the filter object containing realmManagementId.value in computed(...), then pass
the computed query to ATrustAnchors so it updates when the management realm
changes.
In `@apps/server-core/src/core/entities/trust-anchor/service.ts`:
- Around line 154-156: Update the update method after validator.run and before
permission evaluation to mirror create’s CA certificate validation: when
validated.certificate is present, parse it and verify it is a valid CA
certificate using the existing certificate-validation logic and error behavior.
In
`@packages/client-web-kit/src/components/entities/trust-anchor/ATrustAnchorForm.vue`:
- Line 66: Update the submit function to return immediately when busy is already
true, set busy to true before calling createOrUpdate, and reset it in a finally
block so the loading state and re-entrancy guard cover both success and failure.
Preserve the existing submit behavior and ensure the returned busy binding
reflects the request lifecycle.
---
Nitpick comments:
In `@apps/client-web/pages/keys/index.vue`:
- Around line 93-106: Update the concatenated add-navigation labels in the menu
definition to use the locale’s placeholder-based translation pattern, passing
the translated entity name as interpolation data instead of joining translations
manually. Apply this to both the key and trust-anchor entries while preserving
their existing icons and URLs.
In `@apps/server-core/test/unit/core/entities/trust-anchor/service.spec.ts`:
- Around line 46-186: Add a describe('getOne') block for TrustAnchorService
covering successful retrieval of a seeded anchor, permission evaluation for the
requested anchor, and rejection with EntityNotFoundError when the ID is absent.
Reuse the existing repository, actor factories, and trust-anchor builders, and
assert the returned entity and relevant permission behavior.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: f62a34d7-70b5-4f6b-a818-bea4c713c975
⛔ Files ignored due to path filters (1)
apps/server-core/test/data/certificates/non-ca-certificate.pemis excluded by!**/*.pem
📒 Files selected for processing (49)
.agents/architecture.mdapps/client-web/pages/keys/index.vueapps/client-web/pages/keys/index/trust-anchors.vueapps/client-web/pages/keys/index/trust-anchors/[id].vueapps/client-web/pages/keys/index/trust-anchors/add.vueapps/client-web/pages/keys/index/trust-anchors/index.vueapps/server-core/src/adapters/database/data-source/options/module.tsapps/server-core/src/adapters/database/domains/index.tsapps/server-core/src/adapters/database/domains/trust-anchor/entity.tsapps/server-core/src/adapters/database/domains/trust-anchor/index.tsapps/server-core/src/adapters/database/migrations/mysql/1783856507391-Default.tsapps/server-core/src/adapters/database/migrations/postgres/1783856507391-Default.tsapps/server-core/src/adapters/http/controllers/entities/index.tsapps/server-core/src/adapters/http/controllers/entities/trust-anchor/index.tsapps/server-core/src/adapters/http/controllers/entities/trust-anchor/module.tsapps/server-core/src/app/modules/database/repositories/index.tsapps/server-core/src/app/modules/database/repositories/trust-anchor/index.tsapps/server-core/src/app/modules/database/repositories/trust-anchor/repository.tsapps/server-core/src/app/modules/http/modules/controller.tsapps/server-core/src/core/entities/index.tsapps/server-core/src/core/entities/trust-anchor/index.tsapps/server-core/src/core/entities/trust-anchor/service.tsapps/server-core/src/core/entities/trust-anchor/types.tsapps/server-core/test/unit/core/entities/trust-anchor/fake-repository.tsapps/server-core/test/unit/core/entities/trust-anchor/service.spec.tsapps/server-core/test/unit/http/controllers/entities/trust-anchor.spec.tspackages/client-web-kit/src/components/entities/index.tspackages/client-web-kit/src/components/entities/trust-anchor/ATrustAnchor.tspackages/client-web-kit/src/components/entities/trust-anchor/ATrustAnchorForm.vuepackages/client-web-kit/src/components/entities/trust-anchor/ATrustAnchors.tspackages/client-web-kit/src/components/entities/trust-anchor/index.tspackages/core-http-kit/src/client/module.tspackages/core-http-kit/src/client/type.tspackages/core-http-kit/src/domains/entities/index.tspackages/core-http-kit/src/domains/entities/trust-anchor/index.tspackages/core-http-kit/src/domains/entities/trust-anchor/module.tspackages/core-http-kit/src/domains/entities/trust-anchor/types.tspackages/core-kit/src/domains/contstants.tspackages/core-kit/src/domains/index.tspackages/core-kit/src/domains/trust-anchor/index.tspackages/core-kit/src/domains/trust-anchor/types.tspackages/core-kit/src/domains/trust-anchor/utils.tspackages/core-kit/src/domains/trust-anchor/validator.tspackages/core-kit/src/domains/types.tspackages/i18n/src/catalogs/de/entity.tspackages/i18n/src/catalogs/en/entity.tspackages/i18n/src/catalogs/es/entity.tspackages/i18n/src/catalogs/fr/entity.tspackages/i18n/src/constants.ts
✅ Action performedReviews paused. |
…ble submission The busy ref on AKeyForm and ATrustAnchorForm was passed to AFormSubmit (:is-busy) but never set, so the submit button showed no in-flight state and an in-flight submit was not blocked. Set busy around the createOrUpdate call and short-circuit submit while busy.
buildCertificateJwkFields was duplicated verbatim in the JwkController and the realm jwks handlers. Hoist it into core/key/certificate.ts alongside buildX5c/buildX5tS256 so the fail-open x5c/x5t#S256 derivation has a single source of truth.
Summary
Dependency
This builds on the certificate-key support merged in #3257.
Validation
Summary by CodeRabbit