Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

v3: "General failure, action: 0x..." prints a pointer instead of the action name

未关闭 适合新手
#3,708 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
cpp
领域
backend, security

调研方向

从 src/rules_exceptions.cc 和 src/rule_with_actions.cc 中提到的三个输出位置入手,然后运行 test/regression_tests 中的复现用例。Issue 指出了指针格式化方式和预期的操作名称;更新受影响的消息,并验证它们输出的是 chain 这样的名称,而不是地址。

由索引模型根据 Issue 内容生成。

描述

3.x bug

Describe the bug

When SecRuleUpdateActionById is given an action that can't be updated (a configuration-time action such as chain, id, phase, rev, ver, maturity or accuracy), libModSecurity v3 prints a memory address instead of the action's name:

General failure, action: 0x932c545b8 has not expected to be used with UpdateActionByID.

This was reported before in #2625 and closed as completed in 2021, but the code that prints it hasn't changed.

To Reproduce

SecRule REQUEST_HEADERS:User-Agent "@rx ^curl" "id:10,phase:2,pass,log,chain"
    SecRule REQUEST_HEADERS:Accept "@rx \*/\*" "t:none"
SecRuleUpdateActionById 10 "pass,chain"

Seen with test/regression_tests on v3/master (84b59962).

Expected behavior

The message should name the action, e.g. General failure, action: chain has not expected to be used with UpdateActionByID.

Cause

Action::m_name is a std::shared_ptr<std::string>, so std::cout << a->m_name prints the pointer. Writing *a->m_name instead fixes it. The same mistake appears three times:

  • src/rules_exceptions.cc:40 (the "has not expected to be used with UpdateActionByID" message)
  • src/rules_exceptions.cc:51 ("has an unknown type")
  • src/rule_with_actions.cc:127 ("has an unknown type")

Related

All three messages are written straight to std::cout rather than returned through the existing error out-parameter. A connector therefore never sees them in its error log, and the configuration still loads with the action silently dropped. Fixing the pointer is the minimal change. Reporting the problem through error, as a warning or as a load failure, needs a decision, because it would change behavior for configurations shared with v2 that repeat chain in an update. v2 requires repeating chain there; see the "Updating chained rules" note in owasp-modsecurity/documentation#2.

主要语言
C++
星标
9.8k
派生
1.8k
平均合并
1 天 2 小时
30 天内合并 PR
17

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

owasp-modsecurity/ModSecurity 的其他 Issue

查看 owasp-modsecurity/ModSecurity 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。