Does your API answer ‘success’ to a request it should refuse?

Wealth platform API: bad requests got HTTP 200 and a success flag, then the same kind of failure in four subsystems. What to check in your own API.
Case study

Does your API answer 'success' to a request it should refuse?

The mandates area failed open first. Then one bad request got a success flag. Four subsystems showed the same kind of failure.

For CTOs and heads of engineering at fintech and wealth platforms that expose an API to clients or partners.

Send an API a bad request and you expect an error. While testing a wealth-management API, the mandates area failed open first. Then the snapshot endpoint answered a bad request with HTTP 200, a success flag and a leaked internal error name, and a third and a fourth subsystem showed the same kind of failure.

  • Wealth management
  • Portfolio and mandate API
  • Clients
  • Operations
  • Reputation
A BetterQA engineer in glasses and a teal turtleneck reading code on a monitor at her desk in the Cluj-Napoca office
The numbers
4 subsystemsshowed the same kind of fail-open behaviour
3kinds of invalid input that got 200: methodology, value type and date
51checks green in four suites, covering the parts that did work
200the status code a malformed request still received
0suites reported as passed when they could not run
At stake

What was at risk

Clients

Bad requests that look accepted

A bad request got HTTP 200 and a success flag. A client that trusts the flag carries on with nothing, or with a wrong value.

Operations

Failures no monitor sees

A status-code monitor sees a healthy call. The failure shows up later in a client's data, not in your alerts.

Reputation

Internal detail in the answer

The reply carried the name of an internal exception class where the value should be. Callers learn about your internals instead of what they got wrong.

Rules

Standards and rules in play

  • Our reporting rule for known bugsA check for an open bug stays red and is reported but does not fail the run, and turns green the day the fix lands. A suite that cannot run is reported as not reported, never as a pass.

Context: financial firms in the EU answer to DORA for managing ICT incidents, and a failure that reports success is one nobody can detect.

Method

How we tested it

Test level
System testing at API level, run against the live service.
Test types
Functional negative testing (invalid input) and regression testing of error handling.
Test basis
The expected behaviour: invalid input gets a clear error and no success flag.
  • TechniqueError guessingAn invalid methodology, a wrong value type and a malformed date sent to the snapshot endpoint, then the same kinds of input elsewhere.
  • How we workedDefect clustering (a testing principle)The same kind of fail-open behaviour turned up in the mandates area first, then in performance snapshots, a third subsystem and a fourth. One fail-open endpoint usually means more.

Terms as in the ISTQB CTFL 4.0.1 syllabus and glossary.

Findings

What we found, and what it costs

Pattern

An invalid methodology, value type or date answered 200 with the success flag set to true

What it costs youA monitor sees a healthy call and a client trusts the flag. Nobody is told that nothing happened.

Pattern

The value field carried an internal exception class name

What it costs youDetail about the system's internals reaches callers who should only see a clear error.

Pattern

The same kind of behaviour in four subsystems

What it costs youEach endpoint validates on its own, so each is its own chance to fail open. Validation in one place that every endpoint passes through is the first fix we would look at.

The working behaviour was checked too: 12, 16, 9 and 14 checks passed in the four areas, so the client could see what was sound as well as what was not.

Outcome

What changed

A list of fail-open endpoints, each with the request that proves it, and a witness test for every one that turns green on its own the day the fix lands. A suite that cannot run is reported as not reported.

What this means for you: Ask what your monitoring would show if an endpoint accepted bad input and answered success. If the answer is nothing, start there.
Check

What to check in your own product

  1. Send an endpoint invalid input, such as a wrong value type or a malformed date, and read the success flag as well as the status.A bad request got HTTP 200 and a success flag.
  2. When you find one endpoint that fails open, check the others.The same kind of fail-open behaviour turned up in the mandates area first, then in performance snapshots, a third subsystem and a fourth.
  3. Look for internal exception names in the replies.Callers learn about your internals instead of what they got wrong.

Want your API tested for failures that look like success?

We test what an endpoint returns on bad input, not only on good input. The first month is a trial.

Talk to our team
Share the Post: