DEV Community

SolomonFletcher5872
SolomonFletcher5872

Posted on

SMS OTP Login Compliance and Phishing Risks under GDPR PSD2 and NIST Explained

An educational marketplace can start with a minimal seller order notice and an authenticated dashboard. SMS OTP alone isn't enough evidence of login compliance under GDPR or PSD2, and NIST identifies restrictions and phishing risks that a delivery receipt cannot resolve.

Short answer: SMS OTP alone does not establish EU or US compliance. GDPR requires a risk-appropriate approach to personal data security; PSD2 authentication requirements concern covered payment activities; NIST treats authentication over the public telephone network as restricted and does not classify manually entered OTPs as phishing resistant. A delivered text proves none of those requirements by itself.

That distinction also answers the pharmacy refill question: a refill alert and access to a patient account are separate decisions. This walkthrough uses an edtech seller receiving a new-order notice to make the evidence workflow concrete. Health-related messages require their own assessment; the marketplace example cannot establish that a pharmacy workflow complies.

Can SMS OTP provide enough login compliance evidence for GDPR PSD2 and NIST?

Very little alone. A delivery status concerns transport. It doesn't establish that the intended person read the message, that a phone number still belongs to that person, or that a login satisfies an assurance requirement. SIM swapping can redirect a number, while phishing can persuade a user to relay a valid OTP. A short expiration window does not remove either mechanism.

The data flow can stay small: an order event identifies the seller, a policy check decides whether the configured notification channel is allowed, and an outbox records a minimal notice for dispatch. Separately, the dashboard checks authentication before showing order details. Each decision receives its own evidence record. An AI assistant may help draft the notice, but deterministic policy decides whether it can be sent.

Build the evidence check before connecting a sender

The notebook-to-prod starting point is an executable policy example.

The following Python program uses only the standard library and deliberately sends no messages. Its identifiers and policy revision are illustrative fixtures, not records of an actual seller or a legal determination. The assertions exercise different outcomes: an allowed order notice and a held notice after the channel is disabled.

from dataclasses import dataclass


@dataclass(frozen=True)
class OrderEvent:
    event_id: str
    order_id: str
    seller_id: str


@dataclass(frozen=True)
class NoticePolicy:
    revision: str
    channel_enabled: bool
    purpose: str
    assessment_ref: str


def evaluate_notice(event: OrderEvent, policy: NoticePolicy) -> dict:
    allowed = (
        policy.channel_enabled
        and policy.purpose == "seller_order_notice"
        and bool(policy.assessment_ref)
    )
    return {
        "event_id": event.event_id,
        "seller_id": event.seller_id,
        "policy_revision": policy.revision,
        "assessment_ref": policy.assessment_ref,
        "purpose": policy.purpose,
        "decision": "queue" if allowed else "hold",
        "reason": "policy_allows_notice" if allowed else "policy_incomplete_or_disabled",
    }


def prepare_notice(event: OrderEvent, policy: NoticePolicy) -> dict:
    evidence = evaluate_notice(event, policy)
    if evidence["decision"] == "hold":
        return {"evidence": evidence, "outbox": None}
    return {
        "evidence": evidence,
        "outbox": {
            "idempotency_key": f"{event.event_id}:seller_order_notice",
            "recipient_ref": event.seller_id,
            "template_id": "seller_order_notice_v1",
            "body": "You have a new order. Open your seller dashboard to review it.",
        },
    }


event = OrderEvent("evt_demo_001", "order_demo_042", "seller_demo_007")
policy = NoticePolicy("policy_v3", True, "seller_order_notice", "assessment_demo_01")
result = prepare_notice(event, policy)
assert result["evidence"]["decision"] == "queue"
assert event.order_id not in result["outbox"]["body"]

disabled = NoticePolicy("policy_v3", False, "seller_order_notice", "assessment_demo_01")
assert prepare_notice(event, disabled)["outbox"] is None
print(result)
Enter fullscreen mode Exit fullscreen mode

An assessment reference is a pointer to reviewed reasoning.

Its presence isn't proof that the reasoning is correct.

That is a useful boundary for an eval harness: this function can demonstrate consistent execution of a policy, while a reviewer must assess the policy itself. The code also makes a deliberate privacy trade-off. A generic notice reveals less order information on a lock screen, but the seller must open the dashboard to learn what happened. Even the generic notice can reveal a relationship with the marketplace. Message minimization reduces exposure; it does not erase it.

Decide which requirement the evidence must support

GDPR does not name SMS OTP as a universal compliance pass. Article 5 covers principles including data minimization and storage limitation, Article 6 addresses lawfulness, and Article 32 requires security appropriate to risk. A seller's channel preference is useful operational input, but it must not silently stand in for a documented lawful basis. Define the purpose, recipients, access controls, and retention rationale for notification and authentication records. Record who approved that assessment and which policy revision implements it.

PSD2 asks a different question. Article 97 addresses strong customer authentication for specified payment-service activities. The related regulatory technical standards describe independent authentication elements and, for relevant remote electronic payments, dynamic linking to the amount and payee. A marketplace order notification does not by itself establish that such a payment activity is occurring. Conversely, possession of a phone number does not establish that a covered payment flow has satisfied the full authentication requirement. Map the actual payment flow and the responsible payment-service actors before applying that label.

For NIST, inspect the authenticator rather than the delivery receipt. SP 800-63B-4 identifies public switched telephone network out-of-band authentication as restricted and discusses risk indicators such as SIM changes and number porting. A manually entered SMS code is susceptible to phishing. Requiring two inputs is insufficient if the inputs do not satisfy the required factor and independence properties. Select the required assurance level first, then assess authenticators against it.

Scope matters here.

NIST guidance is not a blanket certificate of US legal compliance, and GDPR and PSD2 answer different regulatory questions. If pharmacy alerts are the production use case, determine the applicable health privacy obligations separately. Nothing in an SMS delivery callback resolves them.

Turn failure cases into release evidence

The useful eval-driven question is whether a release preserves the policy under unpleasant inputs. Add fixtures for a disabled channel, an absent assessment reference, a duplicate order event, a changed phone number, and an authentication event accidentally routed into the notification handler. Give every fixture an expected decision and reason. Test recovery too. An account recovery route that relies on the same compromised number can undermine the stronger authentication used for normal login.

The example produces an idempotency key; it does not enforce uniqueness. In production, persist the evidence and outbox entry together, enforce the intended uniqueness rule, and have a worker claim work before dispatching. If the sender accepts a request but its response is lost, retrying can produce a duplicate notice unless the integration has a suitable deduplication mechanism. Explicitly model an unknown send outcome. A useful release fixture runs the same event through the dispatcher twice and checks the persisted send decision, rather than merely comparing generated keys. This costs more implementation effort than a direct send from the order handler, but it makes the duplicate-handling claim testable.

Don't label uncertainty success.

For observability, correlate the order event, policy revision, send attempt, and subsequent status without putting OTP values or unnecessary personal data into logs. Define what each status means and who may inspect it. Retention should follow the documented purpose and obligations; an indefinite archive of message bodies is not automatically better compliance evidence.

There is no need to put a model in this decision path. A fixed notice template keeps prompt cost at zero for the demonstrated workflow and makes expected output straightforward to test. If an agent later summarizes orders, evaluate that feature separately and keep its context limited to the data it needs. Authentication secrets have no useful role in a summarization prompt.

Make the release decision from evidence

Before release, have the owner of the assessment confirm the purpose, legal scope, and retention decision. Have engineering demonstrate that repeated order events do not create uncontrolled sends, that disabled channels remain disabled, and that an uncertain send result remains distinguishable from a confirmed one. Check the dashboard authentication and account recovery paths together. Keep the test results tied to the deployed policy revision so a later reviewer can reconstruct the decision.

SMS OTP can be one component of a deliberately scoped authentication design. The approval decision needs evidence about the whole flow: the applicable requirement, the authenticator's properties, recovery, data handling, and failure behavior. A new-order text should remain a notice.

References

The regulatory and authentication sources below support the distinctions between data protection, payment authentication, and authenticator assurance. The messaging and email sources provide transport context; neither establishes login assurance.

Further reading

Top comments (0)