Skip to content

Implement credential management system - #12

Merged
MathCunha16 merged 4 commits into
mainfrom
feature/frontend/credentials-implementation
Jul 22, 2026
Merged

Implement credential management system#12
MathCunha16 merged 4 commits into
mainfrom
feature/frontend/credentials-implementation

Conversation

@MathCunha16

@MathCunha16 MathCunha16 commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Feat: Secure Credentials Vault & Security Center

This PR implements the complete frontend support for the Credentials & Vault feature inside Devaulty, adhering to zero-knowledge cryptographic practices, secure RAM session management, and premium visual components.

🔒 Key Security Features

  1. Strict Tab-Scoped Security:

    • Master Password setup and lock screens are strictly scoped to the Credentials tab inside project details view. Navigation across snippets, problems, notes, and links is completely unaffected.
  2. Master Password Setup & Enforcement:

    • Prominent warn banner highlighting that the master password applies across all projects and cannot be recovered (zero-knowledge constraint).
    • Password strength validation checking minimum 8 characters, uppercase, lowercase, numbers, and symbols, with a real-time visual strength meter.
  3. 15-Minute Inactivity Auto-Lock:

    • Monitors user activity (mousemove, keydown, click, etc.) when inside the unlocked Credentials workspace.
    • Automatically wipes the RAM cryptographic session and safely locks the vault after 15 minutes of inactivity, redirecting the user back to the default workspace.
  4. Zero-Knowledge Decrypted Payload Handling:

    • Decrypted secret values (LOGIN credentials, API_KEY tokens, and RAW_TEXT keys/private keys) are loaded on-demand and kept masked by default (••••••••).
    • Built-in Clipboard Copy and Eye Toggle buttons.
    • gcTime: 0 configured in React Query to ensure decrypted credentials are instantly wiped from browser memory/cache once the modal closes.

🎨 UI/UX Enhancements & Visual "Fru-frus"

  1. Sleek Cyber-Vault Modal (CredentialDetailModal):
    • Re-designed from scratch with custom icons, glowing esmerald border accents, formatted textareas for raw certificates/keys, and a glassmorphism header.
  2. "Matrix" Hacker Logo Animation:
    • Activated exclusively when viewing the Credentials tab.
    • Adapts to both Light and Dark themes, making the main logo turn Matrix neon green with an organic pulse aura while emitting ascending binary code particles (01 and 00).
  3. Optimized Layout:
    • Entire credential card is clickable to open details.
    • Adjusted sidebar width (72px) and tab label sizing so "CREDENTIALS" fits perfectly without text truncation.
    • Tag popovers position correctly above actions preventing clipping.

📁 Modified Files

  • Security Components:
    • src/features/security/components/MasterPasswordSetupCard.tsx
    • src/features/security/components/UnlockVaultCard.tsx
    • src/features/security/components/VaultSecurityBanner.tsx
  • Credentials Components:
    • src/features/credentials/components/CredentialForm.tsx
    • src/features/credentials/components/CredentialDetailModal.tsx
  • Special Effects:
    • src/components/HackerLogo.tsx
    • src/components/HackerLogo.module.css
    • src/components/LogoDevaulty.tsx (updated centered <> path viewBox)
  • API & Hooks:
    • src/features/security/api/securityApi.ts
    • src/features/credentials/api/credentialsApi.ts
    • src/hooks/useInactivityAutoLock.ts
  • Page Integrations & CSS:
    • src/components/ProjectDetailView.tsx
    • src/routes/projects.$projectId.module.css
    • src/components/RootLayout.tsx

Summary by CodeRabbit

  • Novos Recursos
    • Adicionado o workspace de Credentials com criação, edição, visualização, busca, filtros, tags e exclusão.
    • Incluídos componentes e fluxos completos de senha mestra, desbloqueio, bloqueio e status do cofre.
    • Implementado auto-lock por inatividade (15 minutos) e novo logotipo com animações.
  • Correções
    • Ajustadas as rotas base da API de credenciais e segurança para o prefixo /api/v1/, com atualização dos testes de integração.
  • Chores
    • Expandido o suporte de invalidação de cache para operações de tags em credenciais.

