Skip to content

Conversation

@AdaWorldAPI
Copy link

@AdaWorldAPI AdaWorldAPI commented Dec 16, 2025

Summary

  • Removed hardcoded credentials, added 4 secure credential methods
  • Added email validation (RFC-compliant) and URL safety validation
  • Added structured JSON logging with correlation IDs
  • Added failed recipients tracking to CSV
  • Created module manifest (v1.1.0)
  • Compressed images from 4.8MB to 90KB (98% reduction)

Test plan

  • Test credential prompt method
  • Test email validation with invalid addresses
  • Verify compressed images display correctly
  • Run Test-M365DigestConfig.ps1 validation

- CODE_REVIEW_AND_INTEGRATION_PLAN.md: Comprehensive analysis including:
  - Security vulnerabilities (hardcoded credentials, OAuth exposure)
  - Missing components (OAuth script was documented but never created)
  - Architectural weaknesses (legacy SMTP, no connection pooling)
  - Operational gaps (no logging, no metrics, no bounce handling)
  - Compliance issues (GDPR/CAN-SPAM gaps)
  - 10 expanded enhancement ideas with code examples
  - 12-week phased integration plan with priorities

- Send-M365Digest-OAuth.ps1: The missing OAuth authentication script that
  was referenced in documentation but never implemented. Includes:
  - OAuth2 client credentials flow
  - Secure credential loading options (env vars, Key Vault, encrypted files)
  - Configuration validation
  - Detailed setup instructions
## Security Improvements
- Removed all hardcoded credentials from Send-M365Digest-BasicAuth.ps1
- Added 4 secure credential methods: Prompt, Environment, CredentialManager, SecureFile
- URLs in templates are now validated (blocks javascript:, data:, vbscript:)
- Non-URL values are HTML-encoded to prevent XSS injection

## New Features - M365DigestEmailModule v1.1.0
- Test-EmailAddress: RFC-compliant email validation
- Test-UrlSafety: URL scheme validation (http/https only)
- Add-FailedRecipient: Tracks failed emails to CSV file
- Set-DigestLogConfig/Write-DigestLog: Structured JSON logging
- Campaign correlation IDs for tracing

## Module Manifest
- Created M365DigestEmailModule.psd1 with:
  - Version 1.1.0
  - PowerShell 5.1 minimum requirement
  - Exported functions list
  - Release notes and metadata

## Image Optimization
- Compressed PNG icons from 4.8MB to 90KB total (98% reduction)
  - m365_icon.png: 1.6MB -> 42KB
  - exchange_icon.png: 1.6MB -> 34KB
  - sharepoint_icon.png: 1.6MB -> 14KB
- Resized to 200x200 max (appropriate for email icons)

## Breaking Changes
- Send-HtmlEmail returns hashtable {Success, Error, Email} instead of boolean
- BasicAuth script requires -CredentialMethod parameter (defaults to 'Prompt')
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +56 to +59
$script:LogConfig.LogFilePath = $LogFilePath
$script:LogConfig.LogLevel = $LogLevel
$script:LogConfig.JsonFormat = $JsonFormat
$script:LogConfig.CorrelationId = $CorrelationId ?? [guid]::NewGuid().ToString('N').Substring(0, 8)

Choose a reason for hiding this comment

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

P1 Badge Replace PS7 null-coalescing with PS5-compatible logic

With PowerShell 5.1 (the module’s declared minimum), the line in Set-DigestLogConfig uses the PowerShell 7 ?? null-coalescing operator, which 5.1 cannot parse; this prevents the module from loading at all and causes any consuming script to fail before execution. Use an explicit null check instead of ?? to keep the code compatible with the required runtime.

Useful? React with 👍 / 👎.

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