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

feat: adds support to import security profiles #342

Merged
merged 10 commits into from
Dec 12, 2023
Merged

feat: adds support to import security profiles #342

merged 10 commits into from
Dec 12, 2023

Conversation

srinandan
Copy link
Collaborator

No description provided.

@srinandan srinandan linked an issue Dec 2, 2023 that may be closed by this pull request
@srinandan srinandan added the enhancement New feature or request label Dec 2, 2023
Copy link
Collaborator

@kurtkanaskie kurtkanaskie left a comment

Choose a reason for hiding this comment

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

Issue with multiple filters, not creating multiple score paths as per: https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.securityProfiles.environments/computeEnvironmentScores

gorun securityprofiles compute --org=$ORG --name=via-apigeecli --env=dev --filters='/org@apigeex-mint-kurt/envgroup@dev/env@dev/proxies/proxy@pingstatus-v1,/org@apigeex-mint-kurt/envgroup@dev/env@dev/proxies/proxy@pingstatus-oauth-v1'
{
  "error": {
    "code": 400,
    "message": "invalid score path in filter: \"/org@apigeex-mint-kurt/envgroup@dev/env@dev/proxies/proxy@pingstatus-v1,/org@apigeex-mint-kurt/envgroup@dev/env@dev/proxies/proxy@pingstatus-oauth-v1\"",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.RequestInfo",
        "requestId": "7699576027614491976"
      }
    ]
  }
}

cmd/securityprofiles/export.go Outdated Show resolved Hide resolved
cmd/securityprofiles/export.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@kurtkanaskie kurtkanaskie left a comment

Choose a reason for hiding this comment

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

Using multiple filter params works to create the proper request, the 500 error also exists in the API.

gorun securityprofiles compute --org=$ORG --name=via-apigeecli --env=dev \
	--filters='/org@apigeex-mint-kurt/envgroup@dev/env@dev/proxies/proxy@pingstatus-v1' \
	--filters='/org@apigeex-mint-kurt/envgroup@dev/env@dev/proxies/proxy@pingstatus-oauth-v1' \
	--start-time=2023-12-10T00:00:00Z --end-time=2023-12-12T00:00:00Z
{
    "timeRange": {
        "startTime": "2023-12-10T00:00:00Z",
        "endTime": "2023-12-12T00:00:00Z"
    },
    "filters": [
        {
            "scorePath": "/org@apigeex-mint-kurt/envgroup@dev/env@dev/proxies/proxy@pingstatus-v1"
        },
        {
            "scorePath": "/org@apigeex-mint-kurt/envgroup@dev/env@dev/proxies/proxy@pingstatus-oauth-v1"
        }
    ]
}

Response is same as from API

{
  "error": {
    "code": 500,
    "message": "error while fetching score for \"organizations/apigeex-mint-kurt/securityProfiles/via-apigeecli/environments/dev\"",
    "status": "INTERNAL",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.RequestInfo",
        "requestId": "4120055890593857543"
      }
    ]
  }
}

@srinandan srinandan merged commit 2c7312c into main Dec 12, 2023
5 checks passed
@srinandan srinandan deleted the issue340 branch December 12, 2023 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support to import security profiles
2 participants