Skip to content

Conversation

@dwedr
Copy link
Collaborator

@dwedr dwedr commented Dec 18, 2025

I have JIRA issue created

  • branch and/or PR name(s) includes JIRA ID
  • issue has "Fix version" assigned
  • issue "Status" is set to "In review"
  • PR labels are selected
  • FLP integration tests were ran successful

Implementation of database call structure, including seeding for both Vault and the database, along with integration tests verifying the seeded data. Updated related files and configurations accordingly.

dwedr added 30 commits November 8, 2025 03:13
@dwedr dwedr self-assigned this Dec 18, 2025
Copilot AI review requested due to automatic review settings December 18, 2025 04:49
@dwedr dwedr requested a review from graduta as a code owner December 18, 2025 04:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements a comprehensive database and Vault infrastructure for the Tokenization service, including seeding, migrations, integration tests, and CI/CD updates.

Purpose: Establish database service-controller structure with automated seeding for both Vault and the database, along with integration tests to verify seeded data.

Key Changes:

  • Database infrastructure with Sequelize ORM, migrations, and seeders
  • Vault integration with certificate-based authentication and key management
  • Comprehensive test suite including unit and integration tests
  • Docker Compose orchestration for local development and testing

Reviewed changes

Copilot reviewed 68 out of 74 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
scripts/actions-certificates-creation.sh Generates test certificates for Vault and clients
docker/vault/vault-setup.sh Initializes and configures Vault with policies and secrets
docker/database/populate/*.sql Database and user creation scripts
docker-compose*.yml Updated service orchestration with Vault and database dependencies
backend/central-system/src/lib/database/* Database models, migrations, seeders, and Sequelize configuration
backend/central-system/src/controllers/VaultController.ts Vault operations controller with event bus integration
backend/central-system/src/services/Vault*.ts Vault service implementations (auth, sign, encrypt, credentials)
backend/central-system/tests/**/*Integration.spec.ts Integration tests for Vault and database
.github/workflows/tokenization.yml Updated CI pipeline with certificate generation and extended tests
Files not reviewed (2)
  • Tokenization/backend/central-system/package-lock.json: Language not supported
  • Tokenization/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,135 @@
#!/usr/bin/env bash
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The title in the PR metadata contains a typo: "[OGUI-1844}" should use a closing bracket "]" instead of a closing brace "}".

Copilot uses AI. Check for mistakes.
).rejects.toThrow('error');
});

it('renew() connects with proper token and reutrns renwed token', async () => {
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

There's a typo in the comment. "reutrns" should be "returns".

Copilot uses AI. Check for mistakes.
import {importSPKI, CompactEncrypt } from 'jose';


/** * @description Encrypts data using a provided public key with RSA-OAEP-256 and A256GCM.
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The comment has inconsistent spacing. There's an extra space between "/" and the actual comment text. Should be formatted as "/ * @description..." without the extra space.

Copilot uses AI. Check for mistakes.

/**
* @description Registers the event handlers for vault-related operations.
* This method sets up handlers for signing tokens, logging in, renewing tokens, encyption,
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

Typo in comment: "encyption" should be "encryption".

Suggested change
* This method sets up handlers for signing tokens, logging in, renewing tokens, encyption,
* This method sets up handlers for signing tokens, logging in, renewing tokens, encryption,

Copilot uses AI. Check for mistakes.
* or submit itself to any jurisdiction.
*/

import { log } from 'console';
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

Unused import log.

Suggested change
import { log } from 'console';

Copilot uses AI. Check for mistakes.

type Method = 'GET' | 'POST' | 'PUT' | 'DELETE' | string;

const logger = LogManager.getLogger('database/utils/expireToken');
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

Unused variable logger.

Copilot uses AI. Check for mistakes.
body: Buffer | string | NodeJS.ReadableStream | null
): Promise<void> {
try {
const resp = await axios.post(url, body, {
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

Unused variable resp.

Copilot uses AI. Check for mistakes.
import { db } from '../../dist/lib/database/Database.js';

describe('Database - integration (seed verification)', () => {
let database: SequelizeDatabase;
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

Unused variable database.

Copilot uses AI. Check for mistakes.
Comment on lines 34 to 35
echo "$init_output" | sed -n '1,50p'

Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

vault-setup.sh logs the full output of vault operator init, which includes the unseal key and initial root token, directly to stdout. Anyone with access to container logs or CI logs can recover these secrets and fully compromise the Vault instance (read/modify any secrets, sign/encrypt data, etc.). Remove the logging of the raw init output and ensure unseal keys/root tokens are only stored in secured locations (e.g., files or secret stores) without ever being printed to logs.

Copilot uses AI. Check for mistakes.
Comment on lines 134 to 135
echo "[Vault CI] .env contents:"
cat "$BACKEND_ENV"
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

This script prints the generated .env file to stdout, which includes the database password and base64-encoded Vault certificates/keys. Exposing these secrets in CI logs or terminal output allows anyone with log access to reuse the DB credentials or impersonate the Vault client using the leaked private key. Avoid logging the full contents of the .env file and instead only log non-sensitive metadata (e.g., path, presence of variables) while keeping credentials and private keys out of logs.

Copilot uses AI. Check for mistakes.
@dwedr dwedr changed the title [OGUI-1844} Implementation of database service-controller structure and seeding creations [OGUI-1844] Implementation of database service-controller structure and seeding creations Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants