Skip to content

gate-57 (orphaned-write-capability): the #[McpTool] attribute-scanner seam is unrecognised — it names LIVE code dead #200

Closed

Description

@rubenvdlinde

Measurement

Ran check_orphaned_write_capability.py (.github origin/main) full-tree over lib/Service/** in 8 repos on their origin/development tips, then traced every finding to a route / listener / background job / register.d handler / other caller.

repo files scanned findings
openconnector 166 1
pipelinq 242 5
shillinq 316 20
scholiq 62 0
nldesign 37 0
softwarecatalog 55 1
launchpad 89 2
portaliq 21 0
total 988 29

Traced verdicts across all 29:

  • 19 genuinely dead — no route, listener, job, handler or caller. Real capability gaps.
  • 9 zero-caller but redundant — the capability is live via a different method/class; the finding is literally true, the remedy is deletion not wiring.
  • 1 false positive — live code reported dead.

So the gate is accurate on 28/29. This issue is about the one, because the docstring is right that this direction is the dangerous one:

Worse than noise: a gate that names LIVE code dead gets someone to delete it.

The false positive

pipelinq — lib/Service/LeadService.php:125 method=createLead rule=orphaned-write-capability

createLead has no syntactic ->createLead( call site. It is reached by attribute reflection:

  1. lib/Service/LeadService.php:117 carries
    #[McpTool(name: 'createLead', description: '…', readOnlyHint: false, scope: 'create')]
  2. lib/Mcp/PipelinqScannableServices.php:61 lists LeadService::class.
  3. lib/AppInfo/Application.php:246 binds it:
    $context->registerServiceAlias(
        'OCA\\OpenRegister\\Mcp\\IMcpScannableServices::pipelinq',
        PipelinqScannableServices::class
    );
  4. OpenRegister's AttributeToolScanner reflects the class and invokes the method.

This is a first-class, documented seam (plq-mcp-provider-surgery, openspec/specs/crm-mcp-tool-surface/spec.md), not a clever trick. Acting on the verdict would delete a curated MCP write tool — the same shape as hydra#106 (ObjectService::clearCurrents()), which the docstring already records.

Same repo, pipelinq, also exposes logContactmoment and pipelineForecast through the identical seam; they escaped only because their names do not match WRITE_VERB_PREFIXES. So the blind spot is wider than this one finding.

Suggested recognition rule

Treat a method as reachable when all of:

  • the method carries an #[McpTool(...)] attribute (or any attribute in a configured "invoked-by-reflection" list), and
  • its declaring class appears in a class returned by an IMcpScannableServices implementation, and
  • that implementation is bound via registerServiceAlias('OCA\OpenRegister\Mcp\IMcpScannableServices::<app>', …) in lib/AppInfo/Application.php.

That is the same three-part evidence the existing register.d-handler and event-listener seams already require, so it does not weaken the gate: a bare #[McpTool] on a class nobody registers stays red.

Second, smaller point — the 9 "redundant" findings

A zero-caller write capability has two remedies, and the gate's framing only suggests one. Measured example, softwarecatalog:

FederationService::publishEntryForFederation() had zero callers. Reading that as "catalog entries cannot be published" is wrong — PublicationService::publish() is live via PublicationController::publish() (route publication#publish). The orphan was a second, weaker seam: no per-object IDOR guard, and its signature dropped the optional $when moment. Wiring a route to it would have duplicated a live capability and widened the auth surface. Correct fix: delete it (ConductionNL/stackiq#447).

Worth a sentence in SKILL.md telling the reader to establish whether the capability is live elsewhere before wiring — otherwise a finding of this shape reliably produces a duplicate endpoint.

Not requested

No waiver, no @orphaned-write-capability exclude, no threshold change anywhere. The 19 genuine findings are being worked or reported on their own merits.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions