Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cheriot-audit docs & exercises #46

Merged
merged 4 commits into from
Sep 25, 2024

Conversation

AlexJones0
Copy link
Contributor

This PR adds documentation/exercises for cheriot-audit and OPA Rego (the language it uses).

A short documentation page on auditing firmware is introduced - this primarily provides a link to documentation sources (for CHERIoT Audit and Rego), an introduction to what CHERIoT Audit is used for, a guide to setting up and using cheriot-audit, as well as some basic recommendations for Rego development.

3 self-contained exercises are then introduced, alongside a quick introduction/primer explaining some basic concepts/syntax in Rego to enable readers to follow the exercises. The exercises are as follows:

  1. Exercise 1: follows a policy for checking that sealed capabilities are not used inside firmware, and for inspecting these capabilities. This is intended to be a shorter example to introduce the syntax and use of Rego and CHERIoT Audit.
  2. Exercise 2: follows a policy for checking that only specific functions run with interrupts disabled. This is intended to be a far more practical and useful longer example which introduces more of Rego's features. It also introduces a built-in function from CHERIoT Audit to motivate readers to check for existing built-in functionality.
  3. Exercise 3: follows a policy for checking that heap allocation limits are followed by firmware. This is again intended to be a more practical and useful longer example.

Note that this PR is made based on my understanding of CHERIoT Audit / Rego solely from some initial experimentation and developing these three exercises. As such, there may be some instances where wording is not entirely accurate or best practices are not being followed. I have mainly focused on creating and documenting some working examples, to be able to showcase what kind of things are possible when auditing firmware.

Copy link
Member

@HU90m HU90m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really enjoyed reading through this

exercises/firmware_auditing/README.md Outdated Show resolved Hide resolved
doc/auditing-firmware.md Show resolved Hide resolved
doc/auditing-firmware.md Outdated Show resolved Hide resolved
doc/auditing-firmware.md Outdated Show resolved Hide resolved
exercises/firmware_auditing/README.md Outdated Show resolved Hide resolved
exercises/firmware_auditing/README.md Outdated Show resolved Hide resolved
exercises/firmware_auditing/README.md Outdated Show resolved Hide resolved
exercises/firmware_auditing/README.md Outdated Show resolved Hide resolved
exercises/firmware_auditing/README.md Outdated Show resolved Hide resolved
exercises/firmware_auditing/README.md Show resolved Hide resolved
Adds a basic document giving an introduction to `cheriot-audit`, a short
guide to setting it up, a brief introduction to using it, and pointers
to appropriate upstream sources of documentation.

This also includes a quick primer on Rego, with an introduction to some
of the language's features and syntax.
Copy link
Member

@HU90m HU90m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minimal changes then this can be merged

exercises/firmware_auditing/README.md Outdated Show resolved Hide resolved
exercises/firmware_auditing/README.md Outdated Show resolved Hide resolved
This commit introduces exercise 1 for using CHERIoT Audit to audit
firmware alongside Rego policies. This exercise involves writing a
policy to detect if firmware uses sealed capabilities, and to query
information about these capabilities if they exist.
This commit introduces exercise 2 for using CHERIoT Audit to audit
firmware alongside Rego policies. This exercise involves writing
a policy to ensure that only specified functions are running
with interrupts disabled.
This commit introduces exercise 3 for using CHERIoT Audit to audit
firmware alongside Rego policies. This exercise involves writing
a policy to ensure that specific allocation limits are respected, with
individual allocation limits per allocation capability, per compartment
(total) and across all compartments.
@AlexJones0 AlexJones0 merged commit 70e3161 into lowRISC:main Sep 25, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants