Giter Club home page Giter Club logo

pgsectest's Introduction

pgsectest

A tool to run security checks against postgres and return a score

The origin

We wanted to run security tests, but ajutomated across all instances we manage, and deliver results to our clients. And thus pgsectest was born.

Downloading pgsectest

The most straight forward way is to download pgsectest directly from the github release page. But there are other options, like

Please refer to our download instructions for more details on all options.

Usage

After downloading the binary to a folder in your path, you can run pgsectest with a command like:

pgsectest ./mytest*.yml ./andonemoretest.yml

Or using stdin:

cat ./mytests*.yml | pgsectest

Verbosity

You can improve verbosity of output by adding one or more -v arguments:

pgsectest ./mytest*.yml ./andonemoretest.yml -vvv
Number of V's Output
0 Only end score
1 Also score for failed tests
2 Also advisory and url for failed tests
3 Also score for succeded tests (max score)

Defining your tests

A more detailed description can be found in our test definition guide.

TLDR; you can define one or more test chapters as yaml documents (separated by the '---' yaml doc separator). Each test chapter can have the following information defined:

  • a dsn, whith all connection details to connect to postgres.
    • Note that instead of configuring in this chapter, the libpq environment variables can also be used, but options configured in this chapter take precedence.
  • You can set the number of retries, delay and debugging options
  • Each test can define
    • a name (defaults to the query when not set),
    • a query for the dividend and a query for the divisor
    • an advisory how to improve your score
    • a url for more information
    • the expected result (a list of key/value pairs)
    • the option to reverse the outcome (Ok results are counted as errors and vice versa)

Some example test definitions can be found in the testdata folder.

pgsectest's People

Contributors

sebasmannem avatar dependabot[bot] avatar

Watchers

 avatar

pgsectest's Issues

Additional test

It would be awesome if we could also have tests for the following points:

Change from 1 query wich returns a float into 2 queries which return 2 floats

We constantly write a cumbersome query which basically runs 2 queries returning integers, converts both to floats, divides them and returns the division.
As an example we query the number of users with an md5 password (dividend) and divide by total number of users (divisor).
Then we convert both into a float, divide the dividend by the divisor, and the result is returned as a float.
This is very cumbersome to write, and having defaults is difficult aswel.
Lets change this so that we have 2 queries:

  • One for the dividend
  • One for the divisor

Both could return an integer (we can easily convert the into float in go), and the division can be done in go aswel.
Interestingly, we could run with 'sane defaults', such that

  • empty string for the dividend would become min
  • empty string for the divisor would become 1
  • divisor returning zero would not be a division by zero error, but rather max

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.