Vai al contenuto principale

#api

Why authentication is only one part of protecting mobile payment traffic.

A valid access token proves that a credential was accepted. It does not pro

Altro...

Why authentication is only one part of protecting mobile payment traffic.

A valid access token proves that a credential was accepted. It does not prove that the request is fresh, came from the expected application, originated from a trusted device, or has not been automated at an abusive rate.

Mobile financial APIs need defense in depth. Each layer answers a different security question, and no single signal should carry more confidence than it deserves.

Validate the request context
Before business logic runs, the gateway can examine:

client application type;

application version and build;

device identifier format;

content type for mutations;

timestamp and nonce;

request signature;

IP and device reputation; and

request rate.

These checks should produce clear internal reasons while returning restrained customer-facing errors.

Sign the request, not only the session
An HMAC signature can bind the HTTP method, path, timestamp, nonce, and request body to a shared application secret or derived signing key.

signature = HMAC(method + path + timestamp + nonce + body_hash)

The server independently reconstructs the signed content and uses constant-time comparison. A valid signature helps detect body modification and requests created outside the expected client.

Exact signing rules and enforcement thresholds should remain private.

Prevent replay
A correctly signed request can still be dangerous if captured and submitted again.

Replay protection requires:

a limited timestamp window;

a nonce unique within that window; and

an atomic cache write that rejects an existing nonce.

Financial endpoints must still be idempotent because replay protection and transaction idempotency defend different boundaries.

Rate-limit atomically
A rate limiter that performs get, then increments, then set can lose updates across concurrent workers. An atomic cache increment produces a reliable count for each IP and device window.

Limits can adapt to device reputation, but exact thresholds and risk weights should not be published.

Combine signals carefully
Device properties, unusual request patterns, outdated clients, and reputation can contribute to a composite risk decision. Treat weak signals as risk contributions rather than absolute proof of compromise.

The enforcement model may allow, warn, block, or temporarily blacklist. False positives need an operational recovery path.

Keep the hot path efficient
Security middleware runs on every request. Batch cache reads, short-lived in-process caching for clean devices, bounded background persistence, and guarded debug logging can reduce avoidable overhead.

Performance optimizations must never cache a blocked decision incorrectly. Any blacklist or high-risk event should invalidate the local clean-device cache immediately.

The design principle
Authentication identifies a session. Layered request security evaluates whether each request is structurally valid, fresh, appropriately signed, correctly routed, and behaviorally acceptable.

The strongest design combines independent controls while keeping business endpoints idempotent and the security hot path observable.
Securing a Mobile Financial API in Layers

#cybersecurity #software #coding #community #engineering #security #development #api #mobile #inclusive

0

Caricamento...

0
1

Caricamento...

Rate Limiting Without the Guessing: Engineering API Abuse Controls That Hold
Rate limiting gets treated as a configuration checkbox. It is not. A limi

Altro...

Rate Limiting Without the Guessing: Engineering API Abuse Controls That Hold
Rate limiting gets treated as a configuration checkbox. It is not. A limit that is set once and never revisited will either break real users or protect nothing.
OWASP's 2023 API list moved this problem into the main body of the document. API4, Unrestricted Resource Consumption, covers request counts plus CPU, memory, storage and third-party spend. The older framing assumed a fixed number of calls per minute was the whole story. It is not.

The three places abuse actually shows up
Most teams discover abuse in one of three shapes.

Credential stuffing: many accounts, low request volume per account, high failure ratio.

Enumeration: walking an identifier space to find the objects that exist.

Economic abuse: expensive operations (search, export, report generation) called at a rate that is polite per client and ruinous in aggregate. A single global requests-per-minute rule catches none of the three cleanly, because each one has a different cost shape.

Count the right thing
The counter matters more than the threshold. Counting IP addresses fails against mobile carrier NAT and against distributed sources. Counting API keys fails when a key is shared across a partner's infrastructure. Useful keys tend to be a mix:

a subject key (authenticated user or client id) for fairness

a resource key (object, tenant, endpoint) for fairness across tenants

an operation-cost key where a single call has measurable expense Microsoft's API Management material makes the same practical point with its distinction between a rate limit (short window, protects availability) and a quota (long window, protects budget). Both are necessary, and they answer different questions.

Prove the limit works
Set a budget, then test it: send the pattern you expect an attacker to send and watch what the edge actually does. A surprising amount of rate limiting exists only in a slide deck, because nobody sent the hostile pattern through it.
Two checks are worth building into the deployment pipeline. First, a synthetic burst that must be rejected with the documented status and without leaking stack traces. Second, a synthetic legitimate burst that must not be rejected, because over-blocking is the failure mode nobody files a ticket for until the customer leaves.

Where enforcement lives
The edge is the right place for coarse limits; it is the wrong place for identity-aware limits. In practice:

Edge / gateway: coarse, per-IP or per-key, protects the tiers below against flood.

Service: per-subject and per-resource, knows what an operation costs.

Data layer: the last guard, protects the expensive query itself. Splitting enforcement this way keeps a single compromised credential from exhausting a shared backend while still stopping a volumetric flood before it reaches application code.

The uncomfortable part
Rate limiting hides operational debt. If a client legitimately needs 50,000 calls an hour, the honest fix is often a batch endpoint rather than a bigger limit. Raising the number is easier than redesigning the interface, so that is what usually happens, and the real problem stays in place.
Treat the limit as a measurement rather than a wall. When a limit fires on a legitimate client, the interesting question is why the client needs that volume, and the answer is frequently a design decision made years earlier that nobody has revisited.
Rate limiting is a control. It is not a substitute for an authorization model that holds under load, or for an interface that does not force the client to poll.
Rate Limiting Without the Guessing: Engineering API Abuse Controls That Hold

#cybersecurity #software #coding #community #engineering #development #api #inclusive #rate #limiting

0

Caricamento...

0
1

Caricamento...

If you use Claude or Codex — or any AI product whose abuse systems lean hard on network signals — the...

Altro...

If you use Claude or Codex — or any AI product whose abuse systems lean hard on network signals — the...
Before You Open Claude or Codex: Check Your Egress IP Risk

#cybersecurity #ai #software #coding #community #engineering #security #development #api #inclusive

0

Caricamento...

0
1

Caricamento...

I just gave a two hour talk on this. Devs say "just make sure noone steals the keys." Riiiight.

https://securityaffairs.com/197504/cyber-crime/50000-

Altro...

I just gave a two hour talk on this. Devs say "just make sure noone steals the keys." Riiiight.

https://securityaffairs.com/197504/cyber-crime/50000-stripe-secrets-leaked-in-public-code.html

#infodisclosure #api

45

Caricamento...

2
36

Caricamento...