Cehpoint

Free preview lesson ยท 20 min

Command-based checks: scan, fix, verify, report

From the course For developers: secure by default with Cehpoint on your machine.

Command-based checks: scan, fix, verify, report

In this lesson you will run the skill's checks from a terminal with cehpoint-soc, read its exit codes, and use scan as a simple gate before a release.

The same engine, from a terminal

The skill package installs a terminal command, cehpoint-soc, with the same functions as the MCP tools. It is useful when your assistant cannot show confirmation forms, when you prefer the terminal, or when you want a check inside a script.

bash
cehpoint-soc scan .            # check this project
cehpoint-soc fix .             # plan fixes and apply each one you confirm
cehpoint-soc verify .          # check again after changes
cehpoint-soc report . --open   # write the private HTML report and open it

Each command takes a directory (. is the current one). Add --json for machine-readable output.

scan

scan reads the project's lock files locally and checks the package names and versions against the online vulnerability lookup. It also looks for files that look like leaked secrets, locally, reporting only paths and counts. The supported lock files are listed in the next module.

fix

fix first builds a plan of the changes it would make. For each change you type yes in the terminal. A change is applied only if the file has not changed since the plan was made; if you or someone else edited it in between, the skill refuses and you plan again. No flag or piped input can answer for you, so yes | cehpoint-soc fix . does not work, by design.

verify and report

verify checks the project again after your changes, so you can see that the finding has gone. report writes a private HTML report of the project check that you can keep or share with your team; --open opens it.

Exit codes

Code Meaning
0 Nothing found
1 Error (for example no network, or no supported lock file)
2 Findings present

Because "findings present" has its own code, scan makes a simple gate:

bash
cehpoint-soc scan . --json > cehpoint-scan.json
status=$?
if [ "$status" -eq 2 ]; then echo "Vulnerable libraries found: see cehpoint-scan.json"; exit 1; fi
if [ "$status" -eq 1 ]; then echo "Check failed to run"; exit 1; fi

Treat code 1 as a failure of the check, not as a pass. A gate that lets a release through when the check could not run is not a gate.

Other commands you will meet

The command also covers the account: status, devices, alerts, explain <id>, incident <id>, action <alert_id> <action>, check <device_id>, software <device_id>, connect [server|windows|mac], protect, block <ip> [days], unblock <ip>, intel, update [--check] and help. Actions and blocks still ask you to confirm.

Where results go

Results of a skill check are kept with your account for that device and project, so they appear in the console beside the agents' findings. Only the findings are kept (names, versions, fixed versions, severity, CVEs), never the lock-file text.

Hands-on lab

Environment: Your own computer with the skill installed (or follow along on paper)

  1. In a project with a lock file, run cehpoint-soc scan . and then echo $? (or echo $LASTEXITCODE in PowerShell). Note the exit code.
  2. Run cehpoint-soc scan . --json and find the list of findings.
  3. Run cehpoint-soc fix .. When it asks, answer anything other than yes for the first change, and confirm the file is unchanged.
  4. Run cehpoint-soc report . --open and read the report.
  5. Write the three lines your build script would need to stop a release on exit code 2 and on exit code 1.

Summary

  • scan, fix, verify, report: the same flow as the skill, from a terminal.
  • fix needs a typed yes for each change and refuses if the file changed since the plan.
  • Exit codes: 0 nothing found, 1 error, 2 findings present.
  • Fail the gate on 2 and on 1.

Sources