Skip to content

Add lastPasswordChangeDateTime to risky users export #57

Add lastPasswordChangeDateTime to risky users export

Add lastPasswordChangeDateTime to risky users export #57

Workflow file for this run

name: Block Unauthorized Emails
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
email-scan:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Scan for unauthorized email addresses with filenames
run: |
echo "🔍 Scanning files for unauthorized emails..."
found=0
# Loop through all files (skip .git directory)
while IFS= read -r -d '' file; do
while IFS= read -r line; do
# Extract email addresses from the line
for email in $(echo "$line" | grep -Eo "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}"); do
if ! echo "$email" | grep -Eiq \
"^chadco@microsoft\.com$|^chad\.cox@microsoft\.com$|^authenticationStrength@odata\.context$|^admin@M365x437870\.onmicrosoft\.com$|@contoso\.com$|@([A-Za-z0-9.-]+\.)?chadcolabs\.us$"; then
echo "❌ Found unauthorized email in $file:"
echo " → $email"
found=1
fi
done
done < "$file"
done < <(find . -type f -not -path "./.git/*" -print0)
if [ "$found" -eq 1 ]; then
echo "🚫 Commit or PR contains unauthorized email addresses."
exit 1
else
echo "✅ All emails are from approved sources."
fi