You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/bin/bash
# gitguardian-scan.sh
# Colorsforoutput(optional)BLUE='\033[0;34m'NC='\033[0m' # NoColor
# FunctiontodetectplatformandprovideappropriateDockerparameterdetect_platform(){localosarchos=$(uname-s)arch=$(uname-m)
# Debugmessagesgotostderrecho-e"${BLUE}Detecting platform: ${os} ${arch}${NC}">&2localplatform_arg=""if["$os"="Darwin"]&&["$arch"="arm64"];thenecho-e"${BLUE}Detected ARM-based Mac${NC}">&2platform_arg="--platform=linux/amd64"elif["$os"="Linux"];thenecho-e"${BLUE}Detected Linux system${NC}">&2elif[["$os"==*"MINGW"*]]||[["$os"==*"MSYS"*]]||[["$os"==*"CYGWIN"*]];thenecho-e"${BLUE}Detected Windows system${NC}">&2elseecho-e"${BLUE}Detected system: ${os} ${arch}${NC}">&2fiecho"$platform_arg"}
# GetAPIkeyfromSecretManagerifnotprovidedif[-z"$GITGUARDIAN_API_KEY"];thenecho"Retrieving API key from Secret Manager..."GITGUARDIAN_API_KEY=$(gcloudsecretsversionsaccesslatest--secret=gitguardian-api-key)if[-z"$GITGUARDIAN_API_KEY"];thenecho"Failed to retrieve API key!"exit1fifi
# DefaulttoscanningeverythingifnodirectoryspecifiedSCAN_DIRS=("${@:-.}")DIRS_TO_SCAN=""fordirin"${SCAN_DIRS[@]}";do
# Appendwithoutleadingextraspaceifemptyif[-z"$DIRS_TO_SCAN"];thenDIRS_TO_SCAN="/src/$dir"elseDIRS_TO_SCAN="$DIRS_TO_SCAN /src/$dir"fidone
# DetermineadditionalDockerparametersbasedonplatform(trimanyextrawhitespace)DOCKER_PLATFORM=$(detect_platform|xargs)
# Checkif.gitguardian.yamlisfoundinthecontainermount(at/src)if[-f"$(pwd)/.gitguardian.yaml"];thenecho"Found .gitguardian.yaml at /src/.gitguardian.yaml"elseecho"WARNING: .gitguardian.yaml not found at /src/.gitguardian.yaml"fi
# Runthescan using theofficialDockerHubimagedockerrun--rm \
"$DOCKER_PLATFORM" \
-v"$(pwd):/src" \
-eGITGUARDIAN_API_KEY="$GITGUARDIAN_API_KEY" \
gitguardian/ggshield:latest \
ggshieldsecretscanpath \
"--recursive""-y" \
"--exclude""**/.pnpm-store/**" \
"--exclude""**/.pnpm-store" \
"--exclude"".pnpm-store/**" \
"--exclude"".pnpm-store" \
"--exclude" "**/node_modules/**" \ "--exclude" "**/node_modules"\
"--exclude""node_modules/**" \
"--exclude""node_modules" \
"--exclude" "**/dist/**" \ "--exclude" "**/dist"\
"--exclude""dist/**" \
"--exclude""dist" \
"--exclude" "**/build/**" \ "--exclude" "**/build"\
"--exclude""build/**" \
"--exclude""build" \
"--verbose" \
"$DIRS_TO_SCAN"exit$?
I've tried many variations but .pnpm-store (full of big log files) keeps getting scanned and nearly crashes my scan. It makes the scan untenable. Project root located .gitguardian.yaml:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've tried many variations but .pnpm-store (full of big log files) keeps getting scanned and nearly crashes my scan. It makes the scan untenable. Project root located .gitguardian.yaml:
A sample of my huge printout:
Starting scan
Skipped file:///src/.pnpm-store/v10/files/fa/fa48d2a0e5655fd263a13e58ea4397b6d127afa0de04e1616055baa2e264a8ad7c82f634b0ae5f1e470f4305a0d95f9080a761f1e4e9b792a61e85ef57c8fc: content is over 1,048,576 bytes
Skipped file:///src/.pnpm-store/v10/files/d2/a8199ab835449049deb766340444a5ff8bf6decc38f86ef58362de079c54ac3ff1a2c6708f58303ca47908e7e90176e351448c56a6968130753a5879b82da7: can't detect encoding
Warning: Rate-limit hit, retrying in 55 seconds
Skipped file:///src/.pnpm-store/v10/files/60/332e0cbb3ad5f650562b0df9ef055e9a1ad5c2884ec839f5261675b59c405379eb1915ef292f62d898e9ea976338f90f6ec67f4745224094ddeeafd9fd840b: can't detect encoding
Skipped file:///src/.pnpm-store/v10/files/96/5fe0c76aa794f4ec543186a70f5c724a051683feb8e40f644fc6cbe5e375f2d11c7061af761be5a5c6c9891af9bf90fe4f948b7a2256330cd103a96aa5467b: content is over 1,048,576 bytes
Skipped file:///src/.pnpm-store/v10/files/b4/009905710fca6de239450306893480d8c5cb6ee11ade8a53602b64a057c70176a833bd3a81c8dc5bfe58d1837f57b89eb815fe247a2d81cbc4915f6f8dd0d9: can't detect encoding
Beta Was this translation helpful? Give feedback.
All reactions