Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api-users): users endpoint expect read:user:list feature #494

Merged
merged 2 commits into from
Jul 17, 2022

Conversation

aprendendofelipe
Copy link
Collaborator

Corrige o problema de segurança no endpoint api/v1/users que estava listando todos os usuários e suas propriedades sem exigir a feature read:user:list e nem mesmo estava exigindo sessão de usuário ativa.

Problema relacionado com #186 (comment)

@vercel
Copy link

vercel bot commented Jul 15, 2022

@aprendendofelipe is attempting to deploy a commit to the TabNews Team on Vercel.

To accomplish this, @aprendendofelipe needs to request access to the Team.

Afterwards, an owner of the Team is required to accept their membership request.

If you're already a member of the respective Vercel Team, make sure that your Personal Vercel Account is connected to your GitHub account.

Comment on lines 15 to 21
beforeEach(async () => {
defaultUser = await orchestrator.createUser();
defaultUser = await orchestrator.activateUser(defaultUser);
privilegedUser = await orchestrator.createUser();
privilegedUser = await orchestrator.activateUser(privilegedUser);
privilegedUser = await orchestrator.addFeaturesToUser(privilegedUser, ['read:user:list']);
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zero impacto nesse caso, mas uma coisa que eu me peguei pensando no passado que queria compartilhar foi o tradeoff entre performance (de criar esses usuários mesmo em testes onde eles não são usados), legibilidade (há uma distância maior entre a declaração e uso das variáveis, mas talvez o maior problema seja quando houver dois privilegedUser com features diferentes, e daí a criação deles vai estar num contexto longe do uso) e que está casado com refatoração (ta tudo num só lugar, delicinha).

Não mudaria nada, mas só queria compartilhar esse pensamento 🤝

@filipedeschamps
Copy link
Owner

Muito massa por ter respeitado o padrão:

  • Usuário anônimo
  • Usuário padrão
  • Usuário privilegiado

🤝

@vercel
Copy link

vercel bot commented Jul 17, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
tabnews ✅ Ready (Inspect) Visit Preview Jul 17, 2022 at 3:26PM (UTC)

@filipedeschamps
Copy link
Owner

Merged! Let's goooooo!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants