Skip to content
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

[pull] master from netdata:master #374

Merged
merged 2 commits into from
Feb 19, 2025
Merged

Conversation

pull[bot]
Copy link

@pull pull bot commented Feb 19, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

Summary by Sourcery

This pull request introduces user action logging for the DYNCFG system, enhancing security and providing an audit trail for configuration changes. It also includes improvements to request source parsing and generation, and removes redundant information from the go.d plugin tests.

New Features:

  • Adds logging of user actions performed through the DYNCFG (dynamic configuration) system, including the command, target, user, and source IP address.

Enhancements:

  • Improves security by logging user actions related to dynamic configuration changes, providing an audit trail for security and debugging purposes.
  • Adds a new parse_request_source function to parse the request source string and extract information such as the client IP address, user name, and cloud account ID.
  • Adds a new web_client_api_request_vX_source_to_buffer function to generate the request source string based on the web client's authentication status and user role.

Chores:

  • Adds a new UUID for Netdata dynamic configuration messages.
  • Removes redundant module and job information from the source string in the go.d plugin tests.

ilyam8 and others added 2 commits February 19, 2025 10:39
* log all DYNCFG user actions that alter data

* do not show sensitive user info when the user is not logged in

* log template actions

* add DYNFG message id to annotations

---------

Co-authored-by: Ilya Mashchenko <[email protected]>
@pull pull bot added the ⤵️ pull label Feb 19, 2025
@pull pull bot merged commit fb561f8 into webfutureiorepo:master Feb 19, 2025
Copy link

sourcery-ai bot commented Feb 19, 2025

Reviewer's Guide by Sourcery

This pull request introduces logging of user actions performed through the DYNCFG, enhances security by redacting sensitive user information when accessed anonymously, and refactors code for better organization and maintainability. It also updates tests to reflect changes in the source string format.

Sequence diagram for DYNCFG user action logging

sequenceDiagram
    participant User
    participant WebAPI
    participant DYNCFG
    participant Logger

    User->>WebAPI: Sends request to update DYNCFG
    WebAPI->>DYNCFG: Calls dyncfg_function_intercept_cb
    activate DYNCFG
    DYNCFG->>DYNCFG: Processes request
    DYNCFG->>DYNCFG: Checks user access and permissions
    DYNCFG->>Logger: Logs user action with details (dyncfg_log_user_action)
    activate Logger
    Logger-->>DYNCFG: Returns
    deactivate Logger
    DYNCFG-->>WebAPI: Returns result
    deactivate DYNCFG
    WebAPI-->>User: Sends response
Loading

File-Level Changes

Change Details Files
Introduces logging of user actions performed through the DYNCFG.
  • Adds a dyncfg_log_user_action function to log user actions, including the command, target, and source of the request.
  • Adds dyncfg_user_action_msgid UUID for logging user actions.
  • Adds parse_request_source function to parse the request source string and extract information such as the client IP, user, and account ID.
  • Logs user actions in dyncfg_function_intercept_result_cb and dyncfg_function_intercept_cb after applying the configuration changes.
  • Includes user details (user name, IP address) in the log messages when available.
  • Adds request_source.c and request_source.h files to handle parsing of request sources.
  • Defines PARSED_REQUEST_SOURCE struct to store parsed request source information.
  • Adds ENUM_STR_MAP_DEFINE and ENUM_STR_DEFINE_FUNCTIONS macros for DYNCFG_CMDS enum to convert between enum values and strings.
src/daemon/dyncfg/dyncfg-intercept.c
src/libnetdata/uuid/uuid.h
src/web/api/request_source.c
src/web/api/request_source.h
Improves security by redacting sensitive user information from the source field in DYNCFG data when accessed anonymously.
  • Modifies dyncfg_to_json to redact the source field when accessed anonymously.
  • Modifies dyncfg_tree_for_host to pass an anonymous flag to dyncfg_to_json indicating whether the access is anonymous.
  • Modifies dyncfg_config_execute_cb to determine if the user has sensitive data access and passes the appropriate anonymous flag to dyncfg_tree_for_host.
src/daemon/dyncfg/dyncfg-tree.c
Updates the http_access_from_source function to use http_access_from_hex_str for parsing permissions.
  • Replaces the direct strtoull call with http_access_from_hex_str in http_access_from_source.
src/libnetdata/http/http_access.c
Removes redundant request_source_is_cloud and web_client_api_request_vX_source_to_buffer functions from web_api.c and web_api.h.
  • Removes the functions from web_api.c and web_api.h as they are now in request_source.c and request_source.h.
src/web/api/web_api.c
src/web/api/web_api.h
Removes module and job information from the source string in go.d plugin tests.
  • Removes module and job parameters from the SetSource calls in prepareDyncfgCfg function.
  • Removes module and job parameters from the expected CONFIG output in the test cases.
src/go/plugin/go.d/agent/jobmgr/manager_test.go
Adds a new message ID for dynamic configuration in systemd-journal-annotations.c.
  • Adds dyncfg_user_action_msgid to the dictionary of message IDs.
src/collectors/systemd-journal.plugin/systemd-journal-annotations.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants