Skip to content

Migrate WithWorldQuerier to WithWorldService

WithWorldService provides per-plugin ABAC (Attribute-Based Access Control) authorization. Each plugin receives its own authorization subject (plugin:<name>), enabling:

  • Fine-grained access control: Operators can grant different plugins different world access permissions.
  • Audit logging: Plugin queries are traceable to specific plugins.
  • Security isolation: Plugins only access what they’re authorized to access.

WithWorldQuerier bypasses authorization entirely, which is a security risk in production environments.

Replace WithWorldQuerier with WithWorldService:

// Before (deprecated) — no authorization
funcs := hostfunc.New(
kvStore,
hostfunc.WithWorldQuerier(querier),
)
// After (recommended) — per-plugin ABAC authorization
funcs := hostfunc.New(
kvStore,
hostfunc.WithWorldService(worldService),
)

The key difference is that WorldService methods include a subjectID parameter for authorization:

InterfaceMethod Signature
WorldQuerierGetLocation(ctx, id)
WorldServiceGetLocation(ctx, subjectID, id)

The host function system automatically provides the subject ID based on the plugin name (plugin:<name> via access.PluginSubject()), so plugin code itself does not need changes.

VersionStatus
CurrentWithWorldQuerier deprecated
v1.0.0WithWorldQuerier removed