Skip to content

Add ACL Support #52

@posborne

Description

@posborne

Overview

Add support for Fastly's Access Control Lists (ACLs), providing IP-based blocklists and access control.

WIT Interface

interface acl {
  use types.{error, open-error, ip-address};

  resource acl {
    open: static func(name: string) -> result<acl, open-error>;
    lookup: func(ip-addr: ip-address) -> result<option<body>, acl-error>;
  }

  enum acl-error {
    too-many-requests,
    generic-error
  }
}

WIT bindings: stubs/wit_world/imports/acl.py

API Design

  • Implement ACL resource wrapper
  • lookup(ip) accepts str, IPv4Address, or IPv6Address and returns Optional[dict]
  • Parse JSON body response from WIT layer when IP matches ACL entry
  • Return None when IP not found in ACL (no match)

Cross-SDK Comparison: All SDKs expose open(name) and lookup(ip) returning entry with prefix, action, id fields. Simple consistent API across languages.

Viceroy Testing

Viceroy supports ACL with JSON file-based test data via test.toml:

[local_server]
# Path to JSON file with ACL entries
acls.my_blocklist = "../data/acl.json"

# Or using object syntax
acls.my_allowlist = { file = "../data/allowlist.json" }

ACL JSON file format maps IP addresses to metadata objects. Lookup operations work with test data. Tests can use @on_viceroy with file references in TOML configuration.

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions