question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dependency Check client fails (due to postgresql database schema?)

See original GitHub issue

Describe the bug We run the OWASP dependency check client inside a corporate network. The app consists of 2 docker containers:

  • postgres:9.6.20 (from hub.docker.com, this container’s database should hold the NVD)
  • a custom docker container running the dependency check client with gradle

While running v6.1.0 of the OWASP dependency check, the client fails, ostensibly because the DB schema does not seem to fit the one expected by the client. This is not an upgrade, I am trying to set up everything from scratch.

Version of dependency-check used The problem occurs using version 6.1.0 of the org.owasp.dependencycheck.gradle.DependencyCheckPlugin

Log file

To Reproduce Steps to reproduce the behavior:

  1. Run a docker postgres container (postgres:9.6.20), with exposed port 5432 and variables POSTGRES_PASSWORD, POSTGRES_USER and POSTGRES_DB set, running on a bridge network
  2. Inside the postgres container, run one of the following:
  • psql --username postgres --dbname postgres --no-password -f /initialize.sql
  • psql --username postgres --dbname postgres --no-password -f /initialize_postgres.sql
  1. Create a custom docker container containing gradle and the following files:
  • gradle.properties (values in {{}} are substituted by ansible)
systemProp.proxySet="true"
systemProp.http.proxyHost="{{proxy_host}}"
systemProp.http.proxyPort="{{proxy_port}}"
systemProp.http.proxyUser="{{proxy_user}}"
systemProp.http.proxyPassword="{{proxy_pwd}}"
systemProp.http.nonProxyHosts="{{no_proxy}}"
systemProp.https.proxyHost="{{proxy_host}}"
systemProp.https.proxyPort="{{proxy_port}}"
systemProp.https.proxyUser="{{proxy_user}}"
systemProp.https.proxyPassword="{{proxy_pwd}}"
systemProp.https.nonProxyHosts="{{no_proxy}}"
  • database.gradle
buildscript {
    repositories {
        maven { url "http://m2repo.[DOMAIN REDACTED]/content/groups/full" }
    }
    dependencies {
        classpath 'org.owasp:dependency-check-gradle:6.1.0'
        classpath 'org.postgresql:postgresql:42.2.18'
    }
}

apply plugin: org.owasp.dependencycheck.gradle.DependencyCheckPlugin

dependencyCheck {
    cveValidForHours = 0
    data {
        connectionString = "jdbc:postgresql://dependencyDB:5432/postgres?useSSL=false"
        driver = "org.postgresql.Driver"
        username = "postgres"
        password = "DATABASE_PASSWORD"
    }
}
  • update.sh gradle --info --debug --stacktrace --no-daemon -b database.gradle dependencyCheckUpdate
  1. Run the custom container. The entrypoint is update.sh. The container is also connected to the bridge network.

Expected behavior The dependency check plugin should be able to download the NVD into the attached PostgreSQL database.

Additional context The whole setup is automated with Ansible. I will post further logs/info upon request. The size limit on Gists prevented me from posting everything.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mprinscommented, Mar 10, 2021

it seems you messd up somthing in “initialize_postgres.sql” file as your log shows

CREATE DATABASE
You are now connected to database "dependencycheck" as user "postgres".
CREATE ROLE

but there are only comments, no statements like that in https://github.com/jeremylong/DependencyCheck/blob/28dee17e9c923e63716cc91ac4dafcfa9ca435ae/core/src/main/resources/data/initialize_postgres.sql#L1-L17

so my gues is you introducend an error hence the initial command stops at the first statement ending (“;”)

0reactions
ptschackcommented, Mar 12, 2021

Hi @mprins , thank you for your answer, you solved my problem! I was mistakenly uncommenting the top three lines, when I just had to uncomment & customize the CREATE USER ... statement 😕

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using a Database Server - dependency-check
Using a Database Server. WARNING: This discusses an advanced setup and you may run into issues. Out of the box dependency-check uses a...
Read more >
Has the database schema been changed between 6.1.1 and ...
x database schemas would be the same. I get this error: 18:30:55 [ERROR] DatabaseException: Unable to connect to the dependency ...
Read more >
How do I resolve issues with missing or incorrect schema ...
The database version check SQL is SELECT PROPVALUE FROM LSW_SYSTEM_SCHEMA WHERE upper(PROPNAME) = upper('DatabaseSchemaVersion') Please ensure the database ...
Read more >
Common Problems | TeamCity On-Premises Documentation
If a build fails or otherwise misbehaves in TeamCity but you believe it should not, the first thing to do is to check...
Read more >
Documentation: 15: postgres - PostgreSQL
postgres is the PostgreSQL database server. In order for a client application to access a database it connects (over a network or locally)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found