Skip to content

Commit

Permalink
Merge pull request #85 from jfrog/GH-60-xray-reports
Browse files Browse the repository at this point in the history
GH-60 Add Xray reports
  • Loading branch information
danielmkn authored Nov 10, 2022
2 parents 7ee1e62 + fb459d0 commit 2589467
Show file tree
Hide file tree
Showing 27 changed files with 3,051 additions and 71 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 1.9.0 (October 18, 2022). Tested on Artifactory 7.46.11 and Xray 3.59.7

NEW FEATURE:

* resource/xray_licenses_report: add a new resource allowing to create Xray Licenses report.
* resource/xray_operational_risks_report: add a new resource allowing to create Xray Operational Risks report.
* resource/xray_violations_report: add a new resource allowing to create Xray Violations report.
* resource/xray_vulnerabilities_report: add a new resource allowing to create Xray Vulnerabilities report.

Issue [#60](https://github.com/jfrog/terraform-provider-xray/issues/60)
PR [#85](https://github.com/jfrog/terraform-provider-xray/pull/85)

## 1.8.0 (October 18, 2022). Tested on Artifactory 7.46.10 and Xray 3.59.4

IMPROVEMENTS:
Expand Down
133 changes: 133 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,139 @@ resource "xray_repository_config" "xray-repo-config" {
retention_in_days = 90
}
}
resource "xray_licenses_report" "report" {
name = "test-license-report"
resources {
repository {
name = "reponame"
include_path_patterns = ["pattern1","pattern2"]
exclude_path_patterns = ["pattern2","pattern2"]
}
repository {
name = "reponame1"
include_path_patterns = ["pattern1","pattern2"]
exclude_path_patterns = ["pattern1","pattern2"]
}
}
filters {
component = "component-name"
artifact = "impacted-artifact"
unknown = false
unrecognized = true
license_names = ["Apache","MIT"]
scan_date {
start = "2020-06-29T12:22:16Z"
end = "2020-07-29T12:22:16Z"
}
}
}
resource "xray_operational_risks_report" "report" {
name = "test-operational-risks-report"
resources {
repository {
name = "reponame"
include_path_patterns = ["pattern1","pattern2"]
exclude_path_patterns = ["pattern2","pattern2"]
}
repository {
name = "reponame1"
include_path_patterns = ["pattern1"]
exclude_path_patterns = ["pattern3","pattern4"]
}
}
filters {
component = "component-name"
artifact = "impacted-artifact"
risks = ["High","Medium"]
scan_date {
start = "2020-06-29T12:22:16Z"
end = "2020-07-29T12:22:16Z"
}
}
}
resource "xray_violations_report" "report" {
name = "test-violations-report"
resources {
repository {
name = "reponame"
include_path_patterns = ["pattern1","pattern2"]
exclude_path_patterns = ["pattern2","pattern2"]
}
repository {
name = "reponame1"
include_path_patterns = ["pattern1","pattern2"]
exclude_path_patterns = ["pattern1","pattern2"]
}
}
filters {
type = "security"
watch_names = ["NameOfWatch1","NameOfWatch2"]
watch_patterns = ["WildcardWatch*","WildcardWatch1*"]
component = "*vulnerable:component*"
artifact = "some://impacted*artifact"
policy_names = ["policy1","policy2"]
severities = ["High","Medium"]
updated {
start = "2020-06-29T12:22:16Z"
end = "2020-07-29T12:22:16Z"
}
security_filters {
issue_id = "XRAY-87343"
cvss_score {
min_score = 6.3
max_score = 9
}
summary_contains = "kernel"
has_remediation = true
}
license_filters {
unknown = false
unrecognized = true
license_names = ["Apache","MIT"]
}
}
}
resource "xray_vulnerabilities_report" "report" {
name = "test-vulnerabilities-report"
resources {
repository {
name = "reponame"
include_path_patterns = ["pattern1","pattern2"]
exclude_path_patterns = ["pattern2","pattern2"]
}
repository {
name = "reponame1"
include_path_patterns = ["pattern1","pattern2"]
exclude_path_patterns = ["pattern1","pattern2"]
}
}
filters {
vulnerable_component = "component-name"
impacted_artifact = "impacted-artifact"
has_remediation = false
cve = "CVE-1234-1234"
cvss_score {
min_score = 6.3
max_score = 9
}
published {
start = "2020-06-29T12:22:16Z"
end = "2020-07-29T12:22:16Z"
}
scan_date {
start = "2020-06-29T12:22:16Z"
end = "2020-07-29T12:22:16Z"
}
}
}
```

## Authentication
Expand Down
143 changes: 143 additions & 0 deletions docs/resources/licenses_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "xray_licenses_report Resource - terraform-provider-xray"
subcategory: ""
description: |-
Creates Xray License Due Diligence report. The License Due Diligence report provides you with a list of components and artifacts and their relevant licenses. This enables you to review and verify that the components and artifacts comply with the license requirements. This report provides due diligence license related information on each component for a selected scope. Due diligence license information includes information such as unknown licenses and unrecognized licenses found in your components.
---

# xray_licenses_report (Resource)

Creates Xray License Due Diligence report. The License Due Diligence report provides you with a list of components and artifacts and their relevant licenses. This enables you to review and verify that the components and artifacts comply with the license requirements. This report provides due diligence license related information on each component for a selected scope. Due diligence license information includes information such as unknown licenses and unrecognized licenses found in your components.

## Example Usage

```terraform
resource "xray_licenses_report" "report" {
name = "test-license-report"
resources {
repository {
name = "reponame"
include_path_patterns = ["pattern1", "pattern2"]
exclude_path_patterns = ["pattern2", "pattern2"]
}
repository {
name = "reponame1"
include_path_patterns = ["pattern1", "pattern2"]
exclude_path_patterns = ["pattern1", "pattern2"]
}
}
filters {
component = "component-name"
artifact = "impacted-artifact"
unknown = false
unrecognized = true
license_names = ["Apache", "MIT"]
scan_date {
start = "2020-06-29T12:22:16Z"
end = "2020-07-29T12:22:16Z"
}
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `filters` (Block Set, Min: 1) Advanced filters. (see [below for nested schema](#nestedblock--filters))
- `name` (String) Name of the report.
- `resources` (Block Set, Min: 1, Max: 1) The list of resources to include into the report. (see [below for nested schema](#nestedblock--resources))

### Optional

- `project_key` (String) Project key for assigning this resource to. Must be 3 - 10 lowercase alphanumeric and hyphen characters.
- `report_id` (Number) Report ID

### Read-Only

- `id` (String) The ID of this resource.

<a id="nestedblock--filters"></a>
### Nested Schema for `filters`

Optional:

- `artifact` (String) Artifact name.
- `component` (String) Artifact's component.
- `license_names` (Set of String) Filter licenses by names. Only one of 'license_names' or 'license_patterns' can be set.
- `license_patterns` (Set of String) Filter licenses by patterns. Only one of 'license_names' or 'license_patterns' can be set.
- `scan_date` (Block Set, Max: 1) (see [below for nested schema](#nestedblock--filters--scan_date))
- `unknown` (Boolean) Unknown displays the components that Xray could not discover any licenses for.
- `unrecognized` (Boolean) Unrecognized displays the components that Xray found licenses for, but these licenses are not Xray recognized licenses.

<a id="nestedblock--filters--scan_date"></a>
### Nested Schema for `filters.scan_date`

Optional:

- `end` (String) Scan end date.
- `start` (String) Scan start date.



<a id="nestedblock--resources"></a>
### Nested Schema for `resources`

Optional:

- `builds` (Block Set, Max: 1) The builds to include into the report. Only one type of resource can be set per report. (see [below for nested schema](#nestedblock--resources--builds))
- `projects` (Block Set, Max: 1) The projects to include into the report. Only one type of resource can be set per report. (see [below for nested schema](#nestedblock--resources--projects))
- `release_bundles` (Block Set, Max: 1) The release bundles to include into the report. Only one type of resource can be set per report. (see [below for nested schema](#nestedblock--resources--release_bundles))
- `repository` (Block Set) The list of repositories for the report. Only one type of resource can be set per report. (see [below for nested schema](#nestedblock--resources--repository))

<a id="nestedblock--resources--builds"></a>
### Nested Schema for `resources.builds`

Optional:

- `exclude_patterns` (Set of String) The list of exclude patterns. Only one of 'names' or '*_patterns' can be set.
- `include_patterns` (Set of String) The list of include patterns. Only one of 'names' or '*_patterns' can be set.
- `names` (Set of String) The list of build names. Only one of 'names' or '*_patterns' can be set.
- `number_of_latest_versions` (Number) The number of latest build versions to include to the report.


<a id="nestedblock--resources--projects"></a>
### Nested Schema for `resources.projects`

Optional:

- `include_key_patterns` (Set of String) The list of include patterns.
- `names` (Set of String) The list of project names.
- `number_of_latest_versions` (Number) The number of latest release bundle versions to include to the report.


<a id="nestedblock--resources--release_bundles"></a>
### Nested Schema for `resources.release_bundles`

Optional:

- `exclude_patterns` (Set of String) The list of exclude patterns
- `include_patterns` (Set of String) The list of include patterns
- `names` (Set of String) The list of release bundles names.
- `number_of_latest_versions` (Number) The number of latest release bundle versions to include to the report.


<a id="nestedblock--resources--repository"></a>
### Nested Schema for `resources.repository`

Required:

- `name` (String) Repository name.

Optional:

- `exclude_path_patterns` (Set of String) Exclude path patterns.
- `include_path_patterns` (Set of String) Include path patterns.


4 changes: 2 additions & 2 deletions docs/resources/operational_risk_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ resource "xray_operational_risk_policy" "min_risk" {
notify_watch_recipients = true
notify_deployer = true
create_ticket_enabled = false // set to true only if Jira integration is enabled
build_failure_grace_period_in_days = 5 // use only if fail_build is enabled
build_failure_grace_period_in_days = 5 // use only if fail_build is enabled
block_download {
unscanned = true
Expand Down Expand Up @@ -76,7 +76,7 @@ resource "xray_operational_risk_policy" "custom_criteria" {
notify_watch_recipients = true
notify_deployer = true
create_ticket_enabled = false // set to true only if Jira integration is enabled
build_failure_grace_period_in_days = 5 // use only if fail_build is enabled
build_failure_grace_period_in_days = 5 // use only if fail_build is enabled
block_download {
unscanned = true
Expand Down
Loading

0 comments on commit 2589467

Please sign in to comment.