@MathCunha16 MathCunha16 self-assigned this Jul 22, 2026
@MathCunha16 MathCunha16 added enhancement New feature or request Frontend Frontend feature or modification Backend Backend feature or modification labels Jul 22, 2026
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: d9a477df-b2e8-42ec-ab64-eada853e9953

📥 Commits

Reviewing files that changed from the base of the PR and between bcdbca8 and 85cd268.

📒 Files selected for processing (2)
  • frontend/src/features/security/components/MasterPasswordSetupCard.tsx
  • frontend/src/features/security/hooks/useSecurity.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • frontend/src/features/security/hooks/useSecurity.ts
  • frontend/src/features/security/components/MasterPasswordSetupCard.tsx

📝 Walkthrough

Walkthrough

O PR corrige rotas backend, adiciona o fluxo de segurança do vault, implementa o workspace frontend de credenciais com CRUD, tags e modais, integra bloqueio automático e substitui o logo por uma versão dinâmica vinculada ao estado do vault.

Changes

Segurança, credenciais e identidade visual

Layer / File(s) Summary
Contratos de rota backend e testes
backend/src/main/java/.../credential/CredentialController.java, backend/src/main/java/.../security/SecurityController.java, backend/src/test/java/.../*ControllerIT.java
Os prefixos ap1/v1 foram corrigidos para api/v1 nas rotas de credenciais e segurança, com os testes de integração atualizados.
Fluxo de segurança do vault
frontend/src/features/security/*, frontend/src/hooks/useInactivityAutoLock.ts, frontend/src/types/api.ts
Foram adicionados setup da senha mestre, unlock, lock, status de sessão, queries, mutações, componentes e auto-lock após 15 minutos de inatividade.
Domínio e operações de credenciais
frontend/src/features/credentials/*, frontend/src/types/api.ts
Foram adicionados modelos, API CRUD, hooks React Query, formulário de criação/edição e modal de visualização com payload descriptografado.
Integração do workspace
frontend/src/components/ProjectDetailView.tsx, frontend/src/features/tags/hooks/useTags.ts, frontend/src/routes/projects.$projectId.module.css
A aba Credentials passa a listar, filtrar, editar, excluir e etiquetar credenciais, com estados de setup/bloqueio e estilos próprios.
Logo e identidade visual
frontend/src/components/HackerLogo.*, frontend/src/components/LogoDevaulty.tsx, frontend/src/components/RootLayout.tsx
O layout usa HackerLogo, que exibe aura e partículas binárias quando data-vault-active está ativo; o caminho SVG também foi atualizado.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ProjectDetailView
  participant useSecurity
  participant securityApi
  participant SecurityController
  participant credentialsApi
  ProjectDetailView->>useSecurity: consulta setup e status do vault
  useSecurity->>securityApi: executa setup, unlock ou lock
  securityApi->>SecurityController: chama /api/v1/security
  SecurityController-->>useSecurity: retorna status da sessão
  ProjectDetailView->>credentialsApi: lista ou altera credenciais
  credentialsApi-->>ProjectDetailView: retorna dados do workspace
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed O título é claro e está relacionado à principal entrega do PR, embora seja um pouco amplo para incluir também segurança do vault.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 9

🧹 Nitpick comments (1)
frontend/src/features/credentials/components/CredentialForm.tsx (1)

419-428: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Mapeie decryptedPayload pelos nomes reais do backend. O payload usa username/password, apiKey e rawText; os fallbacks para user/email, pass/secret, token/key, content/text e Object.values(payload)[0] são especulativos e podem preencher o formulário com o campo errado. Remova esses sinônimos e converta rawText para rawTextContent explicitamente.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/features/credentials/components/CredentialForm.tsx` around lines
419 - 428, Atualize o mapeamento de decryptedPayload para usar somente os campos
reais do backend: username, password, apiKey e rawText. Remova os fallbacks
especulativos e atribua explicitamente payload.rawText a rawTextContent,
mantendo valores vazios quando esses campos não existirem.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/components/ProjectDetailView.tsx`:
- Around line 259-266: Evite exibir o UnlockVaultCard durante o carregamento de
useMasterPasswordSetupStatusQuery e useVaultStatusQuery: capture os estados
isLoading/isPending dessas queries e só derive isVaultLocked e a decisão entre
setup, lock e unlock quando ambas tiverem concluído. Preserve o comportamento
atual após o carregamento, tratando explicitamente o estado pendente para não
considerá-lo bloqueado.

In `@frontend/src/features/credentials/components/CredentialDetailModal.tsx`:
- Around line 40-76: Update the isOpen effect in CredentialDetailModal to move
focus into the modal when it opens, preferably focusing the first focusable
element and falling back to modalRef.current. Ensure the modal container
supports programmatic focus with tabIndex={-1}, while preserving the existing
Escape handling and focus-trap behavior.
- Around line 80-83: Atualize copyToClipboard para tratar a Promise de
navigator.clipboard.writeText com async/await e try/catch, exibindo o toast de
sucesso apenas após a cópia ser concluída e tratando falhas de forma consistente
com handleCopy em ProjectDetailView.

In `@frontend/src/features/credentials/components/CredentialForm.tsx`:
- Around line 233-240: Update the visibility toggle buttons in CredentialForm,
including the password and API key buttons, to remain reachable through normal
keyboard Tab navigation by removing tabIndex={-1}. Add dynamic aria-label values
that clearly announce whether each control will show or hide its corresponding
secret, while preserving the existing toggle behavior and icons.

In `@frontend/src/features/security/components/MasterPasswordSetupCard.tsx`:
- Around line 77-95: Padronize a acessibilidade dos controles de senha: em
frontend/src/features/security/components/MasterPasswordSetupCard.tsx:77-95,
associe o label ao input de nova senha, adicione nome acessível ao botão de
visibilidade e remova tabIndex={-1}; aplique os mesmos ajustes ao campo de
confirmação em
frontend/src/features/security/components/MasterPasswordSetupCard.tsx:135-153;
em frontend/src/features/security/components/UnlockVaultCard.tsx:41-60, associe
o label ao input e torne o botão de visibilidade nomeado e navegável por
teclado.

In `@frontend/src/features/security/hooks/useSecurity.ts`:
- Around line 59-63: Update the onSuccess handler in useSecurity so vault
blocking cancels in-flight credential requests and explicitly removes cached
credential queries for each project and credential. Replace the broad
["projects"] invalidation with query-cache removal targeting ["projects",
projectId, "credentials"] and ["projects", projectId, "credentials",
credentialId], while preserving vaultStatus invalidation.

In `@frontend/src/hooks/useInactivityAutoLock.ts`:
- Around line 11-28: Stabilize the auto-lock timer in useInactivityAutoLock by
avoiding dependencies that change identity on every render: use the mutation’s
mutateAsync operation directly and store onLockTriggered in a ref or otherwise
make it stable. Ensure the effect resets the timeout only when the enabled state
or required mutation operation changes, so polling and inline callbacks cannot
postpone the 15-minute lock indefinitely.

In `@frontend/src/routes/projects`.$projectId.module.css:
- Line 1128: Atualize a regra CSS que contém word-break: break-word para usar
overflow-wrap: break-word e, se necessário para preservar o comportamento
existente, defina também word-break: normal.
- Around line 1176-1186: Remove the duplicated .btnDecrypt:hover rule, keeping a
single hover definition. Search ProjectDetailView and other consumers for
.btnDecrypt usage; if the class is unused, remove its base rule and remaining
related styles as well.

---

Nitpick comments:
In `@frontend/src/features/credentials/components/CredentialForm.tsx`:
- Around line 419-428: Atualize o mapeamento de decryptedPayload para usar
somente os campos reais do backend: username, password, apiKey e rawText. Remova
os fallbacks especulativos e atribua explicitamente payload.rawText a
rawTextContent, mantendo valores vazios quando esses campos não existirem.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: b3f1bf44-e461-4327-8466-a2ddeac7e77b

📥 Commits

Reviewing files that changed from the base of the PR and between aaf9f4f and e4e9a73.

⛔ Files ignored due to path filters (1)
  • frontend/src/assets/logo-devaulty.svg is excluded by !**/*.svg
