J/APPLICATION SECURITY

A login is not an authorization policy

A signed-in person still needs permission for each action on each resource. Design that decision at the server boundary, then test the requests the interface never offers.

Our security engineering approach
JASMIR / A FIELD OF POSSIBILITY

Make the authorization decision explicit

Authentication answers which identity the application has verified. Authorization answers whether that identity may perform this action on this object in the current context. A person who can read a request may not be allowed to update it, export its history or approve it. The difference belongs in the policy and the implementation, not just in a hidden button.

For a multi-tenant portal, make the inputs explicit: the authenticated actor, current membership, requested action, resource tenant and relevant business relationship. Treat identifiers and proposed actions from the browser as input. Obtain role and tenant authority from trusted, current application state rather than accepting them from the request body.

Scope the lookup before returning data

Consider request R-17 in tenant A. A tenant-B user can submit the same identifier even if the interface never shows it. The repository lookup and the policy check must keep that user from receiving the record. Choosing an unpredictable identifier may reduce guessing, but cannot establish entitlement.

// Illustrative repository shape. Bind parameters through your data library.
const membership = await resolveCurrentMembership(verifiedSession);
const request = await repository.findRequest({
  id: validatedRequestId,
  tenantId: membership.tenantId
});
requirePermission(membership, 'request:read', request);
return publicRequestFields(request);

The example deliberately separates verified identity, tenant-scoped lookup, authorization and output projection. Real code also needs clear handling for expired sessions, missing objects, validation errors and database transactions. Decide whether unauthorized objects receive a generic not-found response, but do not mistake the response code for the control itself.

Read, write and export are different permissions

An export endpoint can reveal more than a detail view. An update can change authority or trigger a downstream action. Review those capabilities separately. A broad administrator label is not a reason to bypass tenant boundaries for every request. Where support access is necessary, make its purpose, scope, duration and audit record explicit.

Check alternate paths too. List queries, search suggestions, download URLs, caches and background jobs need the same data boundary. A queue job should carry enough trusted context to resolve its authority at execution time. Consider permission revocation and delayed work, rather than assuming the authority at enqueue time remains valid forever.

Test the denied cases as first-class behavior

Representative boundary checks
RequestExpected behavior
Active tenant-A reader reads tenant-A requestReturn the agreed public fields
The same reader names a tenant-B requestReturn no tenant-B content
Reader attempts update or exportDeny without the separate permission
Membership becomes inactiveDeny the operation
Caller adds an admin field to the inputDo not grant additional authority

Test direct API requests as well as ordinary UI journeys. Exercise bulk operations, partial failures and concurrent permission changes where the design requires them. Inspect logs and error bodies for unintended disclosure. A successful allow-case alone leaves the most important boundary unproven.

Inspect and reproduce the small reference example

We publish an educational policy function and an in-memory tenant-scoped read example with 20 executable checks. The checks cover explicit action permissions, tenant mismatches, inactive membership, malformed inputs, a spoofed role and output projection. They run without dependencies on a hosted service.

# Save both .mjs files in the same folder, then run with Node.js.
node --test authorization-reference.test.mjs

The recorded results apply only to those files. This example does not implement production authentication, a database, sessions, atomic writes or an export service. It illustrates the policy boundary. A real application needs those controls integrated and verified in its actual environment.

Sources and scope.

An original Jasmir explanation with illustrative examples, informed by the primary references below. This is engineering guidance, not a client assessment or a claim of certification. Scope and verification for a real project are agreed separately.

Let’s design the security boundaries of your next build.

Discuss your software

NEXTYOUR VISION. OUR CODE.

What’s your
next big thing?

↗

A new idea. A difficult workflow. A better way forward.
Let’s find the right place to begin.

contact@jasmir.io ↗