_get_blocked_template() missing 1 required positional argument

未关闭
#688 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
30/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
python
领域
security

调研方向

从 datadog_lambda/asm.py:226 开始,结合报告的 ddtrace 版本范围检查对 http_utils._get_blocked_template 的调用。在启用 ASM 的情况下重现缺少参数导致的失败,然后验证对于受影响的容器部署,被阻止响应的路径不再引发 TypeError。

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

描述

Customers encountering the following error

def get_asm_blocked_response(
        event_source: _EventSource,
    ) -> Optional[Dict[str, Any]]:
        """Get the blocked response for the given event source."""
        if event_source.event_type not in _http_event_types:
            return None
        blocked = get_blocked()
        if not blocked:
            return None
        desired_type = blocked.get("type", "auto")
        if desired_type == "none":
            content_type = "text/plain; charset=utf-8"
            content = ""
        else:
            content_type = blocked.get("content-type", "application/json")
            content = http_utils._get_blocked_template(content_type)
E           TypeError: _get_blocked_template() missing 1 required positional argument: 'security_response_id'
datadog_lambda/asm.py:226: TypeError

or similar errors related to the _get_blocked_template function signature should check the version of ddtrace they are using. Customers encountering this error are likely using lambda with containers and/or have overridden the version of ddtrace packaged with the Datadog Python Lambda Layer. If you are using ddtrace v3.19.0 or above and have ASM enabled, please downgrade to a ddtrace version between v3.16.2 and v3.18.1.
Customers not using ddtrace v3.19.0 or above should not be affected by this issue.

主要语言
Python
星标
102
派生
52
平均合并
5 天 19 小时
30 天内合并 PR
2

贡献指南

打开贡献指南

从这里开始

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

DataDog/datadog-lambda-python 的其他 Issue

查看 DataDog/datadog-lambda-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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