📒 Files selected for processing (27)
  • backend/src/main/java/com/devaulty/backend/adapter/in/web/credential/CredentialController.java
  • backend/src/main/java/com/devaulty/backend/adapter/in/web/security/SecurityController.java
  • backend/src/test/java/com/devaulty/backend/adapter/in/web/credential/CredentialControllerIT.java
  • backend/src/test/java/com/devaulty/backend/adapter/in/web/security/SecurityControllerIT.java
  • frontend/src/components/HackerLogo.module.css
  • frontend/src/components/HackerLogo.tsx
  • frontend/src/components/LogoDevaulty.tsx
  • frontend/src/components/ProjectDetailView.tsx
  • frontend/src/components/RootLayout.tsx
  • frontend/src/features/credentials/api/credentialsApi.ts
  • frontend/src/features/credentials/components/CredentialDetailModal.module.css
  • frontend/src/features/credentials/components/CredentialDetailModal.tsx
  • frontend/src/features/credentials/components/CredentialForm.module.css
  • frontend/src/features/credentials/components/CredentialForm.tsx
  • frontend/src/features/credentials/hooks/useCredentials.ts
  • frontend/src/features/security/api/securityApi.ts
  • frontend/src/features/security/components/MasterPasswordSetupCard.module.css
  • frontend/src/features/security/components/MasterPasswordSetupCard.tsx
  • frontend/src/features/security/components/UnlockVaultCard.module.css
  • frontend/src/features/security/components/UnlockVaultCard.tsx
  • frontend/src/features/security/components/VaultSecurityBanner.module.css
  • frontend/src/features/security/components/VaultSecurityBanner.tsx
  • frontend/src/features/security/hooks/useSecurity.ts
  • frontend/src/features/tags/hooks/useTags.ts
  • frontend/src/hooks/useInactivityAutoLock.ts
  • frontend/src/routes/projects.$projectId.module.css
  • frontend/src/types/api.ts

