Giter VIP home page Giter VIP logo

thoth-station / cli-examples Goto Github PK

View Code? Open in Web Editor NEW
4.0 5.0 9.0 120 KB

Examples of Thoth's recommendations using Thamos CLI

Home Page: https://redhat-scholars.github.io/managing-vulnerabilities-with-thoth/managing-vulnerabilities-with-thoth/index.html

License: GNU General Public License v3.0

Python 100.00%
thoth artificial-intelligence ai-stacks tensorflow openshift kubernetes hacktoberfest

cli-examples's Introduction

Manage vulnerablities in your dependencies with an example application

See different branches for different examples

This is an example of an application which uses Thoth's recommendations to recommend a software stack for specific security requirements. The application is showing one of the Integration of Thoth using Thamos CLI.

For OpenShift s2i (Source-To-Image) examples, visit thoth-station/s2i-example repository.

Running the application

One of the integration for Thoth is Thamos. You can use Thoth's recommendation engine directly from within your terminal. First, you need to clone this example repo and install Thamos CLI:

git clone https://github.com/thoth-station/cli-examples.git && cd cli-examples
pip3 install thamos
thamos --help

The pre-configured template for Thamos CLI is available in the .thoth.yaml file:

cat .thoth.yaml

Now you are ready to ask for advises:

thamos advise

This might take some time. Once Thoth recommends you the application stack to be used for running the application, you can use Thamos to create a Python environment (based on configuration in .thoth.yaml) and install the recommended requirements into it:

thamos install

And finally, run the application:

thamos run ./game_of_life.py

To browse Thoth's logs produced during the resolution:

thamos log

About the application

The game_of_life.py program is a simple application that shows how Thamos manages known vulnerablities in the dependencies of a project. To use this example application, follow the steps mentioned above relative to the installation of the Thamos CLI and to its configuration using .thoth.yaml.

To introduce voluntarily a known vulnerability in the project, specify that you would like to add pillow version 8.0.0 in your requirements:

thamos add pillow==8.0.0

This version of pillow is known for introducing a vulnerability further described on the pypa/advisory-db repository. Thamos can also manage user requirements for dependencies using constraints files. To add pillow version 8.0.0 in your dependency requirements this way, you can simply write the package with its version into this file.

To get a stack guidance based on security, run the following command:

thamos advise --recommendation-type security

or modify the recommendation_type field to security in .thoth.yaml to set it as your default recommendation type, and simply run:

thamos advise

Thamos report should show that an error occured during the resolution process because a known vulnerability was found in pillow version 8.0.0 .

Run the example application

Now that you know how Thamos prevents the use of unsafe dependencies in your application, you can revert to another version of pillow to complete this part of the tutorial. To run the example application with the resolved dependencies, run:

thamos run ./game_of_life.py

To launch a new game with the default parameters or choose your own parameters as specified in the help section. Click on the coordinates to select your first generation of individuals and press p to see next generations.

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.