-
Notifications
You must be signed in to change notification settings - Fork 125
Description
Summary
SecurityHelpers.psm1 uses Get-Date -Format 'yyyy-MM-dd HH:mm:ss' which produces a timestamp with no timezone information. Replace with Get-StandardTimestamp from CIHelpers.psm1 for consistent ISO 8601 UTC timestamps across all log outputs.
Current Behavior
The module generates timestamps using Get-Date -Format 'yyyy-MM-dd HH:mm:ss', which produces a local time string with no timezone indicator (e.g., 2025-01-15 10:30:00). This makes it impossible to determine the actual UTC time of the event.
Expected Behavior
The module uses Get-StandardTimestamp from CIHelpers.psm1, producing ISO 8601 UTC timestamps ending in Z (e.g., 2025-01-15T18:30:00.0000000Z).
Root Cause
The module was developed independently and chose a human-readable but timezone-ambiguous format. This predates the shared timestamp utility.
Files Requiring Changes
| File | Change |
|---|---|
scripts/security/Modules/SecurityHelpers.psm1 |
Replace Get-Date -Format 'yyyy-MM-dd HH:mm:ss' with Get-StandardTimestamp |
| Corresponding Pester test file | Update timestamp-related assertions |
Fix Guidance
- Verify
Get-StandardTimestampis available (requires Issue Add Get-StandardTimestamp utility to CIHelpers module #993 merged first). - Find
Get-Date -Format 'yyyy-MM-dd HH:mm:ss'usage and replace withGet-StandardTimestamp. - Ensure CIHelpers.psm1 is imported (add import if not present).
- Update any Pester tests that assert on timestamp format.
Depends on: #993 (Get-StandardTimestamp utility)
RPI Framework Starter Prompts
Phase 1: Research
Select Task Researcher from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Research timestamp standardization in
SecurityHelpers.psm1. Investigate: (1) Read the target module and find all timestamp usages (exact line numbers). (2) VerifyGet-StandardTimestampis available in CIHelpers.psm1 (from Issue #993). (3) Determine whether the module already imports CIHelpers.psm1 or needs an import added. (4) Check existing Pester tests for timestamp-related assertions that may need updating. (5) Identify any callers that depend on the current timestamp format (theyyyy-MM-dd HH:mm:ssstring). (6) Reviewcodecov.ymlpatch coverage requirements.
Phase 2: Plan
Select Task Planner from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Plan timestamp standardization for
SecurityHelpers.psm1using the research document. The plan should cover: (1) Replacing the timezone-ambiguous timestamp expression withGet-StandardTimestampcall. (2) Importing CIHelpers.psm1 if not already imported. (3) Updating Pester tests to verify the new ISO 8601 UTC timestamp format. (4) Checking any downstream consumers that may parse the old format. (5) Validation:npm run test:ps,npm run lint:ps.
Phase 3: Implement
Select Task Implementor from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Implement timestamp standardization for
SecurityHelpers.psm1following the plan. Steps: (1) ReplaceGet-Date -Format 'yyyy-MM-dd HH:mm:ss'withGet-StandardTimestampat the identified line numbers. (2) Add CIHelpers.psm1 import if needed. (3) Update Pester test assertions for timestamp format. (4) Runnpm run lint:psandnpm run test:ps. (5) Verify the security JSON output contains a standardized UTC ISO 8601 timestamp.
Phase 4: Review
Select Task Reviewer from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:
Review timestamp standardization for
SecurityHelpers.psm1. Verify: (1) The timezone-ambiguous timestamp expression is replaced withGet-StandardTimestamp. (2) CIHelpers.psm1 is imported if it wasn't already. (3) Output timestamps are ISO 8601 UTC ending inZ. (4) No other logic was changed. (5) Pester tests updated and passing. (6)npm run lint:psclean.
References
scripts/security/Modules/SecurityHelpers.psm1— target modulescripts/lib/Modules/CIHelpers.psm1—Get-StandardTimestampsource- Depends on: Add Get-StandardTimestamp utility to CIHelpers module #993