Skip to content

fix: remove DSG_APP_ID from notification action#1114

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
mhduiy:fixEnv
May 7, 2025
Merged

fix: remove DSG_APP_ID from notification action#1114
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
mhduiy:fixEnv

Conversation

@mhduiy
Copy link
Copy Markdown
Contributor

@mhduiy mhduiy commented May 7, 2025

When starting a child process, do not inherit the DSG_APP-ID environment variable to prevent direct modification of dde shell configuration by the child process

pms: BUG-315007

Summary by Sourcery

Bug Fixes:

  • Prevent direct modification of DDE shell configuration by child processes by removing DSG_APP_ID environment variable

When starting a child process, do not inherit the DSG_APP-ID environment variable to prevent direct modification of dde shell configuration by the child process

pms: BUG-315007
@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

关键摘要:

  • 在修改后的代码中,QProcess 对象 pro 被创建但未使用 move 语义,可能会导致不必要的资源复制。
  • proEnv.remove("DSG_APP_ID"); 可能会影响到其他依赖于 DSG_APP_ID 的进程,需要确认这一改动是否符合预期。
  • QProcessEnvironment 的修改应该在 pro.setArguments(args); 之前进行,以确保环境变量设置正确。

是否建议立即修改:

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 7, 2025

Reviewer's Guide

The pull request modifies the invocation of notification actions to prevent child processes from inheriting the DSG_APP_ID environment variable. This is achieved by explicitly creating a QProcess, obtaining the system environment, removing the DSG_APP_ID variable, and then setting this modified environment for the process before starting it.

Sequence Diagram: Modified Process Invocation in NotificationManager

sequenceDiagram
    participant NM as NotificationManager
    participant QPE as QProcessEnvironment
    participant QP as QProcess

    NM->>QP: Create QProcess instance (pro)
    NM->>QP: pro.setProgram(cmd)
    NM->>QP: pro.setArguments(args)
    NM->>QPE: QProcessEnvironment::systemEnvironment()
    QPE-->>NM: returns systemEnv
    NM->>NM: proEnv = systemEnv
    NM->>NM: proEnv.remove("DSG_APP_ID")
    NM->>QP: pro.setProcessEnvironment(proEnv)
    NM->>QP: pro.startDetached()
Loading

Class Diagram: Update to NotificationManager::doActionInvoked Method

classDiagram
    class NotificationManager {
        +doActionInvoked(const NotifyEntity &entity, const QString &actionId) void
    }
    note for NotificationManager.doActionInvoked "Method updated to explicitly remove DSG_APP_ID from the environment of child processes started via QProcess. This prevents unintended inheritance and potential modification of dde shell configuration by the child process."
Loading

File-Level Changes

Change Details Files
Prevented child process from inheriting DSG_APP_ID environment variable.
  • Replaced direct call to QProcess::startDetached with explicit QProcess setup.
  • Retrieved system environment variables for the new process.
  • Removed the DSG_APP_ID key from the process's environment variables.
  • Set the modified process environment before starting the detached process.
panels/notification/server/notificationmanager.cpp

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!

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

@mhduiy mhduiy requested a review from 18202781743 May 7, 2025 06:18
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey @mhduiy - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, mhduiy

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mhduiy
Copy link
Copy Markdown
Contributor Author

mhduiy commented May 7, 2025

/forcemerge

@deepin-bot
Copy link
Copy Markdown

deepin-bot Bot commented May 7, 2025

This pr force merged! (status: blocked)

@deepin-bot deepin-bot Bot merged commit 7c5f2a7 into linuxdeepin:master May 7, 2025
7 of 10 checks passed
@18202781743
Copy link
Copy Markdown
Contributor

/integrate

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2025

AutoIntegrationPr Bot
auto integrate with pr url: deepin-community/Repository-Integration#2824
PrNumber: 2824
PrBranch: auto-integration-14880979754

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants