-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Telemetry] Settings Collector: redact sensitive reported values #88675
[Telemetry] Settings Collector: redact sensitive reported values #88675
Conversation
Pinging @elastic/kibana-telemetry (Team:KibanaTelemetry) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the type fixes ❤️
I think this list is a great starting point to unblock the works in the banners. However, I think we discussed an alternative approach during our grooming sessions. Are you planning on a follow-up PR to implement it?
...ugins/kibana_usage_collection/server/collectors/management/telemetry_management_collector.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love the new implementation! Thank you!
Although, I have some concerns about how the tests were implemented (needing to change an existing public API only for test purposes). Can we talk about other options before approving this PR?
x-pack/test/api_integration/apis/telemetry/management_collection.ts
Outdated
Show resolved
Hide resolved
x-pack/test/api_integration/apis/telemetry/management_collection.ts
Outdated
Show resolved
Hide resolved
path: '/api/kibana/settings', | ||
validate: { | ||
query: schema.object({ | ||
_allRegistered: schema.maybe(schema.boolean()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are exposing this only for test purposes. What do you think about following a similar approach to the Application Usage's functional tests?
- A test plugin uses core's public APIs, and calls the existing method
uiSettingsClient.getAll()
and saves it in thewindow
object. - Then the mocha tests retrieve that property and validate their content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree exposing an API just for testing might not be ideal. I'm curious if anyone else from the team ( @elastic/kibana-core ) has different ideas.
Using the browser might be ok, even an api in the test plugin that exposes those settings might be even better too. Since api_integration
tests dont open the browser and using an API is more reliable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for Kibana app changes, didn't run the code. Makes timelion quandl key sensitive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you for this humongous effort!
Just added a couple of Super-NITs 😇
src/plugins/kibana_usage_collection/server/collectors/management/README.md
Outdated
Show resolved
Hide resolved
src/plugins/kibana_usage_collection/server/collectors/management/schema.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that we need one additional setting to be marked as sensitive in SecSol.
@Bamieh in discussing this with the team a potential feature enhancement was mentioned that I wanted to relay here: the ability to only redact sensitive values if they are not the default values. This could maybe be inferred from other UI settings telemetry (e.g. "setting changed"), but in the case of multiple change events that would be ambiguous, so this would mainly answer the question "What proportion of users have modified values?" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Only comment I'd like to see addressed before merging is #88675 (comment)
if (symbolName === 'Array') { | ||
if (node.typeArguments?.length !== 1) { | ||
throw Error('Array type only supports 1 type parameter Array<T>'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UltraNIT: better safe than sorry I guess, but I still wonder if this assertion is really useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not needed but to stay consistent with other symbols we check for.
const definition = this.defaults[key]; | ||
return !!definition?.sensitive; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT (and personal opinion): Now that we have the ??
operator, I think definition?.sensitive ?? false
would be slightly more explicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might change my opinion about this in the future but the I think using ??
with false
is redundan. I find !!
more explicit and succent
const uiSettingsClient = uiSettingsServiceMock.createClient(); | ||
const getUiSettingsClient = jest.fn(() => uiSettingsClient); | ||
uiSettingsClient.getUserProvided.mockResolvedValue(mockUserSettings); | ||
uiSettingsClient.isSensitive.mockImplementation(mockIsSensitive); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: these 4 lines are duplicated in all the tests of this describe
section. Could probably be extracted to beforeEach
or a function.
x-pack/test/usage_collection/test_suites/stack_management_usage/index.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SecSol changes LGTM. Thank you for adding that additional field!
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
…y-tests * 'master' of github.com:elastic/kibana: (276 commits) [Telemetry] Settings Collector: redact sensitive reported values (elastic#88675) [CI] Combines Jest test jobs (elastic#85850) [Upgrade Assistant] Migrate server to new es-js client (elastic#89207) Migrate maps_legacy, maps_oss, region_map, and tile_map plugions to TS projects (elastic#89351) [Vega Docs] Add experimental flag on the vega maps title (elastic#89402) Increase the time needed to locate the save viz toast (elastic#89301) [Enterprise Search] Add links to doc links service (elastic#89260) Fixed regex bug in Safari (elastic#89399) [Lens] Fix indexpattern checks for missing references (elastic#88840) [Lens] Clean up usage collector (elastic#89109) update apm index pattern (elastic#89395) [APM] Upgrade ES client (elastic#86594) Enable v2 so migrations, disable in FTR tests (elastic#89297) [Search Sessions] Make search session indicator UI opt-in, refactor per-app capabilities (elastic#88699) Cleanup OSS code from visualizations wizard (elastic#89092) [APM] Optimize API test order (elastic#88654) Rename conversion function, extract to module scope and add tests. (elastic#89018) [core.logging] Add ops logs to the KP logging system (elastic#88070) chore(NA): improve ts build refs performance on kbn bootstrap (elastic#89333) skip flaky suite (elastic#89379) ... # Conflicts: # x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/timeline/timeline.tsx # x-pack/test/accessibility/config.ts
…ana into task-manager/shift-on-trend * 'task-manager/shift-on-trend' of github.com:gmmorris/kibana: (74 commits) [Metrics UI] Fix Host Overview boxes in Host Detail page (elastic#89299) [Telemetry] Settings Collector: redact sensitive reported values (elastic#88675) [CI] Combines Jest test jobs (elastic#85850) [Upgrade Assistant] Migrate server to new es-js client (elastic#89207) Migrate maps_legacy, maps_oss, region_map, and tile_map plugions to TS projects (elastic#89351) [Vega Docs] Add experimental flag on the vega maps title (elastic#89402) Increase the time needed to locate the save viz toast (elastic#89301) [Enterprise Search] Add links to doc links service (elastic#89260) Fixed regex bug in Safari (elastic#89399) [Lens] Fix indexpattern checks for missing references (elastic#88840) [Lens] Clean up usage collector (elastic#89109) update apm index pattern (elastic#89395) [APM] Upgrade ES client (elastic#86594) Enable v2 so migrations, disable in FTR tests (elastic#89297) [Search Sessions] Make search session indicator UI opt-in, refactor per-app capabilities (elastic#88699) Cleanup OSS code from visualizations wizard (elastic#89092) [APM] Optimize API test order (elastic#88654) Rename conversion function, extract to module scope and add tests. (elastic#89018) [core.logging] Add ops logs to the KP logging system (elastic#88070) chore(NA): improve ts build refs performance on kbn bootstrap (elastic#89333) ...
Pinging @elastic/kibana-core (Team:Core) |
The Usage Collector
stack_management
reports user changed settings.This PR adds a new config to registered UI settings
sensitive: boolean
. The value of any UI setting marked assensitive
will be reported as a keyword[REDACTED]
instead of the actual value. This hides the actual sensitive information while giving us some intelligence over which fields the users are interactive with the most.Changes
Core Features:
A new
sensitive: true
config to the methodcore.uiSettings.register
.Add
isSensitive
method touiSettings
plugin contract.Values of UI Settings marked as sensitive will be reported reported as
[REDACTED]
Schema updates:
UI Settings collector schema is not up to date with all the ui settings we have and it is evergreen!
Updated schema Typescript type
MakeSchemaFrom
to fail when the Usage TS type does not match the schematype
property.Changing
long
tokeyword
for example will fail the type check(in IDE as well) and not just the
telemetry_check.ts
.Telemetry checker for UsageStats types now support the syntax
Array<T>
instead of only supportingT[]
.Tests:
keyword
s. This will help us make sure we dont accidentally report sensitive fields to telemetry since this will trigger a code review from the telemetry team.Current Sensitive UI Settings:
Got pinged for a codereview?
It is most likely a change adding
sensitive: true
to one of the registered ui settings your team owns. Please filter by codeowners and check for the changes.Closes #85811