Documentation
¶
Index ¶
- Variables
- func DoRequestWithRetry(req *http.Request, client *http.Client) (*http.Response, error)
- type Block
- type CSVReaderLibrary
- type CSVReaderLibraryInterface
- type CVE
- type DepList
- type Dependency
- type DependencyWithIntegration
- type FakeCVEParam
- type Integration
- type MongoLibrary
- func (mu MongoLibrary) AddTrackedDependencies(ctx context.Context, client *mongo.Client, dependencies []Dependency) error
- func (mu MongoLibrary) CVEExists(ctx context.Context, client *mongo.Client, cveId string) (bool, error)
- func (mu MongoLibrary) CreateCVE(ctx context.Context, client *mongo.Client, cve *CVE) error
- func (mu MongoLibrary) DisconnectMongoClient(client *mongo.Client, ctx context.Context) error
- func (mu MongoLibrary) FindCVE(ctx context.Context, client *mongo.Client, product string) (CVE, error)
- func (mu MongoLibrary) FindUserByUsername(ctx context.Context, client *mongo.Client, username string) (bool, User, error)
- func (mu MongoLibrary) GetAllCVEs(ctx context.Context, client *mongo.Client) ([]CVE, error)
- func (mu MongoLibrary) GetMongoClient() (*mongo.Client, context.Context, error)
- func (mu MongoLibrary) GetMongoCollection(client *mongo.Client, database, collection string) *mongo.Collection
- func (mu MongoLibrary) GetTrackedDependencies(ctx context.Context, client *mongo.Client) ([]Dependency, error)
- func (mu MongoLibrary) GetUniqueDependencies(ctx context.Context, client *mongo.Client) ([]CVE, error)
- func (mu MongoLibrary) GetUserDependencies(ctx context.Context, client *mongo.Client, userId string) (UserDependencies, error)
- func (mu MongoLibrary) RegisterUser(ctx context.Context, client *mongo.Client, user User) error
- func (mu MongoLibrary) RemoveAllCVEs(ctx context.Context, client *mongo.Client, product string) error
- func (mu MongoLibrary) RemoveTrackedDependencies(ctx context.Context, client *mongo.Client, dependencies []Dependency) error
- func (mu MongoLibrary) UpdateUserDependencies(ctx context.Context, client *mongo.Client, userId string, ...) error
- type MongoLibraryInterface
- type NVDNistLibrary
- type NVDNistLibraryInterface
- type NVDNistResponse
- type NVDNistResponseCVE
- type NVDNistResponseCVEItem
- type NVDNistResponseCVEMetrics
- type Payload
- type SlackLibrary
- type SlackLibraryInterface
- type Text
- type User
- type UserDependencies
Constants ¶
This section is empty.
Variables ¶
View Source
var DATABASE = "buildpacks"
Functions ¶
Types ¶
type CSVReaderLibrary ¶
func NewCSVReaderLibrary ¶
func NewCSVReaderLibrary(filePath string) CSVReaderLibrary
func (CSVReaderLibrary) GetDependenciesList ¶
func (csvU CSVReaderLibrary) GetDependenciesList() ([]DepList, error)
type CVE ¶
type CVE struct { ID primitive.ObjectID `bson:"_id"` CreatedAt time.Time `bson:"created_at"` UpdatedAt time.Time `bson:"updated_at"` Vendor string `bson:"vendor"` Product string `bson:"product"` Severity string `bson:"severity"` CVEId string `bson:"cve_id"` Description string `bson:"description"` Score float64 `bson:"score"` }
type Dependency ¶
type DependencyWithIntegration ¶
type DependencyWithIntegration struct { DependencyId string `json:"dependency_id"` Integration Integration `json:"integration"` }
type FakeCVEParam ¶
type Integration ¶
type MongoLibrary ¶
func NewMongoLibrary ¶
func NewMongoLibrary(dbUri string) MongoLibrary
func (MongoLibrary) AddTrackedDependencies ¶
func (mu MongoLibrary) AddTrackedDependencies(ctx context.Context, client *mongo.Client, dependencies []Dependency) error
func (MongoLibrary) DisconnectMongoClient ¶
func (MongoLibrary) FindUserByUsername ¶
func (MongoLibrary) GetAllCVEs ¶
func (MongoLibrary) GetMongoClient ¶
func (MongoLibrary) GetMongoCollection ¶
func (mu MongoLibrary) GetMongoCollection(client *mongo.Client, database, collection string) *mongo.Collection
func (MongoLibrary) GetTrackedDependencies ¶
func (mu MongoLibrary) GetTrackedDependencies(ctx context.Context, client *mongo.Client) ([]Dependency, error)
func (MongoLibrary) GetUniqueDependencies ¶
func (MongoLibrary) GetUserDependencies ¶
func (mu MongoLibrary) GetUserDependencies(ctx context.Context, client *mongo.Client, userId string) (UserDependencies, error)
func (MongoLibrary) RegisterUser ¶
func (MongoLibrary) RemoveAllCVEs ¶
func (MongoLibrary) RemoveTrackedDependencies ¶
func (mu MongoLibrary) RemoveTrackedDependencies(ctx context.Context, client *mongo.Client, dependencies []Dependency) error
func (MongoLibrary) UpdateUserDependencies ¶
func (mu MongoLibrary) UpdateUserDependencies(ctx context.Context, client *mongo.Client, userId string, userDeps []DependencyWithIntegration) error
type MongoLibraryInterface ¶
type MongoLibraryInterface interface { GetMongoClient() (*mongo.Client, context.Context, error) DisconnectMongoClient(client *mongo.Client, ctx context.Context) error GetMongoCollection(client *mongo.Client, database, collection string) *mongo.Collection CreateCVE(ctx context.Context, client *mongo.Client, cve *CVE) error GetUniqueDependencies(ctx context.Context, client *mongo.Client) ([]CVE, error) FindCVE(ctx context.Context, client *mongo.Client, product string) (CVE, error) RemoveAllCVEs(ctx context.Context, client *mongo.Client, product string) error CVEExists(ctx context.Context, client *mongo.Client, cveId string) (bool, error) GetAllCVEs(ctx context.Context, client *mongo.Client) ([]CVE, error) GetTrackedDependencies(ctx context.Context, client *mongo.Client) ([]Dependency, error) AddTrackedDependencies(ctx context.Context, client *mongo.Client, dependencies []Dependency) error RemoveTrackedDependencies(ctx context.Context, client *mongo.Client, dependencies []Dependency) error RegisterUser(ctx context.Context, client *mongo.Client, user User) error FindUserByUsername(ctx context.Context, client *mongo.Client, username string) (bool, User, error) GetUserDependencies(ctx context.Context, client *mongo.Client, userId string) (UserDependencies, error) UpdateUserDependencies(ctx context.Context, client *mongo.Client, userId string, userDeps []DependencyWithIntegration) error }
type NVDNistLibrary ¶
func NewNVDNistLibrary ¶
func NewNVDNistLibrary(nvdNistApiKey string) NVDNistLibrary
func (NVDNistLibrary) GetCVEs ¶
func (nvd NVDNistLibrary) GetCVEs(vendor, product string) ([]NVDNistResponseCVEItem, error)
type NVDNistLibraryInterface ¶
type NVDNistLibraryInterface interface {
GetCVEs(vendor, product string) ([]NVDNistResponseCVEItem, error)
}
type NVDNistResponse ¶
type NVDNistResponse struct { ResultsPerPage int `json:"resultsPerPage"` StartIndex int `json:"startIndex"` TotalResults int `json:"totalResults"` Format string `json:"format"` Version string `json:"version"` Timestamp string `json:"timestamp"` Vulnerabilities []NVDNistResponseCVEItem `json:"vulnerabilities"` }
type NVDNistResponseCVE ¶
type NVDNistResponseCVE struct { Id string `json:"id"` SourceIdentifier string `json:"sourceIdentifier"` Published string `json:"published"` LastModified string `json:"lastModified"` VulnStatus string `json:"vulnStatus"` Descriptions []struct { Lang string `json:"lang"` Value string `json:"value"` } `json:"descriptions"` Metrics struct { CvssMetricV2 []NVDNistResponseCVEMetrics `json:"cvssMetricV2,omitempty"` CvssMetricV3 []NVDNistResponseCVEMetrics `json:"cvssMetricV31,omitempty"` } `json:"metrics"` }
type NVDNistResponseCVEItem ¶
type NVDNistResponseCVEItem struct {
CVE NVDNistResponseCVE `json:"cve"`
}
func GenerateFakeCVE ¶
func GenerateFakeCVE(params []FakeCVEParam) []NVDNistResponseCVEItem
type SlackLibrary ¶
func NewSlackLibrary ¶
func NewSlackLibrary(webhookUrl string) SlackLibrary
func (SlackLibrary) SendNewCVENotification ¶
func (s SlackLibrary) SendNewCVENotification(product, cveId, description, severity string, score float64) error
type SlackLibraryInterface ¶
type UserDependencies ¶
type UserDependencies struct { UserID string `json:"user_id" bson:"user_id"` DependenciesWithInt []DependencyWithIntegration `json:"dependencies_with_integration" bson:"dependencies_with_integration"` }
Click to show internal directories.
Click to hide internal directories.