Skip to content

feat(asset): add tls filter for asset#287

Merged
l1ttps merged 4 commits intomainfrom
asset/tls-filter
Mar 2, 2026
Merged

feat(asset): add tls filter for asset#287
l1ttps merged 4 commits intomainfrom
asset/tls-filter

Conversation

@mizhm
Copy link
Copy Markdown
Contributor

@mizhm mizhm commented Mar 1, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 1, 2026 09:13
@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 delivers a significant enhancement to the asset management system by introducing robust capabilities for filtering and displaying TLS certificate information. It provides users with a dedicated interface to explore TLS assets, complete with detailed certificate data and an intuitive filtering mechanism, backed by an optimized and paginated API.

Highlights

  • New TLS Filter and Tab: Introduced a new 'TLS Host' faceted filter and a dedicated 'TLS' tab in the assets section of the console, allowing users to filter and view TLS certificate information.
  • Enhanced TLS Asset API: The backend API for retrieving TLS assets has been significantly updated to support pagination, sorting, and advanced filtering capabilities, moving from a simple expiry-based list to a comprehensive query system.
  • Database View for TLS Data: A new TypeORM ViewEntity, TlsAssetsView, was added to flatten and optimize querying of TLS certificate data stored in JSONB format, improving performance and flexibility for filtering.
  • Frontend Integration: New React components and hooks were developed to integrate the TLS filter and tab into the existing asset management UI, including columns for displaying TLS certificate details like host, SNI, subject DN, and expiry.

🧠 New Feature in Public Preview: You can now enable Memory 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.

Changelog
  • console/src/pages/assets/components/faceted-filter.tsx
    • Imported useAssetsControllerGetTlsAssetsInfinite for fetching TLS data.
    • Added TlsFacetedFilter component to enable filtering by TLS hosts.
  • console/src/pages/assets/components/filter-form-infinite.tsx
    • Imported TlsFacetedFilter component.
    • Added TlsFacetedFilter to the list of available filters.
    • Included 'tlsHosts' in the facets array for filter tracking.
  • console/src/pages/assets/components/tls-assets-column.tsx
    • Added new file defining columns for displaying TLS asset properties.
    • Implemented ExpiryBadge component to visually indicate certificate expiry status.
  • console/src/pages/assets/components/tls-assets-tab.tsx
    • Added new file for the TLS assets tab.
    • Integrated CollapsibleDataTable to present TLS certificate data.
    • Utilized useAssetsControllerGetTlsAssets for data fetching.
  • console/src/pages/assets/context/asset-context.tsx
    • Updated AssetContextType to include tlsHosts in filter parameters.
    • Modified AssetProvider to handle tlsHosts in query parameters and filter handlers.
  • console/src/pages/assets/list-assets.tsx
    • Imported TlsAssetsTab component.
    • Added a new 'TLS' entry to the tabList for navigation.
  • console/src/services/apis/gen/queries.ts
    • Updated GetTlsResponseDto with new fields like subject_cn, issuer_dn, tls_version, and cipher.
    • Defined AssetsControllerGetTlsAssetsParams for TLS asset query parameters.
    • Introduced useAssetsControllerGetTlsAssetsInfinite and useAssetsControllerGetTlsAssets hooks for fetching TLS data with pagination and filtering.
  • core-api/src/modules/assets/assets.controller.ts
    • Modified getTlsAssets method to accept GetTlsQueryDto for filtering and pagination.
    • Updated API documentation for getTlsAssets to reflect new capabilities.
  • core-api/src/modules/assets/assets.module.ts
    • Registered TlsAssetsView with TypeOrm for database interaction.
  • core-api/src/modules/assets/assets.service.ts
    • Removed SortOrder import as it's no longer directly used in getManyTls.
    • Refactored getManyTls to accept GetTlsQueryDto and implement pagination, sorting, and filtering.
    • Updated buildBaseQuery to include tlsHosts filtering logic.
    • Added TlsAssetsView repository injection for querying TLS data.
  • core-api/src/modules/assets/dto/assets.dto.ts
    • Added tlsHosts property to GetAssetsQueryDto for filtering assets by TLS host.
  • core-api/src/modules/assets/dto/get-faceted-data.dto.ts
    • Added tlsHosts property to GetFacetedDataDTO.
  • core-api/src/modules/assets/dto/tls.dto.ts
    • Expanded GetTlsResponseDto with additional TLS certificate details.
    • Introduced GetTlsQueryDto to define query parameters for TLS asset retrieval, including hosts and targetIds.
  • core-api/src/modules/assets/entities/asset-services.entity.ts
    • Added a tlsAssets one-to-many relationship to the AssetService entity, linking to TlsAssetsView.
  • core-api/src/modules/assets/entities/tls-assets.entity.ts
    • Added new file defining TlsAssetsView as a TypeORM ViewEntity.
    • Created a SQL expression to flatten and deduplicate TLS JSONB data into individual columns for efficient querying.
  • worker/services/core-api/api.ts
    • Updated GetTlsResponseDto to match the expanded fields in the backend.
    • Modified assetsControllerGetTlsAssets to accept query parameters for search, pagination, sorting, hosts, and target IDs.
