Skip to content

Instantly share code, notes, and snippets.

View rbonestell's full-sized avatar
🤔
Cleverly arranging ones and zeros.

Bobby Bonestell rbonestell

🤔
Cleverly arranging ones and zeros.
View GitHub Profile
@rbonestell
rbonestell / create-local-ssl.sh
Created June 29, 2024 14:56
Create a self-signed SSL certificate for local development and testing
#!/bin/bash
# SSL certificates should have a validity period of less than 398 days
# * https://chromium.googlesource.com/chromium/src/+/master/net/docs/certificate_lifetimes.md
# * https://support.apple.com/en-us/102028
# Create Private Key
openssl genrsa -out key.pem 2048
# Create Certificate Signing Request
@rbonestell
rbonestell / redact.ts
Last active February 7, 2024 18:13
JS/TS Redact Specific Fields From Object: Prototype Pollution?
/* eslint-disable @typescript-eslint/no-explicit-any */
export function redactSpecifiedProperties(target: any, fields: string[], redactedMessage = 'REDACTED'): any {
// Return if target is not a redactable datatype or no redactable fields were provided
if (!target || typeof target !== 'object' || fields?.length === 0) {
return target;
}
// Iterate through all items in an array
if (Array.isArray(target)) {
return target.map(item => redactSpecifiedProperties(item, fields, redactedMessage));