Skip to content

Commit a3d22b7

Browse files
M09Icclaude
andcommitted
refactor: rename VulnResult to TemplateResult
VulnResult was misleading — it's the JSON-serializable form of any neutron template execution, not just vulnerability findings. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4dc8b98 commit a3d22b7

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

neutron/vuln_result.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,31 @@ package neutron
22

33
import "github.com/chainreactors/sdk/pkg/types"
44

5-
// VulnResult builds a serializable VulnResult from the execution result.
6-
func (r *ExecuteResult) VulnResult(target string) *types.VulnResult {
5+
// TemplateResult builds a serializable TemplateResult from the execution result.
6+
func (r *ExecuteResult) TemplateResult(target string) *types.TemplateResult {
77
if r == nil {
88
return nil
99
}
10-
vr := &types.VulnResult{
10+
tr := &types.TemplateResult{
1111
Target: target,
1212
Matched: r.Matched(),
1313
}
1414
if tmpl := r.template; tmpl != nil {
15-
vr.TemplateID = tmpl.Id
16-
vr.TemplateName = tmpl.Info.Name
17-
vr.Severity = tmpl.Info.Severity
18-
vr.Description = tmpl.Info.Description
19-
vr.References = tmpl.Info.Reference
20-
vr.Tags = tmpl.Info.Tags
21-
vr.Classification = tmpl.Info.Classification
15+
tr.TemplateID = tmpl.Id
16+
tr.TemplateName = tmpl.Info.Name
17+
tr.Severity = tmpl.Info.Severity
18+
tr.Description = tmpl.Info.Description
19+
tr.References = tmpl.Info.Reference
20+
tr.Tags = tmpl.Info.Tags
21+
tr.Classification = tmpl.Info.Classification
2222
}
2323
if data := r.Value(); data != nil {
2424
if op := data.Result; op != nil {
25-
vr.Events = op.Events
26-
vr.Request = op.Request
27-
vr.Response = op.Response
28-
vr.PayloadValues = op.PayloadValues
25+
tr.Events = op.Events
26+
tr.Request = op.Request
27+
tr.Response = op.Response
28+
tr.PayloadValues = op.PayloadValues
2929
}
3030
}
31-
return vr
31+
return tr
3232
}

pkg/types/vuln_result.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package types
22

3-
// VulnResult is the JSON-serializable form of a neutron vulnerability finding.
4-
type VulnResult struct {
3+
// TemplateResult is the JSON-serializable form of a neutron template execution.
4+
type TemplateResult struct {
55
Target string `json:"target"`
66
TemplateID string `json:"template_id"`
77
TemplateName string `json:"template_name,omitempty"`

0 commit comments

Comments
 (0)