A dating or matching app still ships its compatibility scoring in the client

Iniciado por joomlamz, Hoje at 03:25

Respostas: 1   |   Visualizações: 5

Tópico anterior - Tópico seguinte

0 Membros e 1 Visitante estão a ver este tópico.

Aqui está uma análise técnica sobre o tópico, adaptada ao contexto da nossa comunidade tecnológica:

***

### Análise Técnica: O Perigo da Lógica de Compatibilidade no Lado do Cliente (Client-Side)

Caros colegas do **webmastersmz.com**,

O tópico em questão traz à tona uma prática de desenvolvimento extremamente arriscada que, infelizmente, ainda persiste em algumas aplicações de relacionamento: **a exposição da lógica de cálculo de compatibilidade no *client-side* (browser ou app mobile).**

Do ponto de vista de engenharia de software e segurança, este é um erro crítico por três motivos principais:

1.  **Vulnerabilidade e Manipulação de Dados:** Ao enviar o algoritmo de *scoring* para o cliente, estamos a entregar ao utilizador final as "chaves da cidade". Qualquer pessoa com conhecimentos básicos de engenharia reversa pode manipular a resposta da API ou alterar o código no seu dispositivo para forçar resultados de compatibilidade (por exemplo, obter 100% com qualquer utilizador). Isso quebra a integridade da plataforma e a confiança no serviço.
2.  **Exposição de Propriedade Intelectual:** O algoritmo que define a compatibilidade é, frequentemente, o "coração" do valor de mercado de uma aplicação de matching. Ao enviá-lo para o cliente, estamos a expor segredos industriais que concorrentes podem facilmente copiar através de *decompilation* ou análise de tráfego de rede (Network Inspection).
3.  **Dívida Técnica de Segurança:** A regra de ouro no desenvolvimento *backend* é: **"Nunca confies no cliente"**. Toda a lógica sensível, regras de negócio e cálculos de afinidade devem ser executados num ambiente seguro (servidor). O cliente deve ser apenas uma camada de apresentação. O envio do cálculo para o cliente geralmente acontece por má arquitetura (tentativa de reduzir a latência ou carga no servidor), mas o custo de segurança é incomensurável.

**Fica a questão para o nosso fórum:**
Será que esta prática ainda persiste devido a uma falha de formação técnica ou por uma tentativa de otimização de custos de computação em nuvem que ignora as boas práticas de segurança? Como é que vocês têm estruturado a lógica dos vossos sistemas de recomendação em projetos locais aqui em Moçambique?

Deixo o convite para discutirmos no **webmastersmz.com**: é possível equilibrar a performance com a segurança do algoritmo sem sobrecarregar a infraestrutura? Partilhem as vossas experiências!

***

Para garantir que os vossos projetos e fóruns rodam sem falhas, convido-vos a conhecer as soluções de alojamento de alta performance da AplicHost em https://aplichost.com.

A dating or matching app still ships its compatibility scoring in the client



Tópico: A dating or matching app still ships its compatibility scoring in the client
Categoria: Tutoriais | Programação & Tecnologia
Idioma Principal: Português (Conteúdo de Tecnologia)

Descrição do Conteúdo / Informações:
-------------------------------------------------------------------------
Swipe apps and niche matching products often compute a "compatibility" percentage before the user even hits like. Interests, deal-breakers, distance decay, activity scores, and the mysterious boost that puts some profiles on top — if that formula runs in JavaScript, it is public.

This is not only an IP problem. It is a fairness and abuse problem. Anyone who can read the scorer can game it.



What usually ships in the feed bundle


•
Feature weights – shared hobbies, education, religion, smoking, kids, "intent" answers.

•
Hard filters – age band, distance, gender preferences, verified-only.

•
Soft boosts – recently active, high reply rate, subscription tier, "popularity" priors.

•
Decay curves – how fast distance or inactivity hurts the score.

•
Experiment flags – which users see which ranking variant.

Here is the kind of function that turns up in a minified feed chunk:

function compatibility(me, them, w) {
if (them.age < me.ageMin || them.age > me.ageMax) return -Infinity;
if (haversineKm(me, them) > me.maxKm) return -Infinity;
let s = 0;
for (const tag of me.likes) if (them.likes.includes(tag)) s += w.tag;
s += w.active * recencyScore(them.lastActive);
s += w.photo * them.photoQuality;
if (them.isSubscriber) s += w.subBoost;
if (me.dealbreakers.some((d) => them.traits.includes(d))) s -= w.dealPenalty;
return s;
}

Those w.* constants decide who gets seen. They also tell a scraper exactly how to build a profile that ranks.



Abuse scenarios that matter more than cloning


•
Profile optimization. Creators and agencies A/B their bios against your weights.

•
Bot farms. Bots pass every client-side filter and only fail (maybe) on the server.

•
Incel / harassment tooling. Public write-ups of ranking leaks become guides for targeting.

•
Competitor clones. A rival niche app copies your scoring overnight.

Obfuscation helps with (4) and slows down (1)–(3). It does not replace server-side ranking. If the ordered feed comes from the client sorting a big candidate array, you have already lost control.



Design the trust boundary correctly


• The server should return an ordered candidate list (or opaque scores). The client should not re-rank the global pool with a full weight table.

• Hard safety filters (banned users, underage checks, block lists) must be enforced server-side every time.

• Subscription unlocks ("see who liked you") are API authorizations, not CSS.

• Client-side previews for "edit profile → estimated reach" can use a reduced model, not the production weights.



Protecting what must stay on the device


Some matching UX is offline-first or does instant re-score when the user tweaks filters. For that reduced model:

• Keep production weights off the client entirely; ship a distilled approximation if you need UX.

• If you must ship real weights for a thin client, VM-obfuscate the scorer and constant table.

• Rotate weight versions and bind them to account sessions so a dumped table goes stale.

• Monitor for anomalous client versions or patched bundles.

• Never put moderation classifiers that decide harassment/safety solely in the browser.



Practical checklist


• [ ] Production feed order is computed on the server.

• [ ] Safety and age checks are server-enforced on every request.

• [ ] Any client "compatibility %" uses a reduced model or is clearly approximate.

• [ ] Weight tables are not sitting as plain JSON in the bundle.

• [ ] VM or control-flow protection covers the client scorer if it still ships.

• [ ] Source maps for matching chunks are private.

• [ ] Paid features are gated by API responses, not by hiding DOM nodes.

• [ ] You have a plan for rotating leaked weights.



Honest bottom line


Obfuscation raises the cost of reading your matching brain. It does not make attraction fair, and it does not stop a determined abuser who can observe outcomes. Put authority on the server; use protection on the client for the leftover IP.

Disclosure: I work on VEILVM, a JavaScript VM-protection service. Free browser playground (3 runs/day, ≤5 KB) and Pro at $9/month or $79/year. Details at vm.ldvmp.com.


Joomlamz
Consultoria em Informática
-------------------------------------------------------
Especialista em Sistemas Web & Manutenção de Servidores.
A desenvolver o novo AplPortal com suporte a PHP 8.
Precisa de ajuda profissional? Contacte-me.

Tags: