Skip to content

Commit

Permalink
[Reporting] Serverless reporting_user config false by default (#162835)
Browse files Browse the repository at this point in the history
## Summary

This setting is deprecated and used when security features were less
developed. Moving forward in serverless, it would be beneficial to have
the `xpack.reporting.roles.allow: []` by default since backwards
compatibility shouldn't be as pressing.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Tim Sullivan <tsullivan@users.noreply.github.com>
  • Loading branch information
3 people committed Aug 7, 2023
1 parent f9a5bab commit 266f4d5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
10 changes: 10 additions & 0 deletions x-pack/plugins/reporting/server/config/schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,14 @@ describe('Reporting Config Schema', () => {
ConfigSchema.validate({ export_types: { csv: { enabled: true } } }, { dev: true })
).not.toThrow();
});

describe('roles', () => {
it('should have roles enabled set to false for serverless by default', () => {
expect(ConfigSchema.validate({}, { serverless: true }).roles.enabled).toBe(false);
});

it('should have roles enabled set to true for non-serverless by default', () => {
expect(ConfigSchema.validate({}).roles.enabled).toBe(true);
});
});
});
14 changes: 12 additions & 2 deletions x-pack/plugins/reporting/server/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,18 @@ const EncryptionKeySchema = schema.conditional(
);

const RolesSchema = schema.object({
enabled: schema.boolean({ defaultValue: true }), // true: use ES API for access control (deprecated in 7.x). false: use Kibana API for application features (8.0)
allow: schema.arrayOf(schema.string(), { defaultValue: ['reporting_user'] }),
enabled: schema.conditional(
schema.contextRef('serverless'),
true,
schema.boolean({ defaultValue: false }),
schema.boolean({ defaultValue: true })
), // true: use ES API for access control (deprecated in 7.x). false: use Kibana API for application features (8.0)
allow: schema.conditional(
schema.contextRef('serverless'),
true,
schema.arrayOf(schema.string(), { defaultValue: [] }),
schema.arrayOf(schema.string(), { defaultValue: ['reporting_user'] })
),
});

// Browser side polling: job completion notifier, management table auto-refresh
Expand Down

0 comments on commit 266f4d5

Please sign in to comment.