Skip to content

refactor(rpc): remove unused Insecure field from ServiceOption #10098

Description

@knqyf263

Description

The Insecure field in ServiceOption struct (pkg/rpc/client/client.go) is defined but never used.

https://github.com/aquasecurity/trivy/blob/749f72680bbd42295688ae00c6f3d14b04addb09/pkg/rpc/client/client.go#L26-L31

type ServiceOption struct {
    RemoteURL     string
    Insecure      bool       // <- This field is unused
    CustomHeaders http.Header
    PathPrefix    string
}

Background

The Insecure option is already configured at the transport level via xhttp.SetDefaultTransport() in pkg/commands/artifact/run.go:

xhttp.SetDefaultTransport(xhttp.NewTransport(xhttp.Options{
    Insecure:  cliOptions.Insecure,
    CACerts:   cliOptions.CACerts,
    Timeout:   cliOptions.Timeout,
    TraceHTTP: cliOptions.TraceHTTP,
}))

Since xhttp.Client() uses the default transport, the Insecure setting is automatically applied. Therefore, ServiceOption.Insecure is redundant and can be safely removed.

Proposed Solution

  1. Remove the Insecure field from ServiceOption struct in pkg/rpc/client/client.go
  2. Update any code that sets this field (if any)

References

Metadata

Metadata

Labels

good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/cleanupCategorizes issue or PR as related to cleaning up code, process, or technical debt.

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions