mitre/github"
5 | ---
6 |
7 | # `mitre/github`
8 |
9 | Provides access to GitHub data. Does not define a default query and can't be
10 | used as a top-level plugin in a policy file.
11 |
--------------------------------------------------------------------------------
/site/content/docs/guide/plugins/mitre-npm.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "mitre/npm"
3 | extra:
4 | nav_title: "mitre/npm"
5 | ---
6 |
7 | # `mitre/npm`
8 |
9 | Provides access to NPM data for a package. Does not provide a default query
10 | and can't be used as a top-level plugin in a policy file.
11 |
--------------------------------------------------------------------------------
/site/static/dl/install.ps1:
--------------------------------------------------------------------------------
1 |
2 | # This installer delegates to the "real" installer included with each new
3 | # release of Hipcheck.
4 |
5 | $hc_version = "3.14.0"
6 | $installer = "https://github.com/mitre/hipcheck/releases/download/hipcheck-v${hc_version}/hipcheck-installer.ps1"
7 |
8 | irm "$installer" | iex
9 |
--------------------------------------------------------------------------------
/xtask/src/task/mod.rs:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 |
3 | //! Commands supported by 'xtask'
4 |
5 | pub mod benchmark;
6 | pub mod buf;
7 | pub mod build;
8 | pub mod changelog;
9 | pub mod check;
10 | pub mod ci;
11 | pub mod manifest;
12 | pub mod rfd;
13 | pub mod site;
14 | pub mod validate;
15 |
--------------------------------------------------------------------------------
/plugins/git/plugin.kdl:
--------------------------------------------------------------------------------
1 | publisher "mitre"
2 | name "git"
3 | version "0.5.2"
4 | license "Apache-2.0"
5 |
6 | entrypoint {
7 | on arch="aarch64-apple-darwin" "git"
8 | on arch="x86_64-apple-darwin" "git"
9 | on arch="x86_64-unknown-linux-gnu" "git"
10 | on arch="x86_64-pc-windows-msvc" "git.exe"
11 | }
12 |
--------------------------------------------------------------------------------
/plugins/npm/plugin.kdl:
--------------------------------------------------------------------------------
1 | publisher "mitre"
2 | name "npm"
3 | version "0.4.2"
4 | license "Apache-2.0"
5 |
6 | entrypoint {
7 | on arch="aarch64-apple-darwin" "npm"
8 | on arch="x86_64-apple-darwin" "npm"
9 | on arch="x86_64-unknown-linux-gnu" "npm"
10 | on arch="x86_64-pc-windows-msvc" "npm.exe"
11 | }
12 |
--------------------------------------------------------------------------------
/site/templates/page.html:
--------------------------------------------------------------------------------
1 | {% extends "bases/base.tera.html" %}
2 |
3 | {% block title %}
4 | {% if page.title %}
5 | {{ page.title }}
6 | {% else %}
7 | Hipcheck
8 | {% endif %}
9 | {% endblock %}
10 |
11 | {% block content %}
12 | {{ page.content | safe }}
13 | {% endblock %}
14 |
--------------------------------------------------------------------------------
/xtask/src/string.rs:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 |
3 | use itertools::Itertools as _;
4 |
5 | /// List a bunch of strings together separated by commas.
6 | pub fn list_with_commas(list: impl IntoIteratormitre/linguist"
5 | ---
6 |
7 | # `mitre/linguist`
8 |
9 | Analyzes text files to identify their likely language. Does not provide a
10 | default query and can't be used as a top-level plugin in a policy file.
11 |
--------------------------------------------------------------------------------
/plugins/linguist/plugin.kdl:
--------------------------------------------------------------------------------
1 | publisher "mitre"
2 | name "linguist"
3 | version "0.4.2"
4 | license "Apache-2.0"
5 |
6 | entrypoint {
7 | on arch="aarch64-apple-darwin" "linguist"
8 | on arch="x86_64-apple-darwin" "linguist"
9 | on arch="x86_64-unknown-linux-gnu" "linguist"
10 | on arch="x86_64-pc-windows-msvc" "linguist.exe"
11 | }
12 |
--------------------------------------------------------------------------------
/library/hipcheck-macros/README.md:
--------------------------------------------------------------------------------
1 |
2 | # `hipcheck-macros`
3 |
4 | `hipcheck-macros` is a helper crate for [Hipcheck] which provides procedural
5 | macros. It's not intended for use by anyone else, and generally involves
6 | private APIs.
7 |
8 | ## License
9 |
10 | `hipcheck-macros` is Apache-2.0 licensed.
11 |
12 | [Hipcheck]: https://github.com/mitre/hipcheck
13 |
--------------------------------------------------------------------------------
/plugins/git/local-plugin.kdl:
--------------------------------------------------------------------------------
1 | publisher "mitre"
2 | name "git"
3 | version "0.0.0"
4 | license "Apache-2.0"
5 |
6 | entrypoint {
7 | on arch="aarch64-apple-darwin" "./target/debug/git"
8 | on arch="x86_64-apple-darwin" "./target/debug/git"
9 | on arch="x86_64-unknown-linux-gnu" "./target/debug/git"
10 | on arch="x86_64-pc-windows-msvc" "./target/debug/git.exe"
11 | }
12 |
--------------------------------------------------------------------------------
/plugins/npm/local-plugin.kdl:
--------------------------------------------------------------------------------
1 | publisher "mitre"
2 | name "npm"
3 | version "0.0.0"
4 | license "Apache-2.0"
5 |
6 | entrypoint {
7 | on arch="aarch64-apple-darwin" "./target/debug/npm"
8 | on arch="x86_64-apple-darwin" "./target/debug/npm"
9 | on arch="x86_64-unknown-linux-gnu" "./target/debug/npm"
10 | on arch="x86_64-pc-windows-msvc" "./target/debug/npm.exe"
11 | }
12 |
--------------------------------------------------------------------------------
/site/scripts/deno.json:
--------------------------------------------------------------------------------
1 | {
2 | "tasks": {
3 | "bundle": "deno run -A tasks/bundle.ts",
4 | "dev": "deno run -A --watch tasks/bundle.ts"
5 | },
6 | "imports": {
7 | "@luca/esbuild-deno-loader": "jsr:@luca/esbuild-deno-loader@^0.11.0",
8 | "esbuild": "npm:esbuild@^0.24.0"
9 | },
10 | "compilerOptions": {
11 | "lib": ["deno.window", "dom"]
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/plugins/git/local-release-plugin.kdl:
--------------------------------------------------------------------------------
1 | publisher "mitre"
2 | name "git"
3 | version "0.0.0"
4 | license "Apache-2.0"
5 |
6 | entrypoint {
7 | on arch="aarch64-apple-darwin" "./target/release/git"
8 | on arch="x86_64-apple-darwin" "./target/release/git"
9 | on arch="x86_64-unknown-linux-gnu" "./target/release/git"
10 | on arch="x86_64-pc-windows-msvc" "./target/release/git.exe"
11 | }
12 |
--------------------------------------------------------------------------------
/plugins/npm/local-release-plugin.kdl:
--------------------------------------------------------------------------------
1 | publisher "mitre"
2 | name "npm"
3 | version "0.0.0"
4 | license "Apache-2.0"
5 |
6 | entrypoint {
7 | on arch="aarch64-apple-darwin" "./target/release/npm"
8 | on arch="x86_64-apple-darwin" "./target/release/npm"
9 | on arch="x86_64-unknown-linux-gnu" "./target/release/npm"
10 | on arch="x86_64-pc-windows-msvc" "./target/release/npm.exe"
11 | }
12 |
--------------------------------------------------------------------------------
/plugins/binary/local-plugin.kdl:
--------------------------------------------------------------------------------
1 | publisher "mitre"
2 | name "binary"
3 | version "0.0.0"
4 | license "Apache-2.0"
5 |
6 | entrypoint {
7 | on arch="aarch64-apple-darwin" "./target/debug/binary"
8 | on arch="x86_64-apple-darwin" "./target/debug/binary"
9 | on arch="x86_64-unknown-linux-gnu" "./target/debug/binary"
10 | on arch="x86_64-pc-windows-msvc" "./target/debug/binary.exe"
11 | }
12 |
--------------------------------------------------------------------------------
/plugins/github/local-plugin.kdl:
--------------------------------------------------------------------------------
1 | publisher "mitre"
2 | name "github"
3 | version "0.0.0"
4 | license "Apache-2.0"
5 |
6 | entrypoint {
7 | on arch="aarch64-apple-darwin" "./target/debug/github"
8 | on arch="x86_64-apple-darwin" "./target/debug/github"
9 | on arch="x86_64-unknown-linux-gnu" "./target/debug/github"
10 | on arch="x86_64-pc-windows-msvc" "./target/debug/github.exe"
11 | }
12 |
--------------------------------------------------------------------------------
/library/hipcheck-kdl/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "hipcheck-kdl"
3 | description = "Common KDL functionality used throughout the Hipcheck project"
4 | repository = "https://github.com/mitre/hipcheck"
5 | version = "0.1.0"
6 | license = "Apache-2.0"
7 | edition = "2024"
8 | publish = false
9 |
10 | [dependencies]
11 | kdl = { workspace = true }
12 | hipcheck-workspace-hack = { workspace = true }
13 |
--------------------------------------------------------------------------------
/sdk/python/src/hipcheck_sdk/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: Apache-2.0
2 |
3 | from hipcheck_sdk.options import *
4 |
5 | from hipcheck_sdk.engine import PluginEngine, MockResponses
6 | from hipcheck_sdk.server import Plugin, PluginServer
7 | from hipcheck_sdk.query import query, Endpoint
8 | from hipcheck_sdk.cli import get_parser_for, run_server_for
9 | from hipcheck_sdk.gen.types import *
10 |
--------------------------------------------------------------------------------
/xtask/src/workspace.rs:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 |
3 | use anyhow::{Result, anyhow};
4 | use std::path::{Path, PathBuf};
5 |
6 | /// Get the root directory of the workspace.
7 | pub fn root() -> Resultmitre/git"
5 | ---
6 |
7 | # `mitre/git`
8 |
9 | Provides access to Git commit history data. Does not define a default query
10 | and can't be used as a top-level plugin in a policy file.
11 |
12 | ## Configuration
13 |
14 | | Parameter | Type | Explanation |
15 | |:--------------------|:--------|:--------------|
16 | | `commit-cache-size` | `Integer` | Optional number of repositories to retain in cache. Defaults to one. |
17 |
--------------------------------------------------------------------------------
/site/static/dl/install.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | # This installer delegates to the "real" installer included with each new
4 | # release of Hipcheck.
5 |
6 | HC_VERSION="3.14.0"
7 | REPO="https://github.com/mitre/hipcheck"
8 | INSTALLER="$REPO/releases/download/hipcheck-v$HC_VERSION/hipcheck-installer.sh"
9 |
10 | # Check that curl is installed and error out if it isn't.
11 | if ! command -v curl >/dev/null; then
12 | echo "error: 'curl' is required to run the installer" 1>&2
13 | exit 1
14 | fi
15 |
16 | curl -LsSf "$INSTALLER" | sh "$@"
17 |
--------------------------------------------------------------------------------
/plugins/affiliation/local-release-plugin.kdl:
--------------------------------------------------------------------------------
1 | publisher "mitre"
2 | name "affiliation"
3 | version "0.0.0"
4 | license "Apache-2.0"
5 |
6 | entrypoint {
7 | on arch="aarch64-apple-darwin" "./target/release/affiliation"
8 | on arch="x86_64-apple-darwin" "./target/release/affiliation"
9 | on arch="x86_64-unknown-linux-gnu" "./target/release/affiliation"
10 | on arch="x86_64-pc-windows-msvc" "./target/release/affiliation.exe"
11 | }
12 |
13 | dependencies {
14 | plugin "mitre/git" version="0.0.0" manifest="./plugins/git/local-release-plugin.kdl"
15 | }
16 |
--------------------------------------------------------------------------------
/plugins/github/src/cli.rs:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 |
3 | use anyhow::Result;
4 | use clap::Parser;
5 | use hipcheck_sdk::LogLevel;
6 |
7 | #[derive(Parser, Debug)]
8 | pub struct Cli {
9 | #[arg(long)]
10 | pub port: u16,
11 |
12 | #[arg(long, default_value_t=LogLevel::Error)]
13 | pub log_level: LogLevel,
14 |
15 | #[arg(trailing_var_arg(true), allow_hyphen_values(true), hide = true)]
16 | pub unknown_args: Vechc schema"
5 | ---
6 |
7 | # `hc schema`
8 |
9 | The `hc schema` command is intended to help users of Hipcheck who are trying
10 | to integrate Hipcheck into other tools and systems. Hipcheck supports a JSON
11 | output format for analyses, and `hc schema` produces a JSON schema description
12 | of that output.
13 |
14 | `hc schema` takes the name of the target type for which to print the schema.
15 | For the list of target types, see [the documentation for the `hc check` command](@/docs/guide/cli/hc-check.md).
16 |
17 | `hc schema` also takes the usual [General Flags](@/docs/guide/cli/general-flags.md).
18 |
--------------------------------------------------------------------------------
/hipcheck/src/shell/macros.rs:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 |
3 | //! Macros that mirror/replace those from the standard library using the global [`Shell`][crate::shell::Shell].
4 |
5 | macro_rules! println {
6 | ($($arg:tt)+) => {
7 | $crate::shell::Shell::println(format!($($arg)*));
8 | };
9 |
10 | () => {
11 | $crate::shell::Shell::println("");
12 | }
13 | }
14 |
15 | // public re-export
16 | pub(crate) use println;
17 |
18 | macro_rules! eprintln {
19 | ($($arg:tt)+) => {
20 | $crate::shell::Shell::eprintln(format!($($arg)*));
21 | };
22 |
23 | () => {
24 | $crate::shell::Shell::eprintln("");
25 | }
26 | }
27 |
28 | pub(crate) use eprintln;
29 |
--------------------------------------------------------------------------------
/site/content/docs/contributing/testing.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Testing Changes
3 | weight: 2
4 | ---
5 |
6 | # Testing Changes
7 |
8 | All changes to Hipcheck must pass continuous integration (CI) tests prior
9 | to being merged. You can simulate this test suite, at least on your own
10 | operating system and architecture, using the following command:
11 |
12 | ```sh
13 | $ cargo xtask ci
14 | ```
15 |
16 | Passing this command is not a _guarantee_ of passing the official CI suite
17 | on GitHub, but is a good way to approximate things locally.
18 |
19 | If you want faster tests locally, we also recommend installing `cargo-nextest`.
20 | The `cargo xtask ci` command will use it instead of `cargo test` if it's
21 | installed.
22 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: 'type: enhancement'
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/plugins/activity/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "activity"
3 | version = "0.5.2"
4 | license = "Apache-2.0"
5 | edition = "2024"
6 | repository = "https://github.com/mitre/hipcheck"
7 | publish = false
8 |
9 | [dependencies]
10 | clap = { workspace = true, features = ["derive"] }
11 | hipcheck-sdk = { workspace = true, features = ["macros"] }
12 | jiff = { workspace = true, features = ["serde"] }
13 | tracing = { workspace = true }
14 | serde = { workspace = true, features = ["derive", "rc"] }
15 | serde_json = { workspace = true }
16 | tokio = { workspace = true, features = ["rt"] }
17 | hipcheck-workspace-hack = { workspace = true }
18 |
19 | [dev-dependencies]
20 | hipcheck-sdk = { workspace = true, features = ["mock_engine"] }
21 |
--------------------------------------------------------------------------------
/sdk/python/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line, and also
5 | # from the environment for the first two.
6 | SPHINXOPTS ?=
7 | SPHINXBUILD ?= sphinx-build
8 | SOURCEDIR = source
9 | BUILDDIR = build
10 |
11 | # Put it first so that "make" without argument is like "make help".
12 | help:
13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14 |
15 | .PHONY: help Makefile
16 |
17 | # Catch-all target: route all unknown targets to Sphinx using the new
18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19 | %: Makefile
20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21 |
--------------------------------------------------------------------------------
/site/content/docs/guide/config/_index.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Configuration
3 | template: docs.html
4 | page_template: docs_page.html
5 | weight: 2
6 | sort_by: weight
7 | ---
8 |
9 | # Configuration
10 |
11 | This section covers how to configure Hipcheck through policy files.
12 |
13 | hc setup"
5 | ---
6 |
7 | # `hc setup`
8 |
9 | The `hc setup` command is intended to be run after first installing Hipcheck,
10 | and again after updating Hipcheck, to ensure you have the required configuration
11 | and data files needed for Hipcheck to run.
12 |
13 | When installing Hipcheck, regardless of method, you are only installing the
14 | `hc` binary, not these additional configuration files. `hc setup` identifies
15 | the correct location in your system for configuration files and writes the
16 | files to that directory.
17 |
18 | It also produces an export command that should be used to set the `HC_CONFIG`
19 | environmental variable to the relevant directory, as necessary to run `hc check`.
20 |
21 | Please note that in some cases, `hc setup` may default to a directory that
22 | requires escalated privileges. You can resolve this by running `sudo hc setup` or
23 | passing in the your desired directory with `hc setup --config [directory path]`.
24 |
25 | `hc setup` supports Hipcheck's [General Flags](@/docs/guide/cli/general-flags.md).
26 |
--------------------------------------------------------------------------------
/tests/test-plugins/activity-container/activity-container-deploy.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Default values
4 | IMAGE_TAR="./tests/test-plugins/activity-container/activity-image.tar"
5 | IMAGE_NAME="activity-image"
6 | PORT=8888
7 |
8 | while [[ $# -gt 0 ]]; do
9 | if [[ "$1" == "--port" && -n "$2" && "$2" =~ ^[0-9]+$ ]]; then
10 | PORT="$2"
11 | shift 2
12 | else
13 | # Collect any other arguments to pass to docker run
14 | EXTRA_ARGS="$EXTRA_ARGS $1"
15 | shift
16 | fi
17 | done
18 |
19 | if [[ ! -f "$IMAGE_TAR" ]]; then
20 | echo "Error: Image tar file '$IMAGE_TAR' not found!"
21 | exit 1
22 | fi
23 |
24 |
25 | # Check if the image is already loaded
26 | if ! docker images | grep -q "$IMAGE_NAME"; then
27 | echo "Image '$IMAGE_NAME' not found. Loading the image..."
28 | if ! docker load -i "$IMAGE_TAR" > /dev/null 2>&1; then
29 | echo "Error: Failed to load image '$IMAGE_TAR'."
30 | exit 1
31 | fi
32 | fi
33 | # Otherwise, the image is already loaded
34 |
35 | # Format the run statement for container port mapping
36 | docker run --init -p "$PORT":50051 activity-image
37 |
--------------------------------------------------------------------------------
/sdk/python/pyproject.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "hipcheck-sdk"
3 | version = "0.2.1"
4 | description = "An SDK for developing Hipcheck plugins"
5 | readme = "README.md"
6 | authors = [
7 | { name = "j-lanson", email = "jlanson@mitre.org" }
8 | ]
9 | requires-python = ">=3.10"
10 | classifiers = [
11 | "Programming Language :: Python :: 3",
12 | "Operating System :: OS Independent"
13 | ]
14 | license = "Apache-2.0"
15 | license-files = ["LICENSE"]
16 |
17 | dependencies = [
18 | "asyncio>=3.4.3",
19 | "coverage>=7.6.12",
20 | "datamodel-code-generator>=0.28.5",
21 | "grpcio>=1.70.0",
22 | "grpcio-tools>=1.70.0",
23 | "logging>=0.4.9.6",
24 | "pydantic>=2.10.6",
25 | "pytest>=8.3.5",
26 | "pytest-asyncio>=0.26.0",
27 | "sphinx>=8.1.3",
28 | "wheel>=0.45.1",
29 | ]
30 |
31 | [project.urls]
32 | Homepage = "https://hipcheck.mitre.org/"
33 | Documentation = "https://hipcheck.mitre.org/sdk/python/hipcheck_sdk.html"
34 | Repository = "https://github.com/mitre/hipcheck.git"
35 | Issues = "https://github.com/mitre/hipcheck/issues"
36 |
37 | [build-system]
38 | requires = ["hatchling"]
39 | build-backend = "hatchling.build"
40 |
--------------------------------------------------------------------------------
/hipcheck/src/init/indicatif_log_bridge.rs:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 |
3 | //! The `indicatif-log-bridge` crate discards filtering information when using env_logger, so I'm writting my own.
4 |
5 | use crate::shell::Shell;
6 | use env_logger::Logger;
7 | use log::SetLoggerError;
8 |
9 | pub struct LogWrapper(pub Logger);
10 |
11 | impl log::Log for LogWrapper {
12 | fn enabled(&self, metadata: &log::Metadata) -> bool {
13 | self.0.enabled(metadata)
14 | }
15 |
16 | fn log(&self, record: &log::Record) {
17 | // Don't suspend the shell if we're not gonna log the message.
18 | if log::logger().enabled(record.metadata()) {
19 | Shell::in_suspend(|| self.0.log(record))
20 | }
21 | }
22 |
23 | fn flush(&self) {
24 | Shell::in_suspend(|| self.0.flush())
25 | }
26 | }
27 |
28 | impl LogWrapper {
29 | pub fn try_init(self) -> Result<(), SetLoggerError> {
30 | if !Shell::is_init() {
31 | panic!("Initialize the global shell before initializing this logger");
32 | }
33 |
34 | let max_filter_level = self.0.filter();
35 |
36 | log::set_boxed_logger(Box::new(self))?;
37 |
38 | log::set_max_level(max_filter_level);
39 |
40 | Ok(())
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/plugins/churn/src/metric.rs:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 |
3 | use std::iter::Iterator;
4 |
5 | /// Calculate the arithmetic mean for a set of floats. Returns an option to account
6 | /// for the possibility of dividing by zero.
7 | pub fn mean(data: &[f64]) -> Optionmitre/fuzz"
5 | ---
6 |
7 | # `mitre/fuzz`
8 |
9 | Checks if a project participates in OSS Fuzz.
10 |
11 | ## Configuration
12 |
13 | None
14 |
15 | ## Default Policy Expression
16 |
17 | ```
18 | (eq $ #t)
19 | ```
20 |
21 | ## Default Query: `mitre/fuzz`
22 |
23 | Returns `true` if the project _does_ participate in OSS Fuzz, `false` otherwise.
24 |
25 | ## Explanation
26 |
27 | Repos being checked by Hipcheck may receive regular fuzz testing. This analysis
28 | checks if the repo is participating in the OSS Fuzz program. If it is fuzzed,
29 | this is considered a signal of a repository being lower risk.
30 |
31 | ## Limitations
32 |
33 | * __Not all languagues supported__: Robust fuzzing tools do not exist for every
34 | language. It is possible fuzz testing was not done because no good option for it
35 | existed at the time. Lack of fuzzing in those cases would still indicate a higher
36 | risk, but it would not necessarily indicate bad software development practices.
37 | * __Only OSS Fuzz checked__: At this time, Hipcheck only checks if the repo
38 | participates in Google's OSS Fuzz. Other fuzz testing programs exist, but a repo
39 | will not pass this analysis if it uses one of those instead.
40 |
--------------------------------------------------------------------------------
/hipcheck/src/init/git2_log_shim.rs:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 |
3 | //! Log shim function to redirect [git2] trace messages to [log].
4 |
5 | use crate::hc_error;
6 |
7 | /// Shim the [git2] crate's tracing infrastructure with calls to the [log] crate which we use.
8 | pub fn git2_set_trace_log_shim() {
9 | git2::trace_set(git2::TraceLevel::Trace, |level, msg| {
10 | use git2::TraceLevel;
11 | use log::{Level, RecordBuilder};
12 |
13 | // Coerce fatal down to error since there's no trivial equivalent.
14 | let log_level = match level {
15 | TraceLevel::Debug => Level::Debug,
16 | TraceLevel::Fatal | TraceLevel::Error => Level::Error,
17 | TraceLevel::Warn => Level::Warn,
18 | TraceLevel::Info => Level::Info,
19 | TraceLevel::Trace => Level::Trace,
20 | // git2 should not produce trace messages with no level.
21 | other @ TraceLevel::None => panic!("Unsupported git2 log level: {other:?}"),
22 | };
23 |
24 | let mut record_builder = RecordBuilder::new();
25 |
26 | record_builder.level(log_level).target("libgit2");
27 |
28 | let msg_str = std::str::from_utf8(msg).unwrap_or("non-UTF8 string received in callback");
29 |
30 | log::logger().log(&record_builder.args(format_args!("{}", msg_str)).build());
31 | })
32 | .map_err(|e| hc_error!("Failed to set git2 callback: {}", e))
33 | .unwrap();
34 | }
35 |
--------------------------------------------------------------------------------
/plugins/churn/src/types.rs:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 |
3 | use schemars::JsonSchema;
4 | use serde::{Deserialize, Serialize};
5 | use std::result::Result;
6 |
7 | #[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash, JsonSchema)]
8 | pub struct Commit {
9 | pub hash: String,
10 | pub written_on: Resultmitre/activity"
5 | ---
6 |
7 | # `mitre/activity`
8 |
9 | Determines if a project is actively maintained.
10 |
11 | ## Configuration
12 |
13 | | Parameter | Type | Explanation |
14 | |:----------|:----------|:--------------|
15 | | `weeks` | `Integer` | The permitted number of weeks before a project is considered inactive. |
16 |
17 | ## Default Policy Expression
18 |
19 | ```
20 | (lte $ P{config.weeks or 71}w)
21 | ```
22 |
23 | ## Default Query: `mitre/activity`
24 |
25 | Returns a `Span` representing the time from the most recent commit to now.
26 |
27 | ## Limitations
28 |
29 | * __Cases where lack of updates is warranted__: Sometimes work on a piece of
30 | software stops because it is complete, and there is no longer a need to
31 | update it. In this case, a repository being flagged as failing this analysis
32 | may not be truly risky for lack of activity. However, _most of the time_
33 | we expect that lack of updates ought to be concern, and so considering this
34 | metric when analyzing software supply chain risk is reasonable. If you
35 | are in a context where lack of updates is desirable or not concerning, you
36 | may consider changing the configuration to a different duration, or disabling
37 | the analysis entirely.
38 |
--------------------------------------------------------------------------------
/sdk/python/docs/source/hipcheck_sdk.rst:
--------------------------------------------------------------------------------
1 | hipcheck\_sdk package
2 | =====================
3 |
4 | Subpackages
5 | -----------
6 |
7 | Submodules
8 | ----------
9 |
10 | hipcheck\_sdk.cli module
11 | ------------------------
12 |
13 | .. automodule:: hipcheck_sdk.cli
14 | :members:
15 | :undoc-members:
16 | :show-inheritance:
17 |
18 | hipcheck\_sdk.engine module
19 | ---------------------------
20 |
21 | .. automodule:: hipcheck_sdk.engine
22 | :members:
23 | :undoc-members:
24 | :show-inheritance:
25 |
26 | hipcheck\_sdk.error module
27 | --------------------------
28 |
29 | .. automodule:: hipcheck_sdk.error
30 | :members:
31 | :undoc-members:
32 | :show-inheritance:
33 |
34 | hipcheck\_sdk.options module
35 | ----------------------------
36 |
37 | .. automodule:: hipcheck_sdk.options
38 | :members:
39 | :undoc-members:
40 | :show-inheritance:
41 |
42 | hipcheck\_sdk.query module
43 | --------------------------
44 |
45 | .. automodule:: hipcheck_sdk.query
46 | :members:
47 | :undoc-members:
48 | :show-inheritance:
49 |
50 | hipcheck\_sdk.server module
51 | ---------------------------
52 |
53 | .. automodule:: hipcheck_sdk.server
54 | :members:
55 | :undoc-members:
56 | :show-inheritance:
57 |
58 |
59 | Module contents
60 | ---------------
61 |
62 | .. automodule:: hipcheck_sdk
63 | :members:
64 | :undoc-members:
65 | :show-inheritance:
66 |
--------------------------------------------------------------------------------
/xtask/src/task/manifest/mod.rs:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 |
3 | mod download_manifest;
4 | mod kdl;
5 | mod local;
6 | mod remote;
7 | mod util;
8 |
9 | use download_manifest::DownloadManifestEntry;
10 |
11 | use anyhow::Result;
12 | use std::collections::HashSet;
13 |
14 | #[allow(unused)]
15 | pub use kdl::ParseKdlNode;
16 |
17 | pub fn run() -> Result<()> {
18 | let api_token = std::env::var("HC_GITHUB_TOKEN")?;
19 | let releases = remote::get_hipcheck_plugin_releases(&api_token)?;
20 |
21 | for (name, remote_entries) in releases.0 {
22 | // We know all releases off the hipcheck github repo are mitre-published
23 | let local_manifest_path = local::get_download_manifest_path("mitre", &name)?;
24 | let local_entries = local::try_parse_download_manifest(&local_manifest_path)?;
25 |
26 | let remote_set = HashSet::Written by {{ page.authors.0 }}
23 |Posted on {{ page.date | date(format="%B %-d, %Y") }}
24 |