Comment thread frontend/src/components/ProjectDetailView.tsx Outdated
Comment thread frontend/src/features/credentials/components/CredentialDetailModal.tsx Outdated
Comment thread frontend/src/features/credentials/components/CredentialForm.tsx
Comment thread frontend/src/features/security/components/MasterPasswordSetupCard.tsx Outdated
Comment thread frontend/src/features/security/hooks/useSecurity.ts
Comment thread frontend/src/hooks/useInactivityAutoLock.ts Outdated
Comment thread frontend/src/routes/projects.$projectId.module.css Outdated
Comment thread frontend/src/routes/projects.$projectId.module.css Outdated
…nd modal accessibility across the vault interface.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/features/security/components/MasterPasswordSetupCard.tsx`:
- Line 19: Update hasNumberOrSpecial so symbol detection accepts any
non-alphanumeric character, including symbols such as ?, ~, and backtick,
instead of relying on the current allowlist; alternatively, reuse the backend
password-policy definition if that is the established source of truth.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: c4e909b2-a819-4216-8d07-9eb8dbde272d

📥 Commits

Reviewing files that changed from the base of the PR and between e4e9a73 and bcdbca8.

📒 Files selected for processing (9)
  • frontend/src/components/ProjectDetailView.tsx
  • frontend/src/components/TagsManagerModal.tsx
  • frontend/src/features/credentials/components/CredentialDetailModal.tsx
  • frontend/src/features/credentials/components/CredentialForm.tsx
  • frontend/src/features/security/components/MasterPasswordSetupCard.tsx
  • frontend/src/features/security/components/UnlockVaultCard.tsx
  • frontend/src/features/security/hooks/useSecurity.ts
  • frontend/src/hooks/useInactivityAutoLock.ts
  • frontend/src/routes/projects.$projectId.module.css
🚧 Files skipped from review as they are similar to previous changes (6)
  • frontend/src/features/security/components/UnlockVaultCard.tsx
  • frontend/src/hooks/useInactivityAutoLock.ts
  • frontend/src/features/security/hooks/useSecurity.ts
  • frontend/src/features/credentials/components/CredentialDetailModal.tsx
  • frontend/src/components/ProjectDetailView.tsx
  • frontend/src/features/credentials/components/CredentialForm.tsx

Comment thread frontend/src/features/security/components/MasterPasswordSetupCard.tsx Outdated
@MathCunha16
MathCunha16 merged commit 8f257bf into main Jul 22, 2026
1 check passed
@MathCunha16
MathCunha16 deleted the feature/frontend/credentials-implementation branch July 22, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend Backend feature or modification enhancement New feature or request Frontend Frontend feature or modification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant