Skip to content

CountryDto: nationalityAllowed maps to an unused column; no DTO field exposes the real nationality gate #3755

@TaprootFreak

Description

@TaprootFreak

Problem

CountryDto exposes allow-flags that are derived aliases in country-dto.mapper.ts, and one alias is misleading:

  • nationalityAllowed is mapped from the entity column nationalityStepEnable.
  • nationalityStepEnable is read nowhere in the backend (only defined on the entity and used in this mapper).
  • The actual nationality validation uses a different column, nationalityEnable (kyc.service.ts, getNationalityErrors / getIdentCheckErrors).

So no CountryDto field reflects the real nationality gate. A client that filters its nationality picker by nationalityAllowed filters by a dead flag, and its UI can silently diverge from backend enforcement for any country where the two columns differ.

For reference, the correct mapping for the address/residence country is kycAllowed = dfxEnable (enforced in user-data.service.ts updatePersonalData), and locationAllowed = ipEnable gates the request IP's country, not a user-entered field.

Secondary

displayOrder is consumed by clients (e.g. realunit-app picker ordering), but no displayOrder column exists on the Country entity or in any migration — clients always receive undefined.

Suggested fix

  • Fix the mapper to use nationalityEnable, or expose nationalityEnable as its own DTO field; remove nationalityAllowed if nationalityStepEnable is genuinely unused.
  • Either add a real displayOrder column or stop documenting/consuming it.

Context

Found during a deep audit of the realunit-app country pickers (DFXswiss/realunit-app#519), which had to be corrected because the DTO flag names do not match enforced semantics.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions