Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/resources/repository_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Optional:

- `exposures` (Block Set) Enables Xray to perform scans for multiple categories that cover security issues in your configurations and the usage of open source libraries in your code. Available only to CLOUD (SaaS)/SELF HOSTED for ENTERPRISE X and ENTERPRISE+ with Advanced DevSecOps. Must be set for Docker, Maven, NPM, PyPi, and Terraform Backend package type. (see [below for nested schema](#nestedblock--config--exposures))
- `retention_in_days` (Number) The artifact will be retained for the number of days you set here, after the artifact is scanned. This will apply to all artifacts in the repository. Can be omitted when `paths_config` is set.
- `vuln_contextual_analysis` (Boolean) Enables or disables vulnerability contextual analysis. Only for SaaS instances, will be available after Xray 3.59. Must be set for Docker, OCI, and Maven package types.
- `vuln_contextual_analysis` (Boolean) Enables or disables vulnerability contextual analysis. Only for SaaS instances, will be available after Xray 3.59. Must be set for Docker, OCI, Maven, and Gradle package types.

<a id="nestedblock--config--exposures"></a>
### Nested Schema for `config.exposures`
Expand Down
8 changes: 6 additions & 2 deletions pkg/xray/resource/resource_xray_repository_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ var vulnContextualAnalysisPackageTypes = func(xrayVersion string) []string {
packageTypes = append(packageTypes, "maven")
}

if ok, err := util.CheckVersion(xrayVersion, "3.108.0"); err == nil && ok {
packageTypes = append(packageTypes, "gradle")
}

return packageTypes
}

Expand Down Expand Up @@ -500,7 +504,7 @@ var schemaV0 = schema.Schema{
Attributes: map[string]schema.Attribute{
"vuln_contextual_analysis": schema.BoolAttribute{
Optional: true,
Description: "Only for SaaS instances, will be available after Xray 3.59. Enables vulnerability contextual analysis. Must be set together with `exposures`. Supported for Docker, OCI, and Maven package types.",
Description: "Only for SaaS instances, will be available after Xray 3.59. Enables vulnerability contextual analysis. Must be set together with `exposures`. Supported for Docker, OCI, Maven, and Gradle package types.",
},
"retention_in_days": schema.Int64Attribute{
Optional: true,
Expand Down Expand Up @@ -661,7 +665,7 @@ var schemaV1 = schema.Schema{
Attributes: map[string]schema.Attribute{
"vuln_contextual_analysis": schema.BoolAttribute{
Optional: true,
Description: "Enables or disables vulnerability contextual analysis. Only for SaaS instances, will be available after Xray 3.59. Must be set for Docker, OCI, and Maven package types.",
Description: "Enables or disables vulnerability contextual analysis. Only for SaaS instances, will be available after Xray 3.59. Must be set for Docker, OCI, Maven, and Gradle package types.",
},
"retention_in_days": schema.Int64Attribute{
Optional: true,
Expand Down
2 changes: 2 additions & 0 deletions pkg/xray/resource/resource_xray_repository_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ func TestAccRepositoryConfig_RepoConfig_Create_VulnContextualAnalysis(t *testing
}{
{"docker", TestDataRepoConfigDockerTemplate, "3.67.9"},
{"maven", TestDataRepoConfigMavenTemplate, "3.77.4"},
{"gradle", TestDataRepoConfigGradleTemplate, "3.108.0"},
}

version, err := util.GetXrayVersion(acctest.GetTestResty(t))
Expand Down Expand Up @@ -812,6 +813,7 @@ resource "xray_repository_config" "{{ .resource_name }}" {

config {
retention_in_days = {{ .retention_in_days }}
vuln_contextual_analysis = {{ .vuln_contextual_analysis }}

exposures {
scanners_category {
Expand Down
Loading