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

Add solution design for Authn-K8s namespace label constraint #2603

Merged
merged 1 commit into from
Oct 18, 2022

Conversation

john-odonnell
Copy link
Contributor

Desired Outcome

Add solution design for Authn-K8s namespace label constraint

Implemented Changes

N/A

Connected Issue/Story

CyberArk internal issue link: ONYX-21265

Definition of Done

At least 1 todo must be completed in the sections below for the PR to be
merged.

Changelog

  • 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
  • A follow-up issue to update official docs has been filed here: insert issue ID
  • This PR does not require updating any documentation

Behavior

  • This PR changes product behavior and has been reviewed by a PO, or
  • These changes are part of a larger initiative that will be reviewed later, or
  • No behavior was changed with this PR

Security

  • Security architect has reviewed the changes in this PR,
  • These changes are part of a larger initiative with a separate security review, or
  • There are no security aspects to these changes

design/proposals/namespace_label_authenticator.md Outdated Show resolved Hide resolved
design/proposals/namespace_label_authenticator.md Outdated Show resolved Hide resolved
design/proposals/namespace_label_authenticator.md Outdated Show resolved Hide resolved
design/proposals/namespace_label_authenticator.md Outdated Show resolved Hide resolved
design/proposals/namespace_label_authenticator.md Outdated Show resolved Hide resolved
@john-odonnell john-odonnell force-pushed the label-selector-design branch 4 times, most recently from aa3deda to e7cb9fb Compare July 20, 2022 20:12
design/proposals/namespace_label_authenticator.md Outdated Show resolved Hide resolved
design/proposals/namespace_label_authenticator.md Outdated Show resolved Hide resolved
design/proposals/namespace_label_authenticator.md Outdated Show resolved Hide resolved
design/proposals/namespace_label_authenticator.md Outdated Show resolved Hide resolved
design/proposals/namespace_label_authenticator.md Outdated Show resolved Hide resolved

| **Subject** | **Description** | **Issue Mitigation** |
|-------------|-----------------|----------------------|
| **Many Similarly-Labeled Namespaces** | Using Kubernetes' native label selector implementation would mean receiving a list of all similarly-labeled namespaces, and limiting those results further based on a request's origin namespace. For a cluster with many similarly-labeled namespaces, this operation could be costly. | Instead of querying the Kubernetes API for a list of all similarly-labeled namespaces, we can get only the request's origin namespace, and then validate its labels against the configured selector locally. This means Conjur is only ever querying for a single resource instead of a open-ended multitude. |
Copy link
Member

Choose a reason for hiding this comment

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

Worth mentioning that from a performance standpoint, it's still one more call than all our other types of authentications? (service account, controller, namespace and so on)
Because in others, we query the Pod and we get all the relevant information we need from that object. Here we will need to perform one more call, on the Namespace object of the Pod to get its labels.


| **Security Issue** | **Description** | **Resolution** |
|--------------------|-----------------|----------------|
| **Added Permissions** | The Authenticator identity needs a new permission to get any namespace in a cluster. | This is necessary, and an improvement over requiring permission to list all namespaces in a cluster. List permission means the identity can discover unknown resources, but get permission requires knowledge of existing resources. |
Copy link
Member

Choose a reason for hiding this comment

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

The permission is required only in the namespaces in which Conjur needs to provide service.
Since we currently already provide permissions on a per namespace level (as a guideline we don't recommend cluster wide permission to Conjur), then this new permission will be on these namespaces only as well.

@doodlesbykumbi doodlesbykumbi marked this pull request as ready for review October 18, 2022 14:17
@doodlesbykumbi doodlesbykumbi requested a review from a team as a code owner October 18, 2022 14:17
a good way to justify this scope of identity privilege, but it also means
that workloads across namespace groups either:

- must use the same type of authentication sidecar (`authenticator`,
Copy link

Choose a reason for hiding this comment

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

Inconsistent indentation for list items at the same level


- must use the same type of authentication sidecar (`authenticator`,
`secrets-provider-for-k8s`)
- must use a standard, and possibly misrepresentative, container name for all
Copy link

Choose a reason for hiding this comment

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

Inconsistent indentation for list items at the same level

a good way to justify this scope of identity privilege, but it also means
that workloads across namespace groups either:

- must use the same type of authentication sidecar (`authenticator`,
Copy link

Choose a reason for hiding this comment

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

Unordered list indentation

- !host
id: test-app
annotations:
authn-k8s/namespace-label: "key1=value1"
Copy link

Choose a reason for hiding this comment

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

Trailing spaces


## Definition of Done

- Solution designed is approved
Copy link

Choose a reason for hiding this comment

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

Trailing spaces

@codeclimate
Copy link

codeclimate bot commented Oct 18, 2022

Code Climate has analyzed commit b0f8978 and detected 80 issues on this pull request.

Here's the issue category breakdown:

Category Count
Style 80

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 90.0% (-1.5% change).

View more on Code Climate.

Copy link
Contributor

@doodlesbykumbi doodlesbykumbi left a comment

Choose a reason for hiding this comment

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

LGTM!

@john-odonnell john-odonnell merged commit 6854f78 into master Oct 18, 2022
@john-odonnell john-odonnell deleted the label-selector-design branch October 18, 2022 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants