Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Don't send POLICY_CHANGE actions retrieved from index to agent. #1963
Don't send POLICY_CHANGE actions retrieved from index to agent. #1963
Changes from 1 commit
09fc555
d8712bf
100a4eb
19745de
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Question: When are these policy change actions an issue on check in?
Looking at the code, it seems that
TypePolicyChange
actions are only created on checkin code, in theprocessPolicy
method, so it doesn't seem to be always an issue on checkin.Here a filter is being added to
convertAction
, that is used when:Are these policy change actions an issue on both cases?
Are they generated in some other place too?
If this checkin handler is the only source of these actions, could there be some way to avoid generating them instead of having to filter them later?
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.
The fleet-server creates policy change actions dynamically when it detects a difference in the config an agent is running and what is defined. This occurs in the
processRequest
method:fleet-server/internal/pkg/api/handleCheckin.go
Lines 241 to 247 in a516f03
We want to consider this as the source of truth.
However the
processRequest
method also passes actions retrieved from the actions index (pendingActions
also retrieves from this index):fleet-server/internal/pkg/api/handleCheckin.go
Lines 236 to 240 in a516f03
It's possible for a user to insert a policy change action this way. These actions can make it difficult to determine what policy an agent should be running, it is also very easy to insert a malformed action by mistake and cause the agent to get stuck.
Filtering policy change actions received from the index out prevents these issues.
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.
Thanks for the explanations!
How can actions be added to the actions index? Or how can users insert policy changes?