Skip to content

Commit 9fa70fc

Browse files
committed
feat: Reflect Comments
1 parent 4c6a0aa commit 9fa70fc

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

cmd/inspect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Partial certificates are also all printed for further inspection.
4848
return err
4949
}
5050

51-
analyser, err := analyse.NewAnalyser(analyseOpts.MozillaRemovedCertsURL)
51+
analyser, err := analyse.NewAnalyser(analyseOpts)
5252
if err != nil {
5353
return errors.Wrap(err, "failed to initialise analyser")
5454
}

internal/analyse/analyse.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"time"
1212

1313
"github.com/hako/durafmt"
14+
"github.com/jetstack/paranoia/cmd/options"
1415
)
1516

1617
type NoteLevel string
@@ -36,22 +37,23 @@ type Analyser struct {
3637
RemovedCertificates []removedCertificate
3738
}
3839

40+
const defaultMozillaRemovedCACertificateReportURL = "https://ccadb.my.salesforce-sites.com/mozilla/RemovedCACertificateReportCSVFormat"
41+
3942
// NewAnalyser creates a new Analyzer using the public Mozilla CA removed certificate list as part of
4043
// its checks. This method performs HTTP requests to retrieve that list. The request will be made with the given
41-
// context. If mozillaRemovedCertsURL is empty, the default Mozilla URL will be used.
42-
func NewAnalyser(mozillaRemovedCertsURL string) (*Analyser, error) {
43-
rc, err := downloadMozillaRemovedCACertsList(mozillaRemovedCertsURL)
44+
// context. The options struct configures various aspects of the analysis.
45+
func NewAnalyser(opts *options.Analyse) (*Analyser, error) {
46+
rc, err := downloadMozillaRemovedCACertsList(opts)
4447
if err != nil {
4548
return nil, err
4649
}
4750
return &Analyser{RemovedCertificates: rc}, nil
4851
}
4952

50-
func downloadMozillaRemovedCACertsList(mozillaRemovedCertsURL string) ([]removedCertificate, error) {
51-
const defaultMozillaRemovedCACertificateReportURL = "https://ccadb.my.salesforce-sites.com/mozilla/RemovedCACertificateReportCSVFormat"
53+
func downloadMozillaRemovedCACertsList(opts *options.Analyse) ([]removedCertificate, error) {
5254

5355
// Use default URL if none provided
54-
url := mozillaRemovedCertsURL
56+
url := opts.MozillaRemovedCertsURL
5557
if url == "" {
5658
url = defaultMozillaRemovedCACertificateReportURL
5759
}

0 commit comments

Comments
 (0)