HIGH missing tlsfeathersjsfirestore

Missing Tls in Feathersjs with Firestore

Missing Tls in Feathersjs with Firestore — how this specific combination creates or exposes the vulnerability

FeathersJS is a framework for real-time APIs that often integrates with Google Cloud Firestore as a datastore. When TLS is not enforced between the FeathersJS service and Firestore, the connection can be established without encryption. This misconfiguration exposes authentication credentials, tokens, and query results to network observers through cleartext transmission.

Firestore requires secure gRPC or HTTPS endpoints. If the FeathersJS service initializes the Firestore client without enforcing TLS or uses an insecure HTTP endpoint, data in transit is not protected. An attacker positioned on the network path can intercept requests and responses, leading to sensitive data exposure, session hijacking, or tampering with database operations.

The risk is compounded in environments where services communicate across containers or virtual networks without mutual TLS. FeathersJS hooks that directly invoke Firestore methods—such as app.service('todos').find()—might unknowingly transmit data over unencrypted channels if the Firestore configuration does not mandate secure transport.

Because middleBrick tests the unauthenticated attack surface, it can detect missing TLS by identifying unencrypted endpoints or weak cipher suites in use. The scan checks encryption configurations and flags scenarios where Firestore connections lack required transport-layer protections, mapping findings to the Encryption security category.

In practice, this vulnerability resembles insecure configurations seen in services that prioritize rapid development over transport security. Real-world detections include services using HTTP instead of HTTPS, or custom gRPC channels without encryption enabled. Such issues are cataloged under the OWASP API Security Top 10 categories for sensitive data exposure and are relevant to compliance frameworks like PCI-DSS and GDPR.

Firestore-Specific Remediation in Feathersjs — concrete code fixes

To remediate missing TLS in a FeathersJS application using Firestore, ensure the Firestore client is initialized with secure settings and that all service communications enforce encrypted transport. Below are concrete code examples demonstrating secure configurations.

First, initialize Firestore with explicit TLS settings. Use the official Google Cloud client library and provide the project configuration with secure transport enforced. The following example shows a secure initialization in a FeathersJS service file:

const { Firestore } = require('@google-cloud/firestore');

const firestore = new Firestore({
  projectId: process.env.GCLOUD_PROJECT,
  keyFilename: process.env.GOOGLE_APPLICATION_CREDENTIALS,
  sslCreds: undefined, // Use default secure channel with TLS
});

// Ensure TLS is used by validating the endpoint
console.log(firestore.settings.host); // Should be a secure HTTPS endpoint
module.exports = firestore;

Next, configure the FeathersJS service to use this secure Firestore instance. Define the service with proper authentication and ensure hooks do not bypass transport security:

const feathers = require('@feathersjs/feathers');
const express = require('@feathersjs/express');
const app = express(feathers());

// Secure Firestore initialization
const firestore = require('./firestore-client');

app.configure(express.rest());
app.configure(express.socketio());

app.use('/todos', {
  async find(params) {
    const snapshot = await firestore.collection('todos').get();
    return snapshot.docs.map(doc => ({ id: doc.id, ...doc.data() }));
  },
  async create(data, params) {
    const docRef = await firestore.collection('todos').add(data);
    return { id: docRef.id, ...data };
  },
});

// Enforce secure hooks
app.service('todos').hooks({
  before: {
    all: [ /* authentication hook */ ],
    find: [],
    get: [],
    create: [],
    update: [],
    patch: [],
    remove: [],
  },
});

module.exports = app;

For environments using service accounts, ensure credentials are stored securely and that the client enforces secure endpoints. The Firestore client library automatically uses TLS when initialized with standard Google Cloud credentials. Avoid overriding default settings unless necessary for specific secure proxy configurations.

Additionally, validate that any custom gRPC channels or proxy setups maintain encryption. If using a proxy, ensure it terminates TLS securely and that FeathersJS communicates with it over HTTPS. The middleBrick CLI can be used to verify these configurations by scanning the API and reporting on encryption status as part of the Encryption check.

Regularly review Firestore IAM policies and ensure that service accounts have minimal required permissions. Combine this with secure transport configurations to reduce the attack surface. The Pro plan of middleBrick supports continuous monitoring, which can alert you to configuration changes that might reintroduce missing TLS risks.

Related CWEs: encryption

CWE IDNameSeverity
CWE-319Cleartext Transmission of Sensitive Information HIGH
CWE-295Improper Certificate Validation HIGH
CWE-326Inadequate Encryption Strength HIGH
CWE-327Use of a Broken or Risky Cryptographic Algorithm HIGH
CWE-328Use of Weak Hash HIGH
CWE-330Use of Insufficiently Random Values HIGH
CWE-338Use of Cryptographically Weak PRNG MEDIUM
CWE-693Protection Mechanism Failure MEDIUM
CWE-757Selection of Less-Secure Algorithm During Negotiation HIGH
CWE-261Weak Encoding for Password HIGH

Frequently Asked Questions

How does middleBrick detect missing TLS in FeathersJS applications using Firestore?
middleBrick scans the unauthenticated attack surface and checks encryption configurations. It identifies whether Firestore connections use secure transport and flags cleart HTTP endpoints or weak cipher suites under the Encryption category.
Can the GitHub Action enforce TLS compliance for Firestore integrations in CI/CD pipelines?
Yes, by adding the middleBrick GitHub Action to your workflow, you can fail builds if the security score drops below a threshold. This helps ensure that TLS-related issues are caught before deployment.