mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-12 07:40:48 -08:00
docs: fix modules path and update code example (#9539)
Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
This commit is contained in:
@@ -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.
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user