Urgent.News

What's breaking now, across thousands of outlets.

Tech

An alternate-key lookup still needs object authorization

Most BOLA writeups show GET /orders/{id} with a guessed UUID. The same bug often hides behind a “friendlier” lookup: GET /orders?email= , findByExternalId , or where slug = ? . If the handler resolves a row by email, SKU, username, or external id and returns it whenever some row matches — without proving the authenticated subject may access that row — you still have broken object authorization.…

Many online resources illustrate a security flaw by using a GET request like GET /orders/{id} with an assumed UUID. This same vulnerability can also arise from more user-friendly approaches such as GET /orders?email=, findByExternalId, or slug = ?. If the system retrieves a row based on email, SKU, username, or external ID and returns it whenever any row matches, without ensuring the authenticated user has permission to access that row, then object authorization has been compromised.

The primary key's opacity is not the actual source of control. The oversight is in not checking if the user can perform the action on the specific resource after resolving it. Effective practices include resolving by an alternate key, then authorizing the loaded resource for the specific subject (tenant, ownership, relationship), and not assuming "we found a row" means "they may see it".

The same authorization rules should apply to both list and single-resource routes. If GET /orders is restricted to the caller's tenant, then GET /orders/by-email must also respect this same restriction and not utilize a global unique index. It is advisable to use the same denial shape as your id-based routes (often a 404 error) so alternate keys do not inadvertently function as an existence oracle across different tenants.

Logging the resolved resource ID on a denial should be a standard practice. A simple test is to attempt to access another user's order using their email or external ID while acting as that other user. If the system grants access, then the security gate failed not because a row doesn't exist, but because authorization was missing.

Remember, lookups are merely conveniences, but authorization is fundamentally about the object, not the shape of the key.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Building a Data Pipeline for Vehicle Listings: The Parts That Get Complicated

A vehicle listing looks simple from the front end. You might have a make, model, year, mileage, price and a few images. But behind that interface, keeping the data accurate can become a surprisingly…

  • Source data inconsistency requires normalization layer
  • Vehicle Identification Number (VIN) as unique identifier
  • Timestamped pricing with currency and conversion details

协程到底是什么?用"一个人守三口锅"讲明白,别再和线程混为一谈

面试里被问"协程是什么",很多人的答案是一句背来的话:"协程是用户态的轻量级线程。" 这句话不算错,但它几乎解释不了任何事。听完之后你还是不知道该在什么时候用它、为什么它会被一个 time.sleep() 卡死、为什么它不需要锁。 这篇不讲定义,只讲三件事: 协程在切什么、调度权在谁手里、什么时候不该用。 一、先把三个词排成一队:进程、线程、协程…

协程到底是什么?把它当成“一个能中途暂停的函数”,一切就通了

TL;DR:协程不是“更快的线程”,它是一个可以在中途停下来、把线程让给别人、之后还能从停下的那一行接着跑的函数。它省掉的不是计算时间,而是等 IO 时的空转。 面试被问“协程是什么”,大多数人的答案是背来的一句:“协程是用户态的轻量级线程。” 这句话不算错,但它几乎解释不了任何事。听完你还是不知道该在什么时候用它、为什么它会被一个 time.sleep() 卡死、为什么它不需要锁。…

More from Friday 2 October →