Safeguard
Application Security•

ASVS 5.0 V8.1.2: Document Field Level Access Rules

ASVS V8.1.2 asks for written rules on which fields each consumer can read and write, including rules that depend on object state. A matrix does the job.

Safeguard Security Team
2 min read

ASVS 5.0 V8.1.2 (Level 2) requires authorization documentation that defines field level read and write restrictions, based on who is asking and on attributes of the object, such as its status.

Why it matters

Mass assignment and excessive data exposure live at the field level. If nobody wrote down that a customer may read an order total but never write it, nobody can test for it, and a client sending extra JSON properties may change it.

How to implement it

Build a matrix per resource. For each field list the read and write rules and any state conditions:

FieldCustomer readCustomer writeSupport readSupport writeState rule
shipping_addressyesyesyesnowrite only while status is pending
totalyesnoyesnonever writable by clients
internal_notesnonoyesyesnone

Keep it in the repository and link it from the API schema. Then enforce it in code with explicit allow lists:

CUSTOMER_WRITABLE = {"shipping_address"}

def apply_update(order, payload, actor):
    allowed = CUSTOMER_WRITABLE if actor.role == "customer" else set()
    unknown = set(payload) - allowed
    if unknown:
        raise PermissionError("Fields not writable: " + ", ".join(sorted(unknown)))
    if "shipping_address" in payload and order.status != "pending":
        raise PermissionError("Order is locked")
    order.shipping_address = payload["shipping_address"]

How to test it

For each row, send a request as a role that should be denied and confirm a rejection, not a silent drop. Check responses for fields the role may not read.

Common mistakes

  • Binding request bodies straight onto models.
  • Documenting reads but not writes.
  • Forgetting state dependent rules.

Quick check

Is a schema enough documentation?

Only if it encodes permissions and state conditions per role. A plain type schema does not.

Sources

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.