docs: fix modules path and update code example (#9539)

Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
This commit is contained in:
Nikita Pivkin
2025-09-26 21:13:33 +06:00
committed by GitHub
parent a4cbd6a138
commit e149094f9b
2 changed files with 11 additions and 3 deletions

View File

@@ -47,8 +47,8 @@ Trivy adheres to the XDG specification, so the location depends on whether XDG_D
Trivy will now search XDG_DATA_HOME for the location of the Trivy modules cache.
The preference order is as follows:
- XDG_DATA_HOME if set and .trivy/plugins exists within the XDG_DATA_HOME dir
- $HOME/.trivy/plugins
- XDG_DATA_HOME if set and .trivy/modules exists within the XDG_DATA_HOME dir
- $HOME/.trivy/modules
For example, to download the WebAssembly module, you can execute the following command:
@@ -137,6 +137,10 @@ $ go mod init github.com/aquasecurity/trivy-module-wordpress
```go
package main
import (
"github.com/aquasecurity/trivy/pkg/module/wasm"
)
const (
version = 1
name = "wordpress-module"
@@ -145,6 +149,10 @@ const (
// main is required for Go to compile the Wasm module
func main() {}
func init() {
wasm.RegisterModule(WordpressModule{})
}
type WordpressModule struct{
// Cannot define fields as modules can't keep state.
}

View File

@@ -26,6 +26,6 @@ type PostScanSpec struct {
Action PostScanAction
// IDs represent which vulnerability and misconfiguration ID will be updated or deleted in post scanning.
// When the action is UPDATE, the matched result will be passed to the module.
// When the action is UPDATE or DELETE, the matched result will be passed to the module.
IDs []string
}