Audits
An audit checks the code of a stack against the policies of its bundles. Each audit covers one environment of the stack, or the whole stack when it has no environment. The result tells you which policies pass and which resources break one. The resources that break a policy are the findings.
Nimzo also runs a check on each pull request of a stack. A check has the same report as an audit. For the pull request side, see Stacks.
Before you start
Section titled “Before you start”You need a stack, and a bundle to run on it: a bundle assigned to the stack or to its space, or one you add for a single run. The Run audit button stays disabled while your organization has no stack.
The Audits page
Section titled “The Audits page”Select Audits in the Governance group of the sidebar. The page lists the audits of every stack, newest first. By default it says “The code of every stack, checked against its bundles, per environment.”
Each row shows one audit:
| Column | What it shows |
|---|---|
| Run # | The number of the audit, such as #212. Use it to name an audit in a message. |
| Status | Passed, Failed, or the state of an audit that still runs. |
| Environment | The environment of the stack the audit ran on. Not audited means the audit had no environment. Unknown means the stack no longer has that environment. |
| Findings | The findings by severity, or Passed when there are none. |
| Trigger → scope | What started the audit and what it covered: the stack, the environment and the number of bundles. An audit of uploaded files shows Uploaded files. |
| When | How long ago the audit started. |
Select a row to open its report. The list loads more audits as you scroll. Before your first audit, the page says “No audits yet.”
Filter the audits
Section titled “Filter the audits”Select Filters above the table to narrow the list. You can combine filters:
- Stack: one or more stacks. The page description then names the stacks you picked.
- Environment: one environment. This filter shows only while you pick exactly one stack, because an environment belongs to a stack.
- Started from: Manual, Pull request or CLI.
- Result: Passed, Failed or Running.
The filters in use show in a bar under the menu. Select Clear in the bar to remove them. When no audit matches the filters, the page offers Clear filters.
Read the side panel
Section titled “Read the side panel”The side panel sums up the latest completed audits that match your filters. Use Side panel view at the right of the toolbar to switch its view. Use the panel toggle in the page header to hide it.
- Overview shows Top policies, the policies with most findings, and Severity rank, the findings by severity.
- Severity shows one card for each severity. Each card gives the findings of that severity, how they changed since the last run, and a View audit → link to the audit they come from.
Run an audit
Section titled “Run an audit”Run an audit to see where the code on a branch stands now. You do not need to wait for a pull request.
- Select Run audit in the page header. If you filtered the list to one stack, the dialog starts on that stack. Otherwise, search for the stack and select it. Select Change to pick another stack.
- Under Environments, select the environments to audit. Each environment runs on the latest commit of its own branch.
- Check Bundles that will run. This list holds the bundles of the stack. Select a bundle to see its policies. If the stack has no bundle, the dialog says “No bundle runs on this stack yet” and offers Add bundles and Manage bundles.
- Optional: select Advanced to run on another Git ref, or to add Additional bundles for this run only.
- Select Run audit. When you pick more than one environment, the button reads Run followed by the number of evaluations.
A toast says “Audit started”, and the new audit shows at the top of the list. The audit stays in the Running state, usually for under a minute. You can leave the page. The result shows when the check finishes.
If the audit does not start, the dialog says “Could not start the audit.” Check your connection, then select Retry.
The audit report
Section titled “The audit report”Select a row of the list to open its report. The title reads “Audit” followed by the number, the stack and the environment. A pull request check reads “Check on pull request” followed by its number. The header also has a Run audit again button, and for a pull request check a Run again button and a Go to pull request link.
The status line under the title shows the result, how many policies the audit checked, and how many passed. When a failed policy blocks merging, the line also counts these blockers.
The result is one of these:
- Passed: “All policies passed” and “Nothing to fix in this audit.” The page then lists the policies it checked, with their Severity and ID.
- Failed: the page lists the findings.
- Warning: the audit has findings, but none of them blocks merging. The page says which severities your stack blocks on and which ones the audit found. You can still fix the findings.
- Could not evaluate: none of the policies could run. The page shows the reason. Select Run audit again to start another audit.
- Running: the page says Nimzo is checking the policies, on which branch and commit. It usually takes under a minute.
The side column of the report
Section titled “The side column of the report”The side column, “About this audit”, gives the facts of the audit: the Stack, the Environment, the Commit and the Branch, who started it (Started by), the Input (Code or Plan), the Bundles and policies, which severities the audit Would block, when it Started, and how long it ran (Duration). It also lists other audits of the stack, and the Policies passed.
Read the findings
Section titled “Read the findings”The section Findings lists one card for each failed policy. The card header shows:
- The severity, the title and the public ID of the policy. Select the ID to open the policy.
- Blocker when the policy blocks merging on this stack.
- The number of Files with findings and Resources with findings.
Select the arrow at the left of the header to collapse the card. If a policy reports errors while it runs, the card says so, and Nimzo did not evaluate its resources.
Under the header, each failing resource has its own card. A finding card shows:
- The resource and where it sits in your code.
- The suggested fix as a diff, with the Lines changed by the fix. If the fix changes other files too, they show here.
- The evaluated values. These are the values the policy read on the attributes at fault, such as
versioning = false. Next to each value, “set in” names the file and line that set it. Use this to find the place you must change, even when a variable or a module sets the value from far away. - Reason. This text says what is wrong on the resource and what the fix does. It shows two lines. Select Reason to read all of it.
Review the suggested fixes
Section titled “Review the suggested fixes”When a finding has a suggested fix, you decide on it with the buttons at the bottom of its card:
- Accept: the fix goes into the commit or the pull request.
- Reject: the finding stays open, and the card hides the code of the fix.
- Undo: take back your decision.
At the top of the findings, a banner counts the fixes, for example “3 fixes suggested”. It has buttons to decide on all the fixes at once: Reject all and Accept all and open pull request. On a pull request check the second button reads Accept all and commit. After you decide on some fixes, the banner counts them as accepted, rejected and “to review”, and offers Reject the rest and Accept the rest. When you decide on all of them, the banner gives the button Open pull request with the number of accepted fixes. On a pull request check, it reads Commit instead. If the banner scrolls out of view, the same buttons float at the bottom of the page.
Your decisions are drafts. Nimzo does not save them, so they are gone when you leave the page.
Review the accepted fixes
Section titled “Review the accepted fixes”Select the banner button to open the review dialog. The dialog has two steps, and it writes the text that goes to Git. It does not change anything until the last button, and you can select Cancel or press Esc at any time. Your decisions stay on the page.
-
In the first step, check the changes. The left column lists the files, for example “3 fixes in 2 files”, with the number of lines added and removed. Select a file to see its code. The accepted fixes show in the code, and Lines changed by the fix marks them. Select Continue.
-
In the second step, read the text Nimzo wrote for Git. Each field is filled in, so you can confirm without typing. Change what you want. Select Back to return to the changes.
For a pull request check, the dialog is “Commit” followed by the number of fixes and the branch. It has one field:
- Commit message: for example “fix: apply 2 fixes suggested by the check (BB-S3-01, BB-KMS-03)”.
For an audit, the dialog is “Open a pull request with” followed by the number of fixes. It has these fields:
- New branch: the branch Nimzo creates, for example
nimzo/fix-audit-212. - Merge into: the branch the pull request targets. By default this is the branch the audit ran on.
- Title: for example “Fix 2 findings from audit #212 (payments-api · production)”.
- Description: one block for each policy, with its title, its ID and one line for each resource. The last line says that you suggested and accepted each fix in the audit report.
A required field that you leave empty shows an error: “Write a commit message”, “Name the new branch” or “Give the pull request a title”.
The buttons Commit and push and Open pull request are not available yet. The text you review here is ready for them, but Nimzo does not commit to your repository from this dialog today. To apply a fix now, make the change in the file and line that the finding names.
What happens next
Section titled “What happens next”After you change the code and push it, the next audit or pull request check shows whether the finding is gone. Select Run audit again in the report to start another audit at once.
Troubleshooting
Section titled “Troubleshooting”- This check does not exist. The audit or check is gone, or the address is wrong. Go back to Audits and select it again.
- Could not load this check. Reload the page. If the error stays, check your connection.
- Could not load audits. Check your connection and try again. Select Retry under the message.
- Could not load the summary. The table works, but the side panel could not read the latest audits. Select Retry in the panel.
- Could not load the code of this file. This message shows in the fix review. Close the dialog and open it again.