Skip to content

Conversation

@mhduiy
Copy link
Contributor

@mhduiy mhduiy commented Jul 2, 2025

  1. Removed hardcoded security compilation flags from CMakeLists.txt
  2. Added standardized Debian hardening flags in debian/rules
  3. Flags now follow Debian packaging best practices
  4. Includes additional security measures like RELRO and immediate binding
  5. Maintains same security level while being more maintainable

refactor: 将安全编译参数移至 debian/rules

  1. 从 CMakeLists.txt 中移除硬编码的安全编译参数
  2. 在 debian/rules 中添加标准化的 Debian 加固标志
  3. 标志现在遵循 Debian 打包最佳实践
  4. 包含额外的安全措施如 RELRO 和立即绑定
  5. 在保持相同安全级别的同时提高可维护性

Summary by Sourcery

Centralize compilation hardening flags in the Debian packaging rules and remove them from CMakeLists to follow Debian best practices and improve maintainability.

Enhancements:

  • Include additional security hardening measures such as RELRO and immediate symbol binding.
  • Maintain the same security level while shifting flag management to packaging scripts.

Build:

  • Remove hardcoded security flags from CMakeLists.txt.
  • Add standardized Debian hardening flags in debian/rules.

1. Removed hardcoded security compilation flags from CMakeLists.txt
2. Added standardized Debian hardening flags in debian/rules
3. Flags now follow Debian packaging best practices
4. Includes additional security measures like RELRO and immediate
binding
5. Maintains same security level while being more maintainable

refactor: 将安全编译参数移至 debian/rules

1. 从 CMakeLists.txt 中移除硬编码的安全编译参数
2. 在 debian/rules 中添加标准化的 Debian 加固标志
3. 标志现在遵循 Debian 打包最佳实践
4. 包含额外的安全措施如 RELRO 和立即绑定
5. 在保持相同安全级别的同时提高可维护性
@sourcery-ai
Copy link

sourcery-ai bot commented Jul 2, 2025

Reviewer's Guide

This commit refactors the build system by removing embedded security flags from CMakeLists.txt and centralizing them in debian/rules, applying standardized Debian hardening flags (including RELRO and immediate binding) to preserve the existing security posture while improving maintainability and aligning with Debian packaging best practices.

File-Level Changes

Change Details Files
Relocated security compilation flags to Debian packaging
  • Removed hardcoded security flags (stack-protector, fortify‐source, noexecstack, PIE) from CMakeLists.txt
  • Configured DEB_*_FLAGS and dh_strip in debian/rules to inject those flags at package time
CMakeLists.txt
debian/rules
Standardized and enhanced hardening flags following Debian best practices
  • Added -z relro and -z now for full RELRO and immediate binding
  • Ensured stack-protector-strong, -D_FORTIFY_SOURCE, PIE and PIC are set via debian/rules
debian/rules

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

Copy link

@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!


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

deepin pr auto review

代码审查意见如下:

CMakeLists.txt 文件

修改建议

  • 移除已注释掉的代码:第17行到第21行的代码被注释掉了,如果这些代码不再需要,建议完全移除它们,以保持代码的整洁。

代码质量

  • 代码注释:虽然注释是好的,但应该确保它们是准确的,并且与代码保持同步。如果这些安全编译参数不再需要,应该更新注释以反映这一点。

debian/rules 文件

修改建议

  • 环境变量设置:第11行到第14行的环境变量设置看起来是针对维护者编译选项的,如果这些选项是针对所有用户,建议将它们移到更合适的位置,比如在debian/control文件中。
  • 编译选项:第12行到第14行的编译选项看起来是为了提高代码的安全性和性能,这是一个好的做法。但是,应该确保这些选项不会与项目中的其他编译选项冲突。

代码质量

  • 环境变量命名:环境变量DEB_BUILD_MAINT_OPTIONSDEB_CFLAGS_MAINT_APPENDDEB_CXXFLAGS_MAINT_APPENDDEB_LDFLAGS_MAINT_APPEND的命名应该更具描述性,以便其他开发者更容易理解它们的作用。

代码性能

  • 编译选项:第12行到第14行的编译选项有助于提高代码的性能和安全性,但是应该确保这些选项不会对项目的构建时间产生负面影响。

代码安全

  • 编译选项:第12行到第14行的编译选项有助于提高代码的安全性,但是应该确保这些选项不会对项目的功能产生负面影响。

总的来说,这些修改和改进有助于提高代码的质量、性能和安全性。

@deepin-ci-robot
Copy link

[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 mhduiy merged commit 8b83508 into linuxdeepin:master Jul 3, 2025
17 checks passed
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