fix(scripts): standardize timestamp in SecurityHelpers.psm1 to use Get-StandardTimestamp#1284
Conversation
…t-StandardTimestamp Replace all three Get-Date -Format "yyyy-MM-dd HH:mm:ss" instances with Get-StandardTimestamp from CIHelpers.psm1 for consistent ISO 8601 UTC timestamps. Update Pester test assertions for the new format. Fixes #1000
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1284 +/- ##
==========================================
- Coverage 87.63% 87.62% -0.02%
==========================================
Files 61 61
Lines 9328 9328
==========================================
- Hits 8175 8174 -1
- Misses 1153 1154 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Review Overview
This PR correctly addresses issue #1000 by replacing all three timezone-ambiguous Get-Date -Format 'yyyy-MM-dd HH:mm:ss' calls in SecurityHelpers.psm1 with Get-StandardTimestamp, and updating the corresponding Pester assertions to expect ISO 8601 UTC format. The implementation is clean, minimal, and well-scoped.
One inline suggestion is noted; no blocking issues were found.
Issue Alignment ✅
The changes precisely address all requirements from issue #1000:
- All three
Get-Dateusages replaced withGet-StandardTimestamp(lines 76, 179, 231 ofSecurityHelpers.psm1) CIHelpers.psm1import was already present — no new import needed, correctly noted in the PR description- All three corresponding Pester assertions updated to the new ISO 8601 UTC format
- No scope creep detected
PR Template Compliance ✅
- Description is clear and detailed, enumerating each of the three replaced call sites
Fixes #1000issue reference is present and valid- Checked type-of-change boxes (
Bug fix,Security configuration,Script/automation) accurately reflect the changed files - Testing section documents all verification steps including lint and test pass results
- All required checklist items are checked
Coding Standards ⚠️
Pre-existing (not introduced by this PR): SecurityHelpers.Tests.ps1 has the copyright header at lines 1–3 with #Requires -Modules Pester at line 5. Per pester-testing.instructions.md, the #Requires -Modules Pester directive must come before the copyright header. This convention violation pre-dates this PR and is out of scope here, but should be corrected in a follow-up.
Code Quality 💡
One inline suggestion filed on SecurityHelpers.Tests.ps1 line 241:
The Write-SecurityReport JSON timestamp assertion uses .*Z$ (any characters before Z), while the other two updated assertions — for Write-SecurityLog output and New-SecurityIssue.Timestamp — both use \.\d+Z$ to explicitly match the fractional-seconds component. Aligning all three assertions improves test precision and prevents false positives on malformed but Z-terminated strings.
No other quality concerns found. The three replacements in SecurityHelpers.psm1 are consistent and idiomatic. The ConvertTo-Json / ConvertFrom-Json round-trip in the JSON report test, and the use of .ToString('o') to recover a comparable string from the deserialized DateTime, are both correct for PowerShell 7.
Action Items
- Optional (suggested): Tighten the
Write-SecurityReportJSON timestamp regex from.*Z$to\.\d+Z$— see inline comment on line 241 ofSecurityHelpers.Tests.ps1 - Follow-up (out of scope for this PR): Correct the
#Requires -Modules Pesterheader ordering inSecurityHelpers.Tests.ps1perpester-testing.instructions.md
WilliamBerryiii
left a comment
There was a problem hiding this comment.
Approved, but please address the regex issue from GH-actions bot.
Remove .ToString('o') call on ConvertFrom-Json output (no-op on string
values) and tighten regex from .*Z to \.\d+Z to match the pattern used
by other timestamp assertions in the same file (lines 20 and 146).
## Pre-Release 3.3.101 ### ✨ Features - add removed maturity tier and retire owasp-docker (#1444) - add evaluation dataset creator (#1279) - align RAI planner with guide, remove scoring, improve UX (#1287) - add PSGallery staleness check and BOM cleanup (#1379) - ISA-95 network planner agent (#1177) - auto-generate collection.md with maturity filtering (#1316) - add folder-consistency check and standardize WARN outp… (#1350) - add synth-data-generate prompt to data-science collection (#1419) - add canonical deck workflow and customer-card rendering for design thinking (#1413) - add Figma MCP integration for DT artifact export (#1222) - introduce `owasp-docker` (#1245) - replace hve-core-specific references with portable discovery-based language (#1335) - introduce `owasp-cicd` (#1246) - add secure-by-design knowledge skill (#1223) - introduce `owasp-infrastructure` (#1244) - introduce `owasp-mcp` (#1207) - add OutputPath parameter to Invoke-LinkLanguageCheck.ps1 (#1229) - add -OutputPath parameter to Validate-SkillStructure.ps1 (#1225) - add maintainer-only skip-review label guard (#1293) - add extension collections overview and integrate into getting started flow (#950) - add agentic workflows for automated issue triage, implementation, PR review, dependency review, and doc-staleness detection (#1219) - consolidate package-lock.json version sync into Update-VersionFiles.ps1 (#1240) - add standards code review agent and full review orchestrator (#1174) - standardize pytest-mock as Python mocking framework (#1170) - add Jira backlog workflows and Jira/GitLab skills (#978) - add centralized version bump script and supply-chain attestation (#1183) ### 🐛 Bug Fixes - pin PowerShell-Yaml to 0.4.7 across all install sites (#1378) - close fork-PR/workflow-file-PR secret-strip gap and normalize upload-artifact version (#1421) - replace stream-based lookahead with array indexing in list-changed-files.sh (#1376) - centralize ISO 8601 timestamp regex in CIHelpers (#1343) - update stale documentation date in release-process.md (#1363) - pin basic-ftp to 5.3.0 to resolve GHSA-rp42-5vxx-qpwr (#1374) - add bot filter to dependency PR review workflow (#1362) - resolve pip-audit findings in powerpoint, gitlab, and jira skill lock files (#1360) - standardize Timestamp JSON key casing across all lint result files (#1314) - add synchronize trigger to PR Review workflow (#1323) - standardize timestamp in Validate-SkillStructure.ps1 to use Get-StandardTimestamp (#1280) - add parallel subagent dispatch and structured JSON contracts to code-review-full (#1304) - standardize timestamp in SecurityHelpers.psm1 to use Get-StandardTimestamp (#1284) - standardize timestamps in Test-DependencyPinning.ps1 and SecurityClasses.psm1 (#1282) - derive collection artifact counts from YAML at build time (#1275) - standardize timestamp in FrontmatterValidation.psm1 to use Get-StandardTimestamp (#1285) - standardize timestamp in Markdown-Link-Check.ps1 to use Get-StandardTimestamp (#1283) - escape hyphens in Mermaid diagram on Collections page (#1262) - add summary timestamp to PSScriptAnalyzer output (#1211) - fix plugin compatibility and robustness for coding-standards code review agents (#1289) - standardize timestamp in Test-CopyrightHeaders.ps1 to use Get-StandardTimestamp (#1278) - standardize timestamp in Invoke-YamlLint.ps1 to use Get-StandardTimestamp (#1270) - standardize timestamp in Invoke-LinkLanguageCheck.ps1 to use Get-StandardTimestamp (#1264) - fix dependency-review path filters and sparse-checkout cone mode (#1259) - replace invalid bare tool names with official tool identifiers (#1198) - fix broken links and remove orphaned reference in code review docs (#1257) - exclude Python env dirs from skill validation warnings (#1255) - pin happy-dom and serialize-javascript to resolve Dependabot vulnerabilities (#1253) - remove Mermaid diagram and add missing collection cards (#1247) - disable MCP servers by default to prevent token limit errors (#1144) - sync package-lock.json after pre-release version bump (#1236) - separate mermaid node declarations and add dynamic diagram generation with tests (#1215) - replace anchor links in meeting-analyst with bold text references (#1201) - remove recursive symlinks in jira and gitlab skill directories (#1233) - validate-installation scripts now check .github/skills directory (#1010) (#1206) - resolve npm audit vulnerabilities via dependency overrides (#1200) - add post-release triggers to scorecard workflow (#1186) - add missing .md extensions to relative links in agent documentation (#1180) ### 📚 Documentation - broaden Security Review description beyond OWASP (#1385) - document maintainer advisory mode and skip-review label guard (#1386) - document ExcludePaths/OutputPath for Invoke-LinkLanguageCheck (#1383) - CLI getting-started: clarify plugin install commands as alternatives (-all vs base) (#1251) ### ♻️ Refactoring - align agent and prompt folder names to collection identifier (#1210) ### 🔧 Maintenance - pin PSScriptAnalyzer to 1.25.0 and sync stale workflow version comments (#1389) - bump lxml from 6.0.2 to 6.1.0 in /.github/skills/experimental/powerpoint (#1424) - bump @vscode/vsce from 3.7.1 to 3.9.1 in the npm-dependencies group (#1390) - bump the github-actions group across 1 directory with 7 updates (#1391) - bump follow-redirects from 1.15.11 to 1.16.0 in /docs/docusaurus (#1356) - upgrade Node.js from 20 to 24 and bump cspell to v10 (#1353) - bump basic-ftp from 5.2.0 to 5.2.1 (#1324) - update github/gh-aw-actions requirement to 536ea1bad8c6715d098a9dc1afea8d403733acfe in the github-actions group across 1 directory (#1298) - update security instruction attributions and compliance (#1294) - bump the npm-dependencies group with 2 updates (#1297) - pre-release 3.3.41 (#1252) - streamline RAI Planner phase structure and documentation (#1273) - bump happy-dom from 20.8.8 to 20.8.9 in /docs/docusaurus (#1237) - pre-release 3.3.27 (#1191) - bump pygments from 2.19.2 to 2.20.0 in /.github/skills/gitlab/gitlab (#1234) - bump path-to-regexp from 0.1.12 to 0.1.13 in /docs/docusaurus (#1226) - bump the github-actions group with 4 updates (#1231) - add missing folders and alphabetize location lists (#1193) - bump brace-expansion (#1224) - bump handlebars from 4.7.8 to 4.7.9 in /docs/docusaurus (#1217) - bump brace-expansion from 5.0.3 to 5.0.5 in /docs/docusaurus (#1213) - pre-release 3.3.10 (#1187) - bump markdownlint-cli2 from 0.21.0 to 0.22.0 in the npm-dependencies group (#1175) - bump the github-actions group with 3 updates (#1176) - pre-release 3.3.1 (#1165) --- *Managed automatically by pre-release workflow.* Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Pull Request
Description
Replaced all three instances of
Get-Date -Format 'yyyy-MM-dd HH:mm:ss'(timezone-ambiguous timestamps) inSecurityHelpers.psm1withGet-StandardTimestampfromCIHelpers.psm1:Write-SecurityLog(line 76): Log entry timestamp in console output.New-SecurityIssue(line 179):Timestampfield on security issue objects.Write-SecurityReport(line 231):Timestampfield in JSON report output.CIHelpers.psm1was already imported at line 13, so no additional import was needed. Updated three Pester test assertions to match the new ISO 8601 UTC format.Related Issue(s)
Fixes #1000
Type of Change
Select all that apply:
Code & Documentation:
Infrastructure & Configuration:
AI Artifacts:
prompt-builderagent and addressed all feedback.github/instructions/*.instructions.md).github/prompts/*.prompt.md).github/agents/*.agent.md).github/skills/*/SKILL.md)Other:
.ps1,.sh,.py)Testing
Get-Date -Format 'yyyy-MM-dd HH:mm:ss'replaced withGet-StandardTimestamp.npm run lint:pspassed.npm run test:pspassed (81 tests for this file).Checklist
Required Checks
Required Automated Checks
The following validation commands must pass before merging:
npm run lint:mdnpm run spell-checknpm run lint:frontmatternpm run validate:skillsnpm run lint:md-linksnpm run lint:psnpm run plugin:generateSecurity Considerations
Additional Notes
This is part of the timestamp standardization series (issues #994-#1002). The prerequisite
Get-StandardTimestampfunction was merged in #993.CIHelpers.psm1was already imported by this module, so the changes are direct expression swaps with no import changes required.Note: the old
yyyy-MM-dd HH:mm:ssformat had no timezone indicator, making it impossible to determine UTC time. The new format includes explicitZsuffix for UTC.