Migrate WithWorldQuerier to WithWorldService
Why migrate
Section titled “Why migrate”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.
Migration steps
Section titled “Migration steps”Replace WithWorldQuerier with WithWorldService:
// Before (deprecated) — no authorizationfuncs := hostfunc.New( kvStore, hostfunc.WithWorldQuerier(querier),)
// After (recommended) — per-plugin ABAC authorizationfuncs := hostfunc.New( kvStore, hostfunc.WithWorldService(worldService),)Interface changes
Section titled “Interface changes”The key difference is that WorldService methods include a subjectID parameter
for authorization:
| Interface | Method Signature |
|---|---|
WorldQuerier | GetLocation(ctx, id) |
WorldService | GetLocation(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.
Timeline
Section titled “Timeline”| Version | Status |
|---|---|
| Current | WithWorldQuerier deprecated |
| v1.0.0 | WithWorldQuerier removed |