Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Lilley Brinker <[email protected]>
  • Loading branch information
alilleybrinker committed Oct 10, 2024
1 parent 829883e commit 92b4476
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 32 deletions.
2 changes: 1 addition & 1 deletion site/content/docs/guide/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ by opening an issue on our [issue tracker](https://github.com/mitre/hipcheck/iss
- [Why Hipcheck?](@/docs/guide/why.md)
- [Key Concepts](@/docs/guide/concepts/index.md)
- [How to use Hipcheck](@/docs/guide/how-to-use.md)
- [The Plugin System](@/docs/guide/plugin/index.md)
- [Plugins](@/docs/guide/plugin/index.md)
- [Analyses](@/docs/guide/analyses.md)
- [Configuration](@/docs/guide/configuration.md)
- [Debugging](@/docs/guide/debugging.md)
25 changes: 8 additions & 17 deletions site/content/docs/guide/plugin/for-developers.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
---
title: For Developers
title: Developing Plugins
---

# Creating a New Plugin
# Developing Plugins

## Creating a New Plugin

A Hipcheck plugin is a separate executable artifact that Hipcheck downloads,
starts, and communicates with over a gRPC protocol to request data. A plugin's
executable artifact is the binary, set of executable program files, Docker
container, or other artifact which can be run as a command line interface
program through a singular "start command" defined in the plugin's
[manifest file](#plugin-manifest).
manifest file.

The benefit of the executable-and-gRPC plugin design is that plugins can be
written in any of the many languages that have a gRPC library. One drawback is
Expand All @@ -19,8 +21,8 @@ target platforms. This can be simplified through the optional use of container
files as the plugin executable artifact.

Once a plugin author writes their plugin, compiles, packages, and
[distribute](#distributing-your-plugin) it, Hipcheck users can specify the
plugin in their policy file for Hipcheck to fetch and use in analysis.
distribute it, Hipcheck users can specify the plugin in their policy file for
Hipcheck to fetch and use in analysis.

## Plugin CLI

Expand All @@ -30,8 +32,7 @@ on. The port provided via this CLI argument must be the port the running plugin
process listens on for gRPC requests, and on which it returns responses.

Once started, the plugin should continue running, listening for gRPC requests
from Hipcheck, until shut down by the Hipcheck process. For information on the
Hipcheck gRPC protocol, see [here](#the-plugin-grpc-protocol).
from Hipcheck, until shut down by the Hipcheck process.

## The Rust SDK

Expand Down Expand Up @@ -274,13 +275,3 @@ on the returned `PluginServer` instance. This function will not return until
the gRPC channel with Hipcheck core is closed.

And that's all there is to it! Happy plugin development!

# The Plugin gRPC Protocol

# The Query Protocol

# Distributing Your Plugin

## Plugin Manifest

## Plugin Download Manifest
4 changes: 3 additions & 1 deletion site/content/docs/guide/plugin/for-users.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
title: For Users
title: Using Plugins
---

# Using Plugins

When running Hipcheck, users provide a "policy file", which is a
[KDL](https://kdl.dev/)-language configuration file that describes everything
about how to perform the analysis. It specifies which top-level plugins to
Expand Down
15 changes: 11 additions & 4 deletions site/content/docs/guide/plugin/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: The Plugin System
title: Plugins
---

# Introduction
Expand All @@ -17,7 +17,14 @@ in turn query information from other plugins, which Hipcheck performs on their
behalf.

The remainder of this section of the documentation is split in two. The [first
section](for-users) is aimed at users. It covers how they can specify analysis
section](for-users) is aimed at users. It covers how they can specify analysis
plugins and control the use of their data in producing a pass/fail determination
for a given target. The [second section](for-developers) is aimed at plugin
developers, and explains how to create and distribute your own plugin.
for a given target. The [second section](for-developers) is aimed at plugin
developers, and explains how to create and distribute your own plugin.


## Table of Contents

- [Using Plugins](@/docs/guide/plugin/for-users.md)
- [Developing Plugins](@/docs/guide/plugin/for-developers.md)
- [Policy Expressions](@/docs/guide/plugin/policy-expr.md)
22 changes: 13 additions & 9 deletions site/content/docs/guide/plugin/policy-expr.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
Policy Expression Reference
title: Policy Expressions
---

# Policy Expressions

"Policy expressions" are a small expression language in Hipcheck that allows the
JSON data output by analysis plugins to be reduced to a boolean pass/fail
determination used for scoring. Policy expressions are mostly found in policy
Expand Down Expand Up @@ -34,14 +36,14 @@ Policy expressions have the following primitive types:

#### Datetime

Datetimes use the string format from the `jiff` [crate](), which is a lightly
modified version of ISO8601. A datetime must include a date in the format
`<YYYY>-<MM>-<DD>`. An optional time in the format `T<HH>:[MM]:[SS]` will be
accepted after the date. Decimal fractions of hours and minutes are not allowed;
use smaller time units instead (e.g. `T10:30` instead of `T10.5`). Decimal
fractions of seconds are allowed. The timezone is always internally resolved to
UTC, but you can specify the datetime's original timezone as an an offset from
UTC by including `+{HH}:[MM]` or `-{HH}:[MM]`.
Datetimes use the string format from the `jiff` [crate][jiff], which is a
lightly modified version of ISO8601. A datetime must include a date in the
format `<YYYY>-<MM>-<DD>`. An optional time in the format `T<HH>:[MM]:[SS]` will
be accepted after the date. Decimal fractions of hours and minutes are not
allowed; use smaller time units instead (e.g. `T10:30` instead of `T10.5`).
Decimal fractions of seconds are allowed. The timezone is always internally
resolved to UTC, but you can specify the datetime's original timezone as an an
offset from UTC by including `+{HH}:[MM]` or `-{HH}:[MM]`.

#### Span

Expand Down Expand Up @@ -193,3 +195,5 @@ percentage of elements of an array that pass a filter:
This policy expression will check that less than half of the elements in `$` are
less than 10. It uses JSON pointers twice, once to get the total element count,
again to count the number of elements filtered by the lambda.

[jiff]: https://crates.io/crates/jiff

0 comments on commit 92b4476

Please sign in to comment.