Skip to content

Harden validator exposure and restrict llm endpoint access - #12

Open
RaoAsim wants to merge 1 commit into
0xsigurd:mainfrom
RaoAsim:feature/validator-hardness
Open

RaoAsim wants to merge 1 commit into
0xsigurd:mainfrom
RaoAsim:feature/validator-hardness

Conversation

@RaoAsim

@RaoAsim RaoAsim commented May 18, 2026

Copy link
Copy Markdown

Summary

This PR reduces unnecessary validator-side attack surface and adds code-level access controls for the local llm_endpoint.

What changed

  • Added PERTURB_ENABLE_VALIDATOR_AXON to make the validator axon optional.
  • When validator axon is enabled, it now rejects inbound subnet requests by default instead of exposing an unguarded listener.
  • Added IP-based allowlisting to tools/llm_endpoint_service.py.
  • llm_endpoint now allows loopback by default and can be expanded explicitly with:
    • LLM_ENDPOINT_ALLOWED_CIDRS
    • LLM_ENDPOINT_ALLOW_PRIVATE_NETWORKS
  • Updated env examples and README with the new settings and recommended defaults.

Why

In the current subnet flow, the validator actively queries miners, but there is no obvious subnet-specific need for the validator to accept arbitrary inbound protocol traffic. Keeping the validator axon open without an explicit deny policy increases exposure unnecessarily.

The llm_endpoint was also relying mostly on bind-host discipline for protection. This PR adds application-level client checks so it remains protected even if it is bound to a broader interface by mistake.

Defaults after this change

  • PERTURB_ENABLE_VALIDATOR_AXON=false is recommended in validator.env.example
  • LLM_ENDPOINT_ALLOWED_CIDRS=127.0.0.1/32,::1/128
  • LLM_ENDPOINT_ALLOW_PRIVATE_NETWORKS=false

Notes

  • This does not remove the validator axon entirely. Operators can still enable it if their deployment requires it.
  • If enabled, inbound validator axon requests are rejected by default.
  • llm_endpoint should still be kept on loopback or a trusted private subnet in deployment.

Files changed

  • neurons/validator.py
  • tools/llm_endpoint_service.py
  • scripts/validator.env.example
  • scripts/llm_endpoint.env.example
  • README.md

Testing

  • Verified Python syntax for:
    • neurons/validator.py
    • tools/llm_endpoint_service.py

@RaoAsim
RaoAsim force-pushed the feature/validator-hardness branch from b2c1605 to abca25c Compare May 18, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant