Skip to content

feat: mssql pam#5676

Merged
sheensantoscapadngan merged 11 commits into
mainfrom
feat/pam-mssql
Mar 24, 2026
Merged

feat: mssql pam#5676
sheensantoscapadngan merged 11 commits into
mainfrom
feat/pam-mssql

Conversation

@sheensantoscapadngan
Copy link
Copy Markdown
Member

@sheensantoscapadngan sheensantoscapadngan commented Mar 12, 2026

Context

This PR adds support for MsSQL PAM

Relevant PR:
Infisical/cli#147

Screenshots

Steps to verify the change

Type

  • Fix
  • Feature
  • Improvement
  • Breaking
  • Docs
  • Chore

Checklist

  • Title follows the conventional commit format: type(scope): short description (scope is optional, e.g., fix: prevent crash on sync or fix(api): handle null response).
  • Tested locally
  • Updated docs (if needed)
  • Updated CLAUDE.md files (if needed)
  • Read the contributing guide

@gitguardian
Copy link
Copy Markdown

gitguardian Bot commented Mar 12, 2026

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
27411356 Triggered Generic Database Assignment 1098de0 backend/src/ee/services/pam-discovery/active-directory/active-directory-discovery-factory.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 12, 2026

Greptile Summary

This PR adds Microsoft SQL Server (MSSQL) as a supported resource type in the PAM (Privileged Access Management) module, following the same pattern already established for PostgreSQL, MySQL, and Redis. It introduces backend schemas, type definitions, a shared SQL factory case, and corresponding frontend forms for both resource creation and account management.

The implementation is structurally sound and largely consistent with existing SQL resource support, but there are two notable issues in the backend connection factory:

  • sslCertificate is silently ignored for MSSQL connections. sslCertificate is destructured at the top of makeSqlConnection and correctly forwarded as ca in the Postgres and MySQL blocks, but the MSSQL case omits it entirely from the knex/tedious options. Users who configure a custom CA certificate for TLS verification will have it silently discarded — the tedious driver supports this via options.cryptoCredentialsDetails.ca.
  • The connectOnly error guard is overly broad, using includes("Login failed for user") rather than an exact match, which could mask legitimate connectivity failures.

No PAM-specific MSSQL documentation was added (existing docs at docs/documentation/platform/pam/getting-started/resources/ cover other resource types but not MSSQL), which may limit user discoverability.

Confidence Score: 3/5

  • PR is safe to merge with caveats — the sslCertificate bug should be fixed before this is used in production with custom CA certificates.
  • The overall structure is correct and consistent with existing resource types. The main concern is the silent discard of the user-supplied sslCertificate in MSSQL connections, which is a functional correctness and security issue. The overly broad connectOnly error check is a secondary concern. These are contained to the sql-resource-factory and don't affect data integrity or auth bypass paths, but the TLS issue warrants attention before the feature is promoted to users who rely on custom CA certificates.
  • backend/src/ee/services/pam-resource/shared/sql/sql-resource-factory.ts — the MSSQL connection block needs to forward sslCertificate and tighten the connectOnly error check.

Important Files Changed

Filename Overview
backend/src/ee/services/pam-resource/shared/sql/sql-resource-factory.ts Adds MSSQL connection support via knex/tedious, but silently drops the user-supplied sslCertificate and uses an overly broad error-message substring check for connectOnly validation.
backend/src/ee/services/pam-resource/mssql/mssql-resource-schemas.ts New file defining Zod schemas for MSSQL resources and accounts; correctly overrides the database field to be optional with a "master" default, and omits password from sanitized schemas.
backend/src/ee/services/pam-resource/pam-resource-enums.ts Adds MsSQL = "mssql" to the PamResource enum; straightforward addition consistent with existing entries.
backend/src/ee/services/pam-account/pam-account-service.ts Adds MsSQL to the Postgres/MySQL switch case for session metadata construction; correct and complete.
frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/MsSQLAccountForm.tsx New account form component; mirrors MySQLAccountForm correctly but declares resourceId and resourceType props that are never used.
frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/MsSQLResourceForm.tsx New resource form with correct default port (1433), optional database defaulting to "master", and SSL enabled by default — well-structured and consistent with other SQL resource forms.
frontend/src/pages/pam/PamResourcesPage/components/ResourceTypeSelect.tsx Removes MsSQL and SSH from the "coming soon / gauge interest" list now that they are properly implemented; expected change.
backend/src/ee/services/pam-resource/shared/sql/sql-resource-types.ts Adds TMsSQLResourceConnectionDetails and TMsSQLAccountCredentials to the shared SQL union types; consistent with existing pattern.
frontend/src/hooks/api/pam/types/mssql-resource.ts New frontend type file for MSSQL resource and account; correctly references shared SQL types.

Last reviewed commit: 1098de0

@sheensantoscapadngan sheensantoscapadngan changed the title Feat/pam mssql feat: mssql pam Mar 12, 2026
@maidul98
Copy link
Copy Markdown
Collaborator

maidul98 commented Mar 13, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link
Copy Markdown
Contributor

@saifsmailbox98 saifsmailbox98 left a comment

Choose a reason for hiding this comment

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

Works great, just some comments. Tested with the following config hosted on https://www.cloudclusters.io

Microsoft SQL Server 2022 (RTM-CU2) (KB5023127) - 16.0.4015.1 (X64) 
	Feb 27 2023 15:40:01 
	Copyright (C) 2022 Microsoft Corporation
	Express Edition (64-bit) on Linux (Ubuntu 20.04.5 LTS) <X64>

@sheensantoscapadngan sheensantoscapadngan merged commit 77becca into main Mar 24, 2026
12 of 13 checks passed
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.

3 participants