Safeguard
Application Security•

CWE-1048 Functions With a Large Number of Outward Calls

A function that references many other objects is hard to review and easy to break. CWE-1048 explains fan-out, the CISQ guideline, and how to reduce it.

Safeguard Security Team
2 min read

Some functions do everything. They call a dozen other components, branch on all the results and quietly become the part of the code nobody wants to touch.

CWE-1048 describes callable control elements that contain an excessively large number of references to other application objects external to the callable. In plain terms, the fan out value is too high. MITRE lists it as a Base weakness in any language.

How it happens

Fan out grows when a function becomes a coordinator for a whole workflow, such as a request handler that validates, loads, authorizes, calculates, saves, notifies and logs in one body.

MITRE notes the meaning of excessively large varies, and that CISQ recommends a default of 5 referenced objects.

def handle_checkout(req):
    user = users.load(req)
    cart = carts.load(user)
    prices = pricing.compute(cart)
    tax = taxes.compute(cart, user)
    stock = inventory.reserve(cart)
    pay = payments.charge(user, prices, tax)
    mail.send_receipt(user, pay)
    audit.write(user, pay)

The consequences MITRE records are reduced maintainability and increased analytical complexity. The issue makes the product harder to maintain, which indirectly affects security by making vulnerabilities harder and slower to find and fix, and it might make vulnerabilities easier to introduce. No CVEs are observed.

For reviewers, it means more to hold in mind at once. A missing authorization step is easy to overlook in a long body.

How to find it

MITRE lists no detection methods. Code metrics tools report fan out per function. Sort by the highest values and review those first, especially the ones near security decisions.

How to fix it

MITRE lists no formal mitigations. Reasonable steps:

  1. Split large functions into steps with clear names.
  2. Group related calls behind a single focused component.
  3. Make security checks a distinct, early and obvious step.
  4. Set a team threshold and check it in review.

Quick check

What is fan out?

The number of other application objects a callable references from outside its own context.

Sources

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.