_get_blocked_template() missing 1 required positional argument

Open
#688 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
security

Research direction

Start at datadog_lambda/asm.py:226 and inspect the call to http_utils._get_blocked_template alongside the reported ddtrace version range. Reproduce the missing-argument failure with ASM enabled, then verify the blocked-response path no longer raises the TypeError for affected container deployments.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Python
Stars
102
Forks
52
Avg merge
5d 19h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DataDog/datadog-lambda-python

All issues in DataDog/datadog-lambda-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.