Skip to content

Conversation

@arcoraven
Copy link
Contributor

@arcoraven arcoraven commented Jan 23, 2025

PR-Codex overview

This PR focuses on adding support for mTLS (Mutual TLS) configuration in the application, enhancing security for webhook interactions, and updating various related schemas and functions.

Detailed summary

  • Added mtlsCertificateEncrypted and mtlsPrivateKeyEncrypted fields to the configuration table.
  • Updated updateConfiguration to use Prisma.ConfigurationUpdateInput.
  • Modified webhook creation to handle mTLS certificate and private key.
  • Introduced generateSecretHmac256 for generating HMAC headers.
  • Updated environment variables to include custom HMAC authentication settings.
  • Refactored generateSignature and generateRequestHeaders for improved header generation.
  • Added tests for generateSecretHmac256 and generateRequestHeaders.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@socket-security
Copy link

socket-security bot commented Jan 23, 2025

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] environment, network 0 1.16 MB ronag

View full report↗︎

.update(signature, "utf8")
.digest("base64");

return [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file generates the custom HMAC auth header used by certain clients.

): Promise<WebhookResponse> => {
try {
const headers = await createWebhookRequestHeaders(webhook, body);
const config = await getConfig();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file has one exported function, sendWebhookRequest() which does these steps:

  • if mTLS is configured, attach the mTLS certificates
  • generate request headers
    • if custom HMAC is enabled via env vars, sign with the custom HMAC header
    • else use the previous signature pattern
  • call the webhook URL

@arcoraven arcoraven merged commit be8b644 into main Jan 25, 2025
6 checks passed
@arcoraven arcoraven deleted the ph/acceptCert branch January 25, 2025 03:47
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.

2 participants