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

2011 cidr host factory token #2012

Merged
merged 1 commit into from
Jan 26, 2021
Merged

2011 cidr host factory token #2012

merged 1 commit into from
Jan 26, 2021

Conversation

liavyona
Copy link

@liavyona liavyona commented Jan 26, 2021

What does this PR do?

Now verifies that CIDR parameter in POST /host_factory_tokens has no invalid ip address or CIDR range value
image

What ticket does this PR close?

Resolves #2011

Checklists

Change log

  • The CHANGELOG has been updated, or
  • This PR does not include user-facing changes and doesn't require a CHANGELOG update

Test coverage

  • This PR includes new unit and integration tests to go with the code changes, or
  • The changes in this PR do not require tests

Documentation

  • Docs (e.g. READMEs) were updated in this PR, and/or there is a follow-on issue to update docs, or
  • This PR does not require updating any documentation

@liavyona liavyona requested a review from a team as a code owner January 26, 2021 10:43
@liavyona liavyona self-assigned this Jan 26, 2021
@liavyona liavyona force-pushed the 2011-cidr-host-factory-token branch from 5500114 to 03a212f Compare January 26, 2021 10:45
@@ -42,6 +42,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `GET /resources` request with non-numeric delimiter (limit or offset) now
returns `Error 422 Unprocessable Entity` instead of `Error 500`.
[cyberark/conjur#1997](https://github.com/cyberark/conjur/issues/1997)
- `POST /host_factory_tokens` request with invalid ip address or CIDR range of `cidr` parameter
Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

How about
POST /host_factory_tokens request which has invalid ip address or CIDR range in cidr parameter

Copy link
Contributor

@shulifink shulifink Jan 27, 2021

Choose a reason for hiding this comment

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

@liavyona not sure the context of the text - confused by the original and @InbalZilberman's comment

In the meantime, IP is always caps

Copy link
Contributor

@InbalZilberman InbalZilberman left a comment

Choose a reason for hiding this comment

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

thanks!

@@ -42,6 +42,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `GET /resources` request with non-numeric delimiter (limit or offset) now
returns `Error 422 Unprocessable Entity` instead of `Error 500`.
[cyberark/conjur#1997](https://github.com/cyberark/conjur/issues/1997)
- `POST /host_factory_tokens` request with invalid ip address or CIDR range of `cidr` parameter
Copy link
Contributor

Choose a reason for hiding this comment

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

How about
POST /host_factory_tokens request which has invalid ip address or CIDR range in cidr parameter

@liavyona liavyona force-pushed the 2011-cidr-host-factory-token branch from 03a212f to ae42b2a Compare January 26, 2021 11:50
Copy link
Member

@orenbm orenbm left a comment

Choose a reason for hiding this comment

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

left some comments

@liavyona liavyona force-pushed the 2011-cidr-host-factory-token branch from ae42b2a to 30d8b09 Compare January 26, 2021 12:18
@liavyona liavyona requested a review from orenbm January 26, 2021 12:18
@liavyona liavyona force-pushed the 2011-cidr-host-factory-token branch from 30d8b09 to 7abd75e Compare January 26, 2021 12:31

def validate_cidr
cidr = self[:cidr]
unless cidr.blank?
Copy link

Choose a reason for hiding this comment

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

Use a guard clause instead of wrapping the code inside a conditional expression.

Copy link
Member

Choose a reason for hiding this comment

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

feel free to ignore this

@codeclimate
Copy link

codeclimate bot commented Jan 26, 2021

Code Climate has analyzed commit 7abd75e and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Style 1

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 89.3% (0.0% change).

View more on Code Climate.

Copy link
Contributor

@izgeri izgeri left a comment

Choose a reason for hiding this comment

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

changelog entry LGTM :)

@liavyona liavyona merged commit 59e1647 into master Jan 26, 2021
@liavyona liavyona deleted the 2011-cidr-host-factory-token branch January 26, 2021 14:14
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.

POST host_facotry_tokenswith invalid cidr should return 422
5 participants