Skip to content

M1: Pass context.settings to ToolRegistry and ActionGateway in handle_pipeline_run #84

Backlog

Description

@h45sh

Context

handle_pipeline_run in src/ether/cli/commands/pipeline.py:22,31 constructs ToolRegistry(context.tools_dir) and ActionGateway(registry=registry, store=store, policy=policy) without passing settings=context.settings.

Unlike CliContext.get_registry() (src/ether/cli/context.py:98), handle_pipeline_run drops all config.toml [registry] settings (trust_mode, trusted_public_keys) and [gateway] scope flags (allow_loopback, allow_metadata, allow_link_local) when ActionGateway.__init__ (src/ether/gateway/gate.py:146-152) falls back to settings=None.

Proof

Invoked handle_pipeline_run with a config.toml setting [registry] trust_mode = "dev" and [gateway] allow_loopback = true against origin/dev@db5fc07:

env -u ETHER_PLUGIN_TRUST_MODE PYTHONPATH=/tmp/ether-audit-A/src /home/harsh/Documents/ether/.venv/bin/python3 -c "
import asyncio, tempfile, types
from pathlib import Path
from unittest.mock import AsyncMock, patch
from ether.cli.context import CliContext
from ether.cli.commands.pipeline import handle_pipeline_run

async def main():
    with tempfile.TemporaryDirectory() as td:
        p = Path(td)
        cfg = p / 'config.toml'
        cfg.write_text('[registry]\ntrust_mode = \"dev\"\n[gateway]\nallow_loopback = true\n')
        args = types.SimpleNamespace(
            data_dir=str(p / 'data'), db=str(p / 'db.sqlite'), tools=None,
            config=str(cfg), policy='safe', verbose=False, json=True,
            expression='nmap(target=10.0.0.1)', session=None, session_id=None,
        )
        ctx = CliContext.from_args(args)
        captured = {}
        from ether.services.execution import SupervisedExecutionService
        orig_init = SupervisedExecutionService.__init__
        def spy_init(self, gateway, store):
            captured['gw_settings'] = gateway.settings
            captured['gw_allow_loopback'] = gateway.scope.allow_loopback
            orig_init(self, gateway, store)
        with patch.object(SupervisedExecutionService, '__init__', spy_init), \
             patch.object(SupervisedExecutionService, 'execute_pipeline', new=AsyncMock(return_value={'is_error': False, 'total_findings': 0, 'findings': []})):
            await handle_pipeline_run(args, ctx)
        print(captured)
asyncio.run(main())
"
# {'gw_settings': None, 'gw_allow_loopback': False}

Impact

Affects ether pipeline users who configure [registry] or [gateway] options in config.toml. Under GatePolicy.SAFE, ActionGateway ignores configured trusted_public_keys and gateway scope flags from config.toml.

Acceptance criteria

  • Use context.get_registry() (or pass settings=context.settings to ToolRegistry) in src/ether/cli/commands/pipeline.py:22
  • Pass settings=context.settings to ActionGateway in src/ether/cli/commands/pipeline.py:31
  • Add a unit test verifying handle_pipeline_run forwards context.settings to both ToolRegistry and ActionGateway

Out of scope

Routing pipeline stages through ActionGateway.validate_action (tracked in #72).

Part of #24

Related to #72


audit:self · run 2026-12-03 · ref origin/dev@db5fc07 · cell interface×supply

Activity

  1. added this to the M1 Truth milestone on Dec 1, 2026
  2. added
    type:bug
    area:hygiene
    priority:P2
    on Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:hygienepriority:P2type:bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions