Skip to main content

Dependency Observatory Scanner: a scanner for software packages and dependencies

Project description

find-package-rugaru

find-package-rugaru finds open source dependent packages in a git repository and tests and flags suspicious open source packages (like the legendary rugaru).

NB: this project is in an alpha state and its APIs are not stable

Scanner

Installation

Requirements
  • docker >=18.06.3
  • python 3.8+ and pip
  • jq
  • system packages to build psycopg2 (e.g. build-essential libpq-dev on debian buster)

After installing the above requirements:

$ git clone https://github.com/mozilla-services/find-package-rugaru.git
$ cd find-package-rugaru
$ make install install-dev
$ docker pull mozilla/dependencyscan
$ docker pull postgres:12

Example Usage

  1. start a local postgres database:
$ make start-db
  1. run one or more of the analysis scripts:
  • ./bin/analyze_package.sh <package_name> [<package_version>]
  • ./bin/analyze_repo.sh <repository_url>
$ ./bin/analyze_package.sh lodash 4.17.15
analyzing lodash@4.17.15 saving intermediate results to /tmp/dep-obs.g7mNNBaLyVjR
...

2020-02-27 17:31:31,900 - fpr - INFO - pipeline finished
null
2020-02-27 17:31:32,403 - fpr - INFO - pipeline finished
$

or if you have more time to scan all git tags of the lodash repo:

./bin/analyze_repo.sh https://github.com/lodash/lodash.git
analyzing tags of https://github.com/lodash/lodash.git saving intermediate results to /tmp/dep-obs.5pvSrfbn6Nox
...

Check the source of the scripts to find additional configuration via environment variables.

  1. Inspect the results in the local database:
make db-shell
PGPASSWORD=postgres psql -U postgres -h localhost -p 5432 dependency_observatory
psql (12.2 (Ubuntu 12.2-2.pgdg18.04+1), server 12.1 (Debian 12.1-1.pgdg100+1))
Type "help" for help.

dependency_observatory=# \x on
Expanded display is on.
dependency_observatory=# SELECT * FROM package_versions WHERE name = 'lodash' ORDER BY inserted_at DESC;
-[ RECORD 1 ]-------------------------------------------------------
id          | 102
name        | lodash
version     | 4.17.15
language    | node
url         | https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz
repo_url    |
repo_commit |
inserted_at | 2020-02-26 17:12:47.373348
updated_at  |

Pipelines

The scripts are composed of components called pipelines (for lack of a better term). For example analyze_package.sh will:

  1. fetch information about the package from the npm registry
  2. filter for git refs to clone and, if specified, the matching version
  3. find dependency manifests or lockfiles (e.g. package.json) for each ref in a debian:buster-slim docker image
  4. run npm install --save=true, npm list --json, and npm audit --json in the project root for each ref in a node:10-buster-slim docker image
  5. postprocess and save the results to the local postgres database

Each individual pipeline can be run on its own. For example the following find_git_refs pipeline used in analyze_repo.sh will find git tags for the mozilla-services/channelserver project:

$ echo '{"repo_url": "https://github.com/mozilla-services/channelserver"}' | docker run -i --rm -v /var/run/docker.sock:/var/run/docker.sock --name fpr-test mozilla/dependencyscan python fpr/run_pipeline.py -v find_git_refs
Pipeline API

Note that this interface may be subject to change

Each pipeline:

See the design doc for why this interface was chosen.

Adding a pipeline
  1. copy an existing file from fpr/pipelines/
  2. give it a new name in its Pipeline model declaration
  3. add it to fpr/pipelines/__init__.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dependency-observatory-scanner-2020.3.24.tar.gz (910.9 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file dependency-observatory-scanner-2020.3.24.tar.gz.

File metadata

  • Download URL: dependency-observatory-scanner-2020.3.24.tar.gz
  • Upload date:
  • Size: 910.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1

File hashes

Hashes for dependency-observatory-scanner-2020.3.24.tar.gz
Algorithm Hash digest
SHA256 190ffb3fa325913c9130aecc2b371d34d38d5e243f3b69aefd9e8947d2faa2e3
MD5 f0e81c371ccd5c574a5ba9303610c420
BLAKE2b-256 426b3bc1b44d17c26a8061f356e8a6362cd3e9041e9c972a9e37171322c64524

See more details on using hashes here.

File details

Details for the file dependency_observatory_scanner-2020.3.24-py3-none-any.whl.

File metadata

File hashes

Hashes for dependency_observatory_scanner-2020.3.24-py3-none-any.whl
Algorithm Hash digest
SHA256 303b4f4bf14aec0b7d92a6a647529528b8a1d09dcd1de153d28f0b0ab0cc3be5
MD5 c8ab728166b073bfd65d023d8942a3f2
BLAKE2b-256 c0a13925540068471d5c9a776b22eb730601268b239fe3d10edaeb5ddc8f2d5e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page