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

Keynames used for the secrets for Package Configuration Provider config instead of values #611

Closed
Etsija opened this issue Jul 5, 2024 · 8 comments
Assignees
Labels
bug Something isn't working compose Issues related to the Docker Compose setup.

Comments

@Etsija
Copy link
Contributor

Etsija commented Jul 5, 2024

We are using the same secret dosToken for both DOS Scanner and DOS Package Configuration Provider to enable the plugins to communicate with DOS back-end. The secret is defined in Docker Compose in secrets/compose/secrets.properties with (an example)

# DOS credentials
dosToken=1234567890abcde
  1. For the Scanner job, the relevant part of the configuration object is
scanners: ['DOS'],
config: {
  DOS: {
    options: {
      readFromStorage: 'false',
      writeToStorage: 'true',
      url: 'https://dos/api/url/',
      frontendUrl: 'https://dos/frontend/url/',
      pollInterval: '5',
      timeout: '300',
    },
    secrets: {
      token: 'dosToken',
    },
  },
},

The value of dosToken is used properly for DOS scanner, which is also verified from PostgresDB from the table scanner_configuration_secrets.

  1. For the Evaluator job, the relevant part of the configuration object is
packageConfigurationProviders: [
  {
    type: 'DOS',
    options: {
      url: 'https://dos/api/url/',
      timeout: '300',
    },
    secrets: {
      token: 'dosToken',
    },
  },
],

But we have verified from our back-end that instead of the value of dosToken, the server tries to use a literal key dosToken as the value, leading to communication failure with DOS back-end.

@Etsija Etsija added bug Something isn't working compose Issues related to the Docker Compose setup. api Issues related to the API. labels Jul 5, 2024
@Etsija
Copy link
Contributor Author

Etsija commented Jul 5, 2024

If the reason for this behaviour is that the same secret cannot actually be reused for two different workers, this is not documented, nor does the back-end indicate this in any way in logs.

@sschuberth
Copy link
Contributor

the server tries to use a literal key dosToken as the value

I'm very surprised that this is not always the case, also for the scanner. Is there maybe some config transformation or so configured for the scanner, that is not configured for the evaluator?

@haikoschol
Copy link
Contributor

Looks like the function that resolves dosToken to the actual secret is WorkerContext.resolveConfigSecrets(). It's called in ScannerRunner.run() but not in EvaluatorRunner.run().

@Etsija Etsija removed the api Issues related to the API. label Jul 5, 2024
@Etsija
Copy link
Contributor Author

Etsija commented Jul 5, 2024

Looks like the function that resolves dosToken to the actual secret is WorkerContext.resolveConfigSecrets(). It's called in ScannerRunner.run() but not in EvaluatorRunner.run().

That could explain why a literal dosToken is used as the value of the secret - because the real value is not resolved anywhere for the worker?

@mnonnenmacher mnonnenmacher self-assigned this Jul 5, 2024
@Etsija
Copy link
Contributor Author

Etsija commented Jul 5, 2024

the server tries to use a literal key dosToken as the value

I'm very surprised that this is not always the case, also for the scanner. Is there maybe some config transformation or so configured for the scanner, that is not configured for the evaluator?

I don't think so. This is DOS scanner config code, and for the DOS PCP, the config class is inlined to the same file as the implementation.

We have been using the same configuration structure as given in the description of this issue for both plugins for a long time now, with no problems.

@mnonnenmacher
Copy link
Contributor

I will prepare a fix.

@Etsija
Copy link
Contributor Author

Etsija commented Jul 5, 2024

I will prepare a fix.

Thanks! This is our (almost) last hurdle in integrating our solution into ORT server, so let's hope the fix isn't too complicated.

mnonnenmacher added a commit to boschglobal/ort-server that referenced this issue Jul 5, 2024
Resolve the secrets in the configurations of package configuration
providers from the configured secret storage, instead of using the
secret values directly.

Fixes eclipse-apoapsis#611.

Signed-off-by: Martin Nonnenmacher <[email protected]>
mnonnenmacher added a commit to boschglobal/ort-server that referenced this issue Jul 5, 2024
Resolve the secrets in the configurations of package configuration
providers from the configured secret storage, instead of using the
secret values directly.

Fixes eclipse-apoapsis#611.

Signed-off-by: Martin Nonnenmacher <[email protected]>
mnonnenmacher added a commit to boschglobal/ort-server that referenced this issue Jul 5, 2024
Resolve the secrets in the configurations of package configuration
providers from the configured secret storage, instead of using the
secret values directly.

Fixes eclipse-apoapsis#611.

Signed-off-by: Martin Nonnenmacher <[email protected]>
mnonnenmacher added a commit to boschglobal/ort-server that referenced this issue Jul 5, 2024
Resolve the secrets in the configurations of package configuration
providers from the configured secret storage, instead of using the
secret values directly.

Fixes eclipse-apoapsis#611.

Signed-off-by: Martin Nonnenmacher <[email protected]>
mnonnenmacher added a commit to boschglobal/ort-server that referenced this issue Jul 5, 2024
Resolve the secrets in the configurations of package configuration
providers from the configured secret storage, instead of using the
secret values directly.

Fixes eclipse-apoapsis#611.

Signed-off-by: Martin Nonnenmacher <[email protected]>
github-merge-queue bot pushed a commit that referenced this issue Jul 5, 2024
Resolve the secrets in the configurations of package configuration
providers from the configured secret storage, instead of using the
secret values directly.

Fixes #611.

Signed-off-by: Martin Nonnenmacher <[email protected]>
@Etsija
Copy link
Contributor Author

Etsija commented Jul 5, 2024

Thanks @mnonnenmacher nice work fixing this. We have successfully integrated both our scanner and package config provider into ORT server now.

@Etsija Etsija closed this as completed Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compose Issues related to the Docker Compose setup.
Projects
None yet
Development

No branches or pull requests

4 participants