Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-33, add fix_version_dependant #39

Merged
merged 4 commits into from
Apr 15, 2022
Merged

Conversation

danielmkn
Copy link
Collaborator

Adding new field to Security Policy
The field is not backward compatible with previous Xray versions, so I've added omitempty.
Default value is false in the UI.
Added test and documentation updates.

@@ -19,6 +19,8 @@ type PolicyRuleCriteria struct {
// Security Criteria
MinimumSeverity string `json:"min_severity,omitempty"` // Omitempty is used because the empty field is conflicting with CVSSRange
CVSSRange *PolicyCVSSRange `json:"cvss_range,omitempty"`
// Omitempty is used in FixVersionDependant because an empty field throws an error in Xray below 3.44.3
FixVersionDependant bool `json:"fix_version_dependant,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code alignment? make fmt?

Copy link
Collaborator Author

@danielmkn danielmkn Apr 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's broken by the comment, have to fix it manually. make fmt doesn't capture thing like this, unfortunately

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's because the comment line is not at the end of the code line.

@@ -119,6 +120,7 @@ Optional:
Optional:

- **cvss_range** (Block List, Max: 1) Nested block describing a CVS score range to be impacted. Defined below. (see [below for nested schema](#nestedblock--rule--criteria--cvss_range))
- **fix_version_dependant** (Boolean) Issues that do not have a fixed version are not generated until a fixed version is available.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include default value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-generated. Do we add default values in this case? i don't like the idea to fix manually whatever was generated

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we will generate docs the next time, the manual change will be removed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment below. Add default value to attribute's description.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to the description

Type: schema.TypeBool,
Optional: true,
Default: false,
Description: "Issues that do not have a fixed version are not generated until a fixed version is available.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include default value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean? There is a default value, but auto-generation didn't pick it up for some reason

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Artifactory provider, we include the default value as part of the description. The auto-gen plugin will copy that description to the doc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

@@ -31,6 +31,7 @@ resource "xray_security_policy" "security1" {

criteria {
min_severity = "High"
fix_version_dependant = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HCL alignment?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed all HCL formatting in the project, will be in the next commit

@@ -9,6 +9,7 @@ resource "xray_security_policy" "min_severity" {

criteria {
min_severity = "High"
fix_version_dependant = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HCL alignment?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, fixed

@@ -24,6 +24,7 @@ resource "xray_security_policy" "min_severity" {

criteria {
min_severity = "High"
fix_version_dependant = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HCL alignment?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, this one is generated from examples/resources/xray_security_policy/resource.tf

@danielmkn
Copy link
Collaborator Author

HCL formatting is fixed, go formatting is fixed manually. And I don't like the idea of changing an auto-generated document by adding the default value. Thoughts, @alexhung

Add default value in the description
@danielmkn danielmkn requested a review from alexhung April 15, 2022 16:39
@danielmkn danielmkn merged commit 9ac588e into master Apr 15, 2022
@danielmkn danielmkn deleted the GH-33-fix_version_dependant branch April 15, 2022 16:43
alexhung added a commit that referenced this pull request Jul 6, 2022
alexhung added a commit that referenced this pull request Jul 6, 2022
alexhung added a commit that referenced this pull request Jul 6, 2022
…ocumentation

Update documentation for Ant pattern filter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants