Skip to content

fix(backend): align groq_token to groq_token_encrypted across DB schema and services - #93

Merged
SagiEv merged 1 commit into
mainfrom
bugfix/general
Nov 3, 2026
Merged

SagiEv merged 1 commit into
mainfrom
bugfix/general

Conversation

@SagiEv

@SagiEv SagiEv commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Summary

Aligns the Groq API token storage and retrieval with the other encrypted AI provider tokens (openai_token_encrypted, claude_token_encrypted, gemini_token_encrypted), removing legacy plaintext groq_token DB column fallbacks while preserving all existing frontend and AI microservice API contracts.

Changes

  • Database Schema & Migrations (app_settings):
    • Renamed groq_token column definition to groq_token_encrypted in backend/schema.sql and supabase/migrations/20260905000000_init.sql.
  • Settings Service & Controller:
    • Updated getSettings, saveSettings, and getAllAiConfigs in backend/services/settings.service.js to read/write groq_token_encrypted exclusively and removed the legacy updateData.groq_token = null write.
    • Updated testAiToken in backend/controllers/settings.controller.js to read from ${provider}_token_encrypted only.
  • RSS Poller:
    • Updated findFirstAppSettings in backend/repositories/rss.repository.js and pollRssFeeds in backend/services/rssPoller.js to select and decrypt groq_token_encrypted.
  • Encryption Utility:
    • Added a guard in decrypt() (backend/utils/encryption.js) to prevent IV errors if an unencrypted value is encountered.
  • Tests:
    • Updated backend/tests/helpers/factories.js, backend/tests/services/settings.service.test.js, and backend/tests/integration/rss-ai-pipeline.integration.test.js to use groq_token_encrypted.

Database Migration Note

Existing tokens in app_settings have been encrypted in-place. Ensure column rename is applied on the production DB:

ALTER TABLE app_settings
RENAME COLUMN groq_token TO groq_token_encrypted;

Verification

  • settings.service.test.js, settings.controller.test.js, encryption.test.js (Unit)
  • rss-ai-pipeline.integration.test.js, tailor-proxy.integration.test.js (Integration)

@vercel

vercel Bot commented Nov 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
job-pilot Ready Ready Preview Nov 3, 2026 11:53am UTC

@SagiEv
SagiEv merged commit eac5fab into main Nov 3, 2026
6 checks passed

This branch was successfully deployed

1 active deployment
Preview — 06e5e136 Deployed Nov 3, 2026 by vercel[bot]
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.

1 participant