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

Improve remote Data validator #3133

Closed
lorriborri opened this issue May 17, 2024 · 0 comments · Fixed by #3134
Closed

Improve remote Data validator #3133

lorriborri opened this issue May 17, 2024 · 0 comments · Fixed by #3134
Assignees
Labels
Milestone

Comments

@lorriborri
Copy link
Member

lorriborri commented May 17, 2024

Situation

  1. The Sechub model validator allows multiple remote sections that can be configured and remote and file system can be configured both at once.

  2. The sechub validator does not check the remote data section for correct configuration.

Wanted

  1. Check only one configuration
  • When using a remote data section it is only possible to define ONE binary or ONE source definition. Means also: It is only possible to define ONE remote data section (see example 1 for wrong configuration).

  • When using a remote data section it is not possible to define any file system (see example 2 for wrong configuration).

  1. Check if remote configuration is correct
  • make sure location is not null or blank

  • make sure credentials are configured correctly or not defined

Details

example 1: duplicated remote sources (forbidden)

{
  "apiVersion": "1.0",
  "data": {
    "sources": [
      {
        "name": "remote_example_name",
        "remote": {
          "location": "remote_example_location",
          "type": "git",
          "credentials": {
            "user": {
              "name": "my-example-user",
              "password": "my-example-password"
            }
          }
        }
      },
      {
       "name": "remote_example_name_two",
       "remote": {
         "location": "remote_example_location",
         "type": "some-other-type",
         "credentials": {
           "user": {
             "name": "my-example-user",
             "password": "my-example-password"
           }
         }
       }
      }
    ]
  },
  "codeScan": {
    "use": [
      "remote_example_name"
    ]
  }
}

example 2: mix remote and file system (forbidden)

{
  "apiVersion": "1.0",
  "data": {
    "sources": [
      {
        "name": "remote_example_name",
        "remote": {
          "location": "remote_example_location",
          "type": "git",
          "credentials": {
            "user": {
              "name": "my-example-user",
              "password": "my-example-password"
            }
          }
        }
      },
      {
      "name": "filesystem_example",
        "fileSystem" : {
          "folders" : [ "myProject/build" ]
        }
      }
    ]
  },
  "codeScan": {
    "use": [
      "remote_example_name"
    ]
  }
}

Solution

Implement Validation in SechubConfigurationModelValidator

@lorriborri lorriborri self-assigned this May 17, 2024
@lorriborri lorriborri changed the title Allow only one remote data configuration Improve remote Data validator May 22, 2024
lorriborri added a commit that referenced this issue May 22, 2024
lorriborri added a commit that referenced this issue May 22, 2024
@sven-dmlr sven-dmlr added this to the Server 1.10.0 milestone May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants