Git Product home page Git Product logo

meta-sca's Introduction

meta-sca

https://img.shields.io/badge/Supported%20languages-C%2CC%2B%2B%2CGo%2CPython%2CShell%%2Cperl-informational

Nightly Latest commit

For the list of current findings from pipelines see meta-sca report

Important note

As announced by this discussion at the end of April 2022 this layer will undergo a major change in support.

Support will be given only for master branch

What can I do when I'm affected by the changes

A maintainers guide can be found here. Feel free to raise pull requests against not officially supported branches.

Support for these branches, including quality control, has to be done fully by the community

Table of content

Purpose

Purpose of this layer is to provide a proper set of static analysis tools for your YOCTO build. All provided tools can be easily configured and integrated into any CI service (like e.g. Jenkins).

All results are stored to SCA_EXPORT_DIR (which defaults to ${DEPLOY_DIR_IMAGE}/sca). The results will be stored in the raw-format of the corresponding tool and in checkstyle-format.

Getting started

For a quick start how to use this layer see getting started guide

You can also watch the following talk

Watch the video

I gave for YS2023.11 to get started.

Installation

To install clone the needed branch(es) to any path on your local system.

Prerequisites

  • You need the current standard poky-layer installed onto your local build environment.

Use of containers

It is recommended to use privkweihmann/yocto-sca-minimal:2004 docker container for building, which has all necessary requirements already installed.

Use in CI

When you're planing to use meta-sca in your CI/CD, it is advised to use the minified layer meta-sca-minified to save you from cloning this fairly large repository.

NOTE meta-sca-minified only offer releases of this layer for releases made after 03/2020

Setup

In your bblayers.conf-file add the following line

BBLAYERS += "<full path to sca-layer>/meta-sca"

or with poky layer already setup run in shell

bitbake-layers add-layer "<full path to sca-layer>/meta-sca"

Kas

Alternatively you can use kas to setup the workspace. Use conf/kas/scatest-qemux86-64.yaml from this layer

Web monitor

If you're not quite convinced what this layer can do for you, have a look at the web monitor, where all findings from the layer CI pipelines are publically available.

Support

Actively maintained branch is currently only master. Unmaintained branches will only receive package updates on demand. Support for unmaintained branches has to be done by the community.

Status of the branches is described at SECURITY.md.

It's advised to use the tagged source versions in productive environment.

Releases

See SECURITY.md for details

Compatibility

If there is a technical issue that might break backward compatibility it will be mentioned in release note of the corresponding milestone release.

Licensing

This layer does only provide open source tools. The layer itself is licensed under BSD.

If individual files are licensed under different terms, terms and conditions can be found in the individual file header

Zero impact

This layer provides only -native tools, so actually none of the build binaries will be deployed to your target. Everything happens on the build machine.

Available tools

The layer can check on a recipe-level or on an image-level.

  • On image-level the whole root-filesystem could be taken into account, which in most cases can't be granted on a recipe-level.
  • On the other hand some static code analysis does not make any sense on an image-level - so this layer does have different tools for both level available.

Overview of tools

Module Description Homepage Requires Requires inet Run on image Run on recipe Available in SDK C C++ Python Shell Javascript PHP Go Images LUA Spelling Metrics Binaries Packages Other formats Security scope Functional scope Style scope
bandit Scan python code for insecurities https://github.com/PyCQA/bandit x x x x x
bashate Shell script linter http://docs.openstack.org/developer/bashate/ x x x x x x
bitbake Bitbake issue handling x x x x x
cbmc C Bounded Model Checker https://github.com/diffblue/cbmc/ x x x x
checkbashisms Shell script linter https://manpages.debian.org/jessie/devscripts/checkbashisms.1.en.html x x x x x x
cmake Get cmake errors and warnings x x x x
cppcheck C/C++ linter https://github.com/danmar/cppcheck x x x x x x x
cpplint C/C++ linter https://github.com/cpplint/cpplint x x x x x x x
cvecheck Check for unpatched CVEs https://github.com/clearlinux/cve-check-tool manual enable x x x x
darglint Python docstring linter https://github.com/terrencepreilly/darglint x x x x
dennis I18N linter https://github.com/willkg/dennis/ x x x x x
detectsecrets Detect hardcoded secrets in code https://github.com/Yelp/detect-secrets x x x x x x
flake8 Python linter http://flake8.pycqa.org/en/latest/ x x x x x x
flawfinder C/C++ security linter https://github.com/david-a-wheeler/flawfinder x x x x x
flint C/C++ linter https://github.com/JossWhittle/FlintPlusPlus x x x x x
gcc GCC compiler issues and hardening x x x x x
golint GO linter https://github.com/golang/lint x x x x
it Python linter https://github.com/thg-consulting/it x x x x
jsonlint JSON file linter x x x x x
kconfighard Kernel config hardening checker https://github.com/a13xp0p0v/kconfig-hardened-check x x x x
licensecheck Scan code for license information https://github.com/boyter/lc x x x
looong Find functions with too long arglists https://github.com/anapaulagomes/looong x x x x
msgcheck I18n linter https://github.com/codingjoe/msgcheck x x x x
multimetric Coding metrics https://github.com/priv-kweihmann/multimetric manual enable x x x x x x x x x x x x
mypy Python linter https://github.com/python/mypy x x x x x
oelint Bitbake recipe linter https://github.com/priv-kweihmann/oelint-adv x x x x
perl Perl warnings check x x x x
perlcritic Perl linter https://metacpan.org/pod/perlcritic x x x x
pkgqaenc Enhanced package QA x x x
pscan Find insecure printfs http://deployingradius.com/pscan/ x x x x
pylint Python linter https://github.com/PyCQA/pylint x x x x x x
pysymcheck Check binaries for forbidden function usage https://github.com/priv-kweihmann/pysymbolcheck x x x
rats Check on insecurities in several languages https://github.com/redNixon/rats x x x x x x x
reuse Scan code for license information https://github.com/fsfe/reuse-tool x x x
revive GO linter https://github.com/mgechev/revive x x x x x
ruff Extremely fast python linter https://github.com/astral-sh/ruff x x x x x
scancode Scan code for license information https://github.com/nexB/scancode-toolkit x x x
setuptoolslint Lint python-setup.py https://github.com/johnnoone/setuptools-pylint x x x x
shellcheck Shell script linter https://github.com/koalaman/shellcheck x x x x x x
slick Shell script linter https://github.com/mcandre/slick x x x x x
sparse C linter https://sparse.wiki.kernel.org/index.php/Main_Page x x x x
stank Shell script linter https://github.com/mcandre/stank x x x x x x
systemdlint Systemd unit linter https://github.com/priv-kweihmann/systemdlint x x x x x x x
tlv Find duplicate code https://github.com/priv-kweihmann/tlv manual enable x x x x x x x x x x x
tscancode C and lua linter https://github.com/Tencent/TscanCode x x x x
vulture Find dead python code https://github.com/jendrikseipp/vulture x x x x x
xmllint XML linter http://xmlsoft.org/xmllint.html x x x x x
yamllint YAML linter https://github.com/adrienverge/yamllint x x x x x

each tool does have it's own benefits and flaws so don't be mad if you have 10k+ findings on the initial run.

Further documentation

Contributing

Please see the detailed contribution guideline for details

Get involved

To get involved following things can be done

  • create an issue
  • fix an issue and create a pull request
  • see the pinned issues in the bugtracker

Security Policy

For the project's security policy please see here

meta-sca's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

meta-sca's Issues

Warning and error reporting doesn't work

Any warning, error or fatal should be reported to build console (at least the number of findings).
This isn't working - no output although there are plenty of warnings found during a run

Pylint-recipe has some missing variables

SCA_PYLINT_EXTRA_SUPPRESS, SCA_PYLINT_EXTRA_FATAL, SCA_PYLINT_ROOTPATH, SCA_PYLINT_HOMEPATH & SCA_PYLINT_LIBATH are not set when invoking pylint on a recipe.
In pylint-image there are avaiable

Problem on incremental build

When doing an incremental build the module sca-cpplint throws the following exception

Exception: File "", line None
xml.etree.ElementTree.ParseError: syntax error: line 2, column

In the checked module no C-code is avaiable

Relicense rules-recipe to BSD

To not break an builds that rely on FOSS only - relicense some on the rule recipes to BSD (as the whole layer already is)

Decrease the layer prio

Currently the layer priority is set to 30, which seems to be unreasonable high.
Lowering will also grant the possibility on better overriding things

Image summary

I would like have a tool that tell me how much findings have been reported for all components installed into an image.
There should not be any additional checking done by the functionality

README

An appropriate README is needed

Best-of mode

I would like to have a possibility to get a finding only if it has been reported by more than 1 tool (if more than 1 tool exists for the choosen language).
Issues only reported by a single tool shall be omitted.
If only 1 tool exists the original behavior is not altered.

When merging results:

  • ID of first tool wins (in alphabetical order)
  • Message of first tool wins (in alphabetical order, tool-section in square-brackets is enhanced by used tool)
  • highest severity wins

Fatal error don't produce any CI relevant content

In any check tool a fatal error will terminate the build immediately without creating the expected output file at SCA_EXPORT_DIR.
So it would be better to ensure that these files are actually created before terminating the build.

This makes it more usable in a headless CI environment where not everyone can stick down the build console

Use poky's cve-check tool in sca

Convert the output of poky's cve-check-tool to checkstyle-format.
This is not static code analysis in common sense but adds an extra plus regarding security.

Multiple std on cppcheck possible

Not only a single but multiple '--std' arguments are valid according to manpage of cppcheck.
I would be great to support that here as well

SCA for systemd

It would be great to use systemd-analyze to verify systemd-unitfiles at buildtime.

Configure warning-level

It would be nice to globally configure the level from which the results will be put into checkstyle-results.
Mostly it's quite annoying to have all the info/debug-level findings around, when they never will be fixed anyway

SCA for javascript

It would be great to have SCA for javascript as well.
Currently no tool suggestions...

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.