feat(asset): add asset categorization support#297
Open
SamuelHassine wants to merge 1 commit into
Open
Conversation
Add the canonical two-level asset taxonomy to pyoaev so producers (collectors, custom integrations) can set the new categorization fields on endpoints: - new AssetCategory / AssetSubCategory / CloudProvider / AssetCriticality enums in pyoaev.asset_types, exported from the package - EndpointManager: endpoint_platform / endpoint_arch are now optional; add optional attrs asset_category, asset_subcategory, asset_criticality, asset_internet_facing, asset_cloud_provider, asset_cloud_native_type, asset_cloud_region, asset_metadata and endpoint_url - bump the package version Relates to OpenAEV-Platform/openaev#6452
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #297 +/- ##
==========================================
+ Coverage 73.58% 74.84% +1.25%
==========================================
Files 54 55 +1
Lines 2404 2512 +108
==========================================
+ Hits 1769 1880 +111
+ Misses 635 632 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds first-class asset categorization support to the Python client so endpoint producers can send the canonical (backend-aligned) asset taxonomy fields to OpenAEV.
Changes:
- Introduces
pyoaev.asset_typeswithAssetCategory,AssetSubCategory,CloudProvider, andAssetCriticalityenums and exports them frompyoaev. - Expands
EndpointManagerallowed create payload attributes to include asset categorization/cloud metadata fields and makes platform/arch optional. - Bumps package version and adds endpoint upsert tests for categorization payload serialization.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| test/apis/endpoint/test_endpoint.py | Adds tests asserting categorization fields are serialized on endpoint upsert calls. |
| pyoaev/asset_types.py | New module defining canonical asset taxonomy and related enums as str enums. |
| pyoaev/apis/endpoint.py | Updates endpoint create-attrs to support new categorization/cloud fields and relax platform/arch requirements. |
| pyoaev/init.py | Version bump and re-exports new enums from the package root. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+70
to
+73
| _, kwargs = mock_request.call_args | ||
| self.assertEqual(kwargs["method"], "post") | ||
| self.assertEqual(kwargs["url"], "url/api/endpoints/agentless/upsert") | ||
| self.assertEqual(kwargs["json"]["asset_category"], "WEB_APPLICATION") |
Comment on lines
+89
to
+92
| _, kwargs = mock_request.call_args | ||
| self.assertEqual(kwargs["url"], "url/api/endpoints/agentless/upsert") | ||
| self.assertEqual(kwargs["json"]["asset_cloud_provider"], "AWS") | ||
| self.assertEqual(kwargs["json"]["asset_cloud_native_type"], "s3_bucket") |
Comment on lines
+16
to
+18
| # endpoint_platform / endpoint_arch are optional: agents and collectors always provide | ||
| # them, while category-driven assets (web app, cloud, network, ...) may omit them - the | ||
| # platform defaults them to "Unknown" server-side. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the canonical two-level asset taxonomy to pyoaev so producers (collectors, custom
integrations) can classify endpoints with the new fields introduced in OpenAEV.
Changes
pyoaev.asset_typesmodule withAssetCategory,AssetSubCategory,CloudProviderandAssetCriticalityenums, exported from the package.EndpointManager:endpoint_platform/endpoint_archare now optional (the platform defaultsthem to
Unknown); added optional attrsasset_category,asset_subcategory,asset_criticality,asset_internet_facing,asset_cloud_provider,asset_cloud_native_type,asset_cloud_region,asset_metadataandendpoint_url.Test plan
test/apis/endpoint/test_endpoint.py: upsert a web application without platform/arch and a cloudresource; the categorization fields are sent on the wire.
Related
Dependency of OpenAEV-Platform/openaev#6452 (asset categorization).