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

feat: deployment experience integration allow list for cmd API #287

Merged
merged 4 commits into from
Jan 20, 2021

Conversation

varas
Copy link
Contributor

@varas varas commented Jan 18, 2021

For security reasons, command channel won't allow arbitrary integration executions. These ones should be listed in the allow-list.

@varas varas requested a review from a team January 18, 2021 17:03
@coveralls
Copy link

coveralls commented Jan 18, 2021

Pull Request Test Coverage Report for Build 498124943

  • 7 of 11 (63.64%) changed or added relevant lines in 3 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.008%) to 58.129%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/agent/cmdchannel/runintegration/runintegration.go 1 3 33.33%
internal/agent/cmdchannel/stopintegration/stopintegration.go 1 3 33.33%
Files with Coverage Reduction New Missed Lines %
pkg/metrics/sampler/sampler_routine.go 2 94.74%
Totals Coverage Status
Change from base Build 495815148: 0.008%
Covered Lines: 11431
Relevant Lines: 19665

💛 - Coveralls

{"empty", "", false},
{"allowed", "nri-lsi-java", true},
{"not allowed", "", false},
{"extra suffix", "nri-lsi-java-foo", false},
Copy link
Contributor

Choose a reason for hiding this comment

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

'empty' and 'not allowed' are the same case. And 'extra suffix' is not allowed as well right?

@@ -54,6 +56,10 @@ func NewHandler(definitionQ chan<- integration.Definition, il integration.Instan
return
}

if cmdapi.IsAllowedToRunStopFromCmdAPI(args.IntegrationName) {
return ErrIntNotAllowed
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Make sense to move it to be the first we validate. Therefore we avoid to 'Unmarshal' if there is no need.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

only previous check is empty case, and I think that's correct, as it should provide its own error, otherwise this IsAllowedToRunStopFromCmdAPI should return a 3rd case (not bool anymore) where it says empty case is not handled

@brushknight brushknight added this to In Progress in CAOS: Our Daily Bread Jan 19, 2021
@brushknight brushknight moved this from In Progress to Ready For Review in CAOS: Our Daily Bread Jan 19, 2021
@@ -26,7 +27,8 @@ const cmdName = "run_integration"

// Errors
var (
ErrNoIntName = errors.New("missing required \"integration_name\"")
ErrNoIntName = errors.New("missing required \"integration_name\"")
ErrIntNotAllowed = errors.New("integration now allowed to run/stop from command channel")
Copy link
Contributor

Choose a reason for hiding this comment

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

small typo here? "now" -> "not"?

Copy link
Contributor

@cristianciutea cristianciutea left a comment

Choose a reason for hiding this comment

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

LGTM

@varas varas merged commit cefa2ea into master Jan 20, 2021
@varas varas deleted the feat_dep-exp-allow-list branch January 20, 2021 14:38
@varas varas moved this from Ready For Review to Ready For Release in CAOS: Our Daily Bread Jan 20, 2021
@varas varas moved this from Ready For Release to Done in CAOS: Our Daily Bread Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants