Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ export class IndexPrivilegeForm extends Component<Props, State> {
{ defaultMessage: 'Add a field pattern…' }
)}
fullWidth
isCaseSensitive
/>
</EuiFormRow>
</EuiFlexItem>
Expand Down Expand Up @@ -368,6 +369,7 @@ export class IndexPrivilegeForm extends Component<Props, State> {
{ defaultMessage: 'Add a field pattern…' }
)}
fullWidth
isCaseSensitive
/>
</EuiFormRow>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,62 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(rowData).not.to.contain('ssn');
});

it('should support case-sensitive fields', async function () {
await PageObjects.security.forceLogout();
await PageObjects.security.login();
await PageObjects.settings.navigateTo();
await PageObjects.security.clickElasticsearchRoles();
await PageObjects.security.addRole('a_casesenstive_fields_role', {
elasticsearch: {
indices: [
{
names: ['flstest'],
privileges: ['read', 'view_index_metadata'],
field_security: {
grant: ['customer_*', 'Customer_*'],
except: ['customer_region', 'Customer_region'],
},
},
],
},
});

await PageObjects.common.sleep(1000);
Copy link
Contributor

Choose a reason for hiding this comment

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

just curious why this sleep is necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

++ I am not sure that it is. The other tests in this suite also contain this, so I did the same. We could investigate whether this is necessary or overkill though - I wonder if a much shorter pause (or no pause) would be sufficient.


const roleDef = await security.role.get('a_casesenstive_fields_role');
expect(roleDef).to.eql({
_transform_error: [],
_unrecognized_applications: [],
elasticsearch: {
cluster: [],
indices: [
{
allow_restricted_indices: false,
field_security: {
except: ['customer_region', 'Customer_region'],
grant: ['customer_*', 'Customer_*'],
},
names: ['flstest'],
privileges: ['read', 'view_index_metadata'],
},
],
run_as: [],
},
kibana: [
{
base: ['all'],
feature: {},
spaces: ['*'],
},
],
metadata: {},
name: 'a_casesenstive_fields_role',
transient_metadata: {
enabled: true,
},
});
});

after(async function () {
// NOTE: Logout needs to happen before anything else to avoid flaky behavior
await PageObjects.security.forceLogout();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,12 @@ export class SecurityPageObject extends FtrService {
}
};

const addDeniedField = async (fields: string[]) => {
for (const entry of fields) {
await this.comboBox.setCustom('deniedFieldInput0', entry);
}
};

// clicking the Granted fields and removing the asterix
if (roleObj.elasticsearch.indices[0].field_security) {
// Toggle FLS switch
Expand All @@ -730,6 +736,9 @@ export class SecurityPageObject extends FtrService {
);

await addGrantedField(roleObj.elasticsearch.indices[0].field_security!.grant!);
if (roleObj.elasticsearch.indices[0].field_security?.except) {
await addDeniedField(roleObj.elasticsearch.indices[0].field_security.except);
}
}

if (roleObj.elasticsearch.remote_cluster) {
Expand Down