Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Asset Inventory][Azure] Add missing resources and ECS fields required for GA #2954

Merged
merged 34 commits into from
Feb 12, 2025

Conversation

kubasobon
Copy link
Member

@kubasobon kubasobon commented Jan 28, 2025

Summary of your changes

This PR:

  • Adds Azure Entra Group fetcher (previously missing)
  • Adds Azure Entra User fetcher (previously missing)
  • Adds Azure Entra Role Definition fetcher (previously missing)
  • Re-classifies Azure Principal to match Cloud Assets spreadsheet
  • Introduces Group, Organization, and Tags ECS fields to Asset model
  • Adds all required & available ECS fields to assets, except for Role and Principal where it is impossible to test right now
  • Updates unit tests where applicable

Outstanding issues ⚠️

The PR does not address all taxonomy issues and skips filling ECS fields for Role and Principal. A follow-up ticket will be created.

Related Issues

Closes https://github.com/elastic/security-team/issues/11690

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary README/documentation (if appropriate)

@kubasobon kubasobon self-assigned this Jan 28, 2025
Copy link

mergify bot commented Jan 28, 2025

This pull request does not have a backport label. Could you fix it @kubasobon? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 8./d branch. /d is the digit
    NOTE: backport-v8.x has been added to help with the transition to the new branch 8.x.

Copy link

mergify bot commented Jan 29, 2025

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b asset-inv-azure-ga upstream/asset-inv-azure-ga
git merge upstream/main
git push upstream asset-inv-azure-ga

@kubasobon
Copy link
Member Author

As for coveralls, it fails on internal/resources/providers/msgraph/provider.go, which I tried wrapping in unit tests, but I gave up on it since the upstream SDK is auto-generated and does not lend itself to testing.

@kubasobon kubasobon marked this pull request as ready for review February 4, 2025 13:10
@kubasobon kubasobon requested a review from a team as a code owner February 4, 2025 13:10
@kubasobon kubasobon requested a review from orouz February 12, 2025 12:48
Copy link

mergify bot commented Feb 12, 2025

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b asset-inv-azure-ga upstream/asset-inv-azure-ga
git merge upstream/main
git push upstream asset-inv-azure-ga

Copy link
Collaborator

@orouz orouz left a comment

Choose a reason for hiding this comment

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

LGTM

see comment on WithLabels, also note i merged my PR which includes that enricher

@kubasobon kubasobon merged commit da397ba into elastic:main Feb 12, 2025
8 checks passed
@kubasobon kubasobon deleted the asset-inv-azure-ga branch February 12, 2025 15:07
mergify bot pushed a commit that referenced this pull request Feb 12, 2025
…d for GA (#2954)

* add Azure RoleDefinition

* add Azure Entra Groups

* add Azure Entra Users

* update Azure Service Principal category

* fix missing tenant info in Azure

* add ECS to Roles

* add ECS Group fields to Asset definition

* start filling Azure ECS

* add missing Blob Containers and fetch Labels/Tags where possible

* fix existing unit tests for Azure Inventory

* reclassify Blob Container Service

* extract VM properties

* fix expected value

* align principal with cloud assets sheet

* make linters happier

* update all missing ECS fields

* fix test cases

* make test cases race-condition-proof

* remove redundant todo

* add helper func test

* extend test case

* make linter happy

* skip asset.go in coverage

* cover resource-graph file

* add test for BlobContainers

* update ASSETS.md

* use mapstructure.Decode

* unpack properties to struct and test it

* fixes for linters

* gci

(cherry picked from commit da397ba)

# Conflicts:
#	internal/inventory/ASSETS.md
#	internal/inventory/asset.go
#	internal/inventory/azurefetcher/fetcher_storage_test.go
#	internal/inventory/cloud_assets.xlsx
mergify bot pushed a commit that referenced this pull request Feb 26, 2025
…d for GA (#2954)

* add Azure RoleDefinition

* add Azure Entra Groups

* add Azure Entra Users

* update Azure Service Principal category

* fix missing tenant info in Azure

* add ECS to Roles

* add ECS Group fields to Asset definition

* start filling Azure ECS

* add missing Blob Containers and fetch Labels/Tags where possible

* fix existing unit tests for Azure Inventory

* reclassify Blob Container Service

* extract VM properties

* fix expected value

* align principal with cloud assets sheet

* make linters happier

* update all missing ECS fields

* fix test cases

* make test cases race-condition-proof

* remove redundant todo

* add helper func test

* extend test case

* make linter happy

* skip asset.go in coverage

* cover resource-graph file

* add test for BlobContainers

* update ASSETS.md

* use mapstructure.Decode

* unpack properties to struct and test it

* fixes for linters

* gci

(cherry picked from commit da397ba)

# Conflicts:
#	internal/inventory/asset.go
kubasobon added a commit that referenced this pull request Feb 27, 2025
…d for GA (#2954)

* add Azure RoleDefinition

* add Azure Entra Groups

* add Azure Entra Users

* update Azure Service Principal category

* fix missing tenant info in Azure

* add ECS to Roles

* add ECS Group fields to Asset definition

* start filling Azure ECS

* add missing Blob Containers and fetch Labels/Tags where possible

* fix existing unit tests for Azure Inventory

* reclassify Blob Container Service

* extract VM properties

* fix expected value

* align principal with cloud assets sheet

* make linters happier

* update all missing ECS fields

* fix test cases

* make test cases race-condition-proof

* remove redundant todo

* add helper func test

* extend test case

* make linter happy

* skip asset.go in coverage

* cover resource-graph file

* add test for BlobContainers

* update ASSETS.md

* use mapstructure.Decode

* unpack properties to struct and test it

* fixes for linters

* gci

(cherry picked from commit da397ba)
kubasobon added a commit that referenced this pull request Feb 27, 2025
…and ECS fields required for GA (#3057)

* [Asset Inventory][Azure] Add missing resources and ECS fields required for GA (#2954)

* add Azure RoleDefinition

* add Azure Entra Groups

* add Azure Entra Users

* update Azure Service Principal category

* fix missing tenant info in Azure

* add ECS to Roles

* add ECS Group fields to Asset definition

* start filling Azure ECS

* add missing Blob Containers and fetch Labels/Tags where possible

* fix existing unit tests for Azure Inventory

* reclassify Blob Container Service

* extract VM properties

* fix expected value

* align principal with cloud assets sheet

* make linters happier

* update all missing ECS fields

* fix test cases

* make test cases race-condition-proof

* remove redundant todo

* add helper func test

* extend test case

* make linter happy

* skip asset.go in coverage

* cover resource-graph file

* add test for BlobContainers

* update ASSETS.md

* use mapstructure.Decode

* unpack properties to struct and test it

* fixes for linters

* gci

(cherry picked from commit da397ba)

* fix inconsistencies

---------

Co-authored-by: Kuba Soboń <wtty.fool@gmail.com>
kubasobon added a commit that referenced this pull request Feb 27, 2025
…d for GA (#2954)

* add Azure RoleDefinition

* add Azure Entra Groups

* add Azure Entra Users

* update Azure Service Principal category

* fix missing tenant info in Azure

* add ECS to Roles

* add ECS Group fields to Asset definition

* start filling Azure ECS

* add missing Blob Containers and fetch Labels/Tags where possible

* fix existing unit tests for Azure Inventory

* reclassify Blob Container Service

* extract VM properties

* fix expected value

* align principal with cloud assets sheet

* make linters happier

* update all missing ECS fields

* fix test cases

* make test cases race-condition-proof

* remove redundant todo

* add helper func test

* extend test case

* make linter happy

* skip asset.go in coverage

* cover resource-graph file

* add test for BlobContainers

* update ASSETS.md

* use mapstructure.Decode

* unpack properties to struct and test it

* fixes for linters

* gci
kubasobon added a commit that referenced this pull request Feb 27, 2025
…and ECS fields required for GA (#3011)

[Asset Inventory][Azure] Add missing resources and ECS fields required for GA (#2954)

* add Azure RoleDefinition

* add Azure Entra Groups

* add Azure Entra Users

* update Azure Service Principal category

* fix missing tenant info in Azure

* add ECS to Roles

* add ECS Group fields to Asset definition

* start filling Azure ECS

* add missing Blob Containers and fetch Labels/Tags where possible

* fix existing unit tests for Azure Inventory

* reclassify Blob Container Service

* extract VM properties

* fix expected value

* align principal with cloud assets sheet

* make linters happier

* update all missing ECS fields

* fix test cases

* make test cases race-condition-proof

* remove redundant todo

* add helper func test

* extend test case

* make linter happy

* skip asset.go in coverage

* cover resource-graph file

* add test for BlobContainers

* update ASSETS.md

* use mapstructure.Decode

* unpack properties to struct and test it

* fixes for linters

* gci

Co-authored-by: Kuba Soboń <wtty.fool@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants