antgroup / antgroup/YASA-Engine

[OSS26] 查找方法下游调用 find_callees_by_method_name

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

Nobody has claimed this yet.

OSS26-Team
Dominant language
TypeScript
Stars
323
Forks
40
PR merge metrics
No merged PRs in 30d

Description

接口介绍

正向调用查询:给定一个方法的全限定名,返回该方法体内直接调用到的所有方法清单(被调方),并对接口/抽象类调用按需展开成实际可能的实现方法。

工具名

find_callees_by_method_name

背景与目标

查找调用点(callers)是反向问题,本工具是正向(我调了谁)。两者合起来才能完成调用图遍历。

应用场景:

  • 看 Controller 一个 endpoint 直接/间接到达了哪些 DAO,判断是否绕过了权限层
  • 看一个 @Transactional 方法内部是否调用了不该跨事务的远程方法
  • 一次审计任务从 sink 反推 source,需要 callees 配合
输入参数
参数 类型 必填 说明
method_full_name string 调用方法的全限定名
parameter_types string[] 形参类型重载消歧
repository_path string 仓库本地绝对路径
resolve_polymorphic bool 默认 true。true 时把"接口调用"展开成所有可能实现
include_jdk_calls bool 默认 false。是否把对 java.* 等标准库的调用也算上
max_depth int 默认 1。本工具默认只看一层(直接被调);深层调用链请用上游链路工具
输出结构
{
  "source_method": "com.example.service.UserService.getUserOrThrow",
  "total_callees": 4,
  "callees": [
    {
      "callee_method_full_name": "com.example.dao.UserDao.findById",
      "callee_signature": "findById(java.lang.Long): com.example.User",
      "call_site_line": 47,
      "call_site_snippet": "userDao.findById(id)",
      "is_polymorphic_resolved": false,
      "resolved_implementations": null,
      "is_jdk_call": false
    },
    {
      "callee_method_full_name": "com.example.RequestValidator.validate",
      "is_polymorphic_resolved": true,
      "resolved_implementations": [
        "com.example.impl.JsonRequestValidator.validate",
        "com.example.impl.XmlRequestValidator.validate"
      ]
    }
  ]
}
验收标准
  • 正确处理:实例调用、静态调用、构造器调用、方法引用、链式调用
  • resolve_polymorphic=true 时通过继承索引把接口/抽象类调用展开成所有实现
  • 跳过 lambda 内未被调用的方法引用(只在被实际触发的代码路径上算 callee)
  • 默认排除 JDK 标准库,可由 include_jdk_calls 打开
  • 单元测试覆盖:多态解析、链式、lambda、构造器、未解析的反射调用
  • 中等仓库响应 < 10s
预估工作量

7-10 人日

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.

Research direction

Start by locating the existing upstream caller-query tool and the repository's UAST, inheritance-index, and test entry points. Implement the new find_callees_by_method_name interface around the listed invocation kinds and options, then add coverage for polymorphism, chaining, lambdas, constructors, and unresolved reflection calls. Done means the documented output and defaults work within the stated response target.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript
Domain
devtools, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.