Activity
  • The pull request was created by mizhm.
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 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 counter productive. 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

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 a new TLS filter for assets, enhancing the filtering capabilities on the assets page. The changes span both the frontend and backend, including new components for the filter and table view, and backend modifications to support querying and paginating TLS assets. A notable improvement is the refactoring of the backend to use a database view for TLS data, which should improve performance and maintainability. The implementation is solid, but I have a few suggestions to enhance code clarity and remove some redundancies.

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

Adds first-class TLS certificate browsing/filtering to the Assets area by introducing a DB view-backed TLS “asset” projection, exposing it via a paginated /api/assets/tls endpoint, and wiring new TLS UI (tab + faceted filter) in the console.

Changes:

  • Introduce tls_assets_view (TypeORM @ViewEntity) to flatten TLS JSON into queryable columns and relate it to AssetService.
  • Update Core API /api/assets/tls to support pagination/filtering/sorting and expand the TLS response fields (CN, issuer DN, version, cipher).
  • Add Console TLS tab and a “TLS Host” faceted filter; extend asset list filtering with tlsHosts.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
worker/services/core-api/api.ts Updates generated worker client typings + TLS endpoint query support.
core-api/src/modules/assets/entities/tls-assets.entity.ts Adds TlsAssetsView view entity to flatten TLS JSON for querying.
core-api/src/modules/assets/entities/asset-services.entity.ts Adds tlsAssets relation from AssetService to the TLS view.
core-api/src/modules/assets/dto/tls.dto.ts Expands TLS response DTO and adds query DTO for TLS endpoint filtering.
core-api/src/modules/assets/dto/get-faceted-data.dto.ts Extends faceted data DTO with tlsHosts.
core-api/src/modules/assets/dto/assets.dto.ts Adds tlsHosts filter param for general asset listing.
core-api/src/modules/assets/assets.service.ts Adds TLS host filtering via base query join and rewrites getManyTls to be paginated/filterable/sortable.
core-api/src/modules/assets/assets.module.ts Registers TlsAssetsView with TypeORM module feature entities.
core-api/src/modules/assets/assets.controller.ts Updates /tls handler to accept query params and call the new service signature.
console/src/services/apis/gen/queries.ts Updates generated console API hooks/types for new TLS endpoint params and response fields.
console/src/pages/assets/list-assets.tsx Adds a new “TLS” tab to the assets page.
console/src/pages/assets/context/asset-context.tsx Adds tlsHosts to shared filter/query params and query keys.
console/src/pages/assets/components/tls-assets-tab.tsx New TLS tab that renders a server-driven TLS table and collapsible filtered asset list.
console/src/pages/assets/components/tls-assets-column.tsx New TLS table column definitions (host, subject DN, validity, etc.).
console/src/pages/assets/components/filter-form-infinite.tsx Adds tlsHosts to the “isFiltered” facet list and renders TLS faceted filter.
console/src/pages/assets/components/faceted-filter.tsx Adds TlsFacetedFilter powered by the TLS endpoint infinite query.

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

Copy link
Copy Markdown
Member

@l1ttps l1ttps left a comment

Choose a reason for hiding this comment

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

Thanks @mizhm for this PR! The TLS filter implementation looks great.

I particularly like:

  1. The TlsAssetsView design - flattening JSONB data into a proper view entity for efficient querying
  2. Consistent pagination/sorting implementation that matches the existing patterns in the codebase
  3. The ExpiryBadge component with visual indicators for certificate expiration status
  4. Clean integration with the existing asset context and filter system

The architecture is solid and the code follows project conventions well. The deduplication logic grouping by all TLS columns ensures we get unique certificate combinations while aggregating across multiple asset services.

Great work!

@l1ttps l1ttps merged commit cc61d6c into main Mar 2, 2026
9 checks passed
@l1ttps l1ttps deleted the asset/tls-filter branch March 22, 2026 03:23
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