Skip to content

Commit

Permalink
[8.12] [Cloud Security] Hide temporarily unsupported option from azur…
Browse files Browse the repository at this point in the history
…e manual options (elastic#173988) (elastic#174024)

# Backport

This will backport the following commits from `main` to `8.12`:
- [[Cloud Security] Hide temporarily unsupported option from azure
manual options (elastic#173988)](elastic#173988)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Jordan","email":"51442161+JordanSh@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-12-28T14:50:45Z","message":"[Cloud
Security] Hide temporarily unsupported option from azure manual options
(elastic#173988)","sha":"0d86b40e2dd0b4f70dd344c8078125c515165dd9","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Cloud
Security","v8.12.0","v8.13.0"],"title":"[Cloud Security] Hide
temporarily unsupported option from azure manual
options","number":173988,"url":"https://github.com/elastic/kibana/pull/173988","mergeCommit":{"message":"[Cloud
Security] Hide temporarily unsupported option from azure manual options
(elastic#173988)","sha":"0d86b40e2dd0b4f70dd344c8078125c515165dd9"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","branchLabelMappingKey":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/173988","number":173988,"mergeCommit":{"message":"[Cloud
Security] Hide temporarily unsupported option from azure manual options
(elastic#173988)","sha":"0d86b40e2dd0b4f70dd344c8078125c515165dd9"}}]}]
BACKPORT-->

Co-authored-by: Jordan <51442161+JordanSh@users.noreply.github.com>
  • Loading branch information
kibanamachine and JordanSh authored Dec 28, 2023
1 parent c2fda47 commit 1ac2f8f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@ export const getAzureCredentialsFormManualOptions = (): Array<{
value: AzureCredentialsType;
text: string;
}> => {
return (
Object.entries(getAzureCredentialsFormOptions())
.map(([key, value]) => ({
value: key as AzureCredentialsType,
text: value.label,
}))
// TODO: remove 'manual' for stack version 8.13
.filter(({ value }) => value !== 'arm_template' && value !== 'manual')
);
return Object.entries(getAzureCredentialsFormOptions())
.map(([key, value]) => ({
value: key as AzureCredentialsType,
text: value.label,
}))
.filter(
({ value }) =>
value !== 'arm_template' && // we remove this in order to hide it from the selectable options in the manual drop down
value !== 'manual' && // TODO: remove 'manual' for stack version 8.13
value !== 'service_principal_with_client_username_and_password' // this option is temporarily hidden
);
};

export const getInputVarsFields = (input: NewPackagePolicyInput, fields: AzureCredentialsFields) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,26 @@ describe('<CspPolicyTemplateForm />', () => {
});
});

it(`renders Service principal with Client Username and Password fields`, () => {
it(`should not render Service principal with Client Username and Password option`, () => {
let policy = getMockPolicyAzure();
policy = getPosturePolicy(policy, CLOUDBEAT_AZURE, {
'azure.credentials.type': { value: 'managed_identity' },
});

const { queryByRole } = render(
<WrappedComponent newPolicy={policy} packageInfo={getMockPackageInfoCspmAzure('1.7.0')} />
);

expect(
queryByRole('option', {
name: 'Service principal with Client Username and Password',
selected: false,
})
).not.toBeInTheDocument();
});

// TODO: remove when service_principal_with_client_username_and_password is removed from the code base
it.skip(`renders Service principal with Client Username and Password fields`, () => {
let policy = getMockPolicyAzure();
policy = getPosturePolicy(policy, CLOUDBEAT_AZURE, {
'azure.credentials.type': { value: 'service_principal_with_client_username_and_password' },
Expand All @@ -1541,7 +1560,8 @@ describe('<CspPolicyTemplateForm />', () => {
expect(getByLabelText('Client Password')).toBeInTheDocument();
});

it(`updates Service principal with Client Username and Password fields`, () => {
// TODO: remove when service_principal_with_client_username_and_password is removed from the code base
it.skip(`updates Service principal with Client Username and Password fields`, () => {
let policy = getMockPolicyAzure();
policy = getPosturePolicy(policy, CLOUDBEAT_AZURE, {
'azure.credentials.type': { value: 'service_principal_with_client_username_and_password' },
Expand Down

0 comments on commit 1ac2f8f

Please sign in to comment.