diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index dd84ea7..ab0838c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,38 +1,31 @@ --- name: Bug report -about: Create a report to help us improve +about: Report a functional PowerShell-script bug using synthetic, redacted examples title: '' labels: '' assignees: '' - --- -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error +**Security vulnerabilities** +Do not disclose vulnerability details, credentials or private reports here. +Follow [SECURITY.md](https://github.com/SecopsEngineer/PowerShell/security/policy) +for private reporting and the details-free fallback if that channel is unavailable. -**Expected behavior** -A clear and concise description of what you expected to happen. +**Affected script and commit** +Script path and the exact commit SHA you ran. -**Screenshots** -If applicable, add screenshots to help explain your problem. +**Environment** +- Operating system: +- PowerShell version and edition: +- Relevant module names and versions: -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] +**What happened?** +Describe expected and observed behavior. -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] +**Minimal reproduction** +Include the command and minimal synthetic input. Replace real identities, hosts, +tenants and organization data. Never include passwords, tokens, private keys, +browser histories or unredacted screenshots/exports. -**Additional context** -Add any other context about the problem here. +**Error output** +Paste only the relevant redacted error and state whether it reproduces on main. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..238349c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: true +contact_links: + - name: Security vulnerability reporting + url: https://github.com/SecopsEngineer/PowerShell/security/policy + about: Read the private reporting policy; do not disclose vulnerability details in public issues. diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 2088f58..1bc8cf4 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -119,6 +119,12 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. +Contributor Covenant v2.0 is provided under Creative Commons Attribution 4.0 +International: https://creativecommons.org/licenses/by/4.0/legalcode. +This adaptation replaces the generic enforcement-contact placeholder with +repository-maintainer contact guidance. See [THIRD_PARTY.md](THIRD_PARTY.md) +for the historical upstream license reference. + Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a403483..32c386f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,3 +18,17 @@ any additional non-production integration validation and its limits in the PR. Preserve author/source attribution. Confirm redistribution terms before adding third-party code. Never include real report exports, browser history or secrets. + +## Vulnerability reports + +Follow [SECURITY.md](SECURITY.md) rather than opening a public vulnerability issue +or pull request. Public bug reports must use synthetic examples and redact private +data. Do not submit a test vulnerability simply to check the reporting button. + +## Source and license evidence + +For imported or adapted material, provide its source URL and immutable revision, +author/rights-holder notice, license or written permission, and a description of +local modifications. Update [THIRD_PARTY.md](THIRD_PARTY.md) and preserve required +texts in `LICENSES/`. Public availability is not evidence of permission to copy. +Do not add material with unclear terms or remove existing attribution. diff --git a/Get-BrowserHistory.ps1 b/Get-BrowserHistory.ps1 index 54034b7..f8bfda3 100644 --- a/Get-BrowserHistory.ps1 +++ b/Get-BrowserHistory.ps1 @@ -10,6 +10,12 @@ IE TypedURLs is not a complete history source and is no longer collected. -AsJob returns jobs; use Receive-Job -Wait -AutoRemoveJob to retrieve results/errors. .EXAMPLE .\Get-BrowserHistory.ps1 -ComputerName workstation01 -UserName alice -SearchTerm example.com +.NOTES +Historical regex-based source: @oregon-national-guard/cyberspace-operations, +oregon-national-guard/powershell Get-BrowserHistory.ps1. The current implementation +replaces that collection logic with SQLite snapshots. Historical source and the +complete upstream notice are preserved in THIRD_PARTY.md and +LICENSES/Oregon-National-Guard-LICENCE.txt, including its specific-script exception. #> [CmdletBinding()] param( diff --git a/GraphAPI-GuestUserStatus.ps1 b/GraphAPI-GuestUserStatus.ps1 index 4947a27..1ae4f7d 100644 --- a/GraphAPI-GuestUserStatus.ps1 +++ b/GraphAPI-GuestUserStatus.ps1 @@ -7,6 +7,11 @@ requires appropriate licensing and roles. NoAvailableRecord does NOT mean never signed in: data is limited by retention. API failures terminate the report. .EXAMPLE .\GraphAPI-GuestUserStatus.ps1 -TenantId TENANT-GUID -OutputPath .\guests.csv +.NOTES +Historical report source: Tony Redmond, Office365itpros, +ReportLastAccountSignIn-Mg.PS1. Upstream copyright (c) 2023 Tony Redmond, MIT. +This replacement changes connection handling, properties, output and error behavior. +See THIRD_PARTY.md and LICENSES/Office365itpros-MIT.txt for source and notice. #> [CmdletBinding()] param([Parameter(Mandatory)][string]$TenantId, [string]$OutputPath, [switch]$Force) diff --git a/LICENSES/Office365itpros-MIT.txt b/LICENSES/Office365itpros-MIT.txt new file mode 100644 index 0000000..ade18ca --- /dev/null +++ b/LICENSES/Office365itpros-MIT.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Tony Redmond + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LICENSES/Oregon-National-Guard-LICENCE.txt b/LICENSES/Oregon-National-Guard-LICENCE.txt new file mode 100644 index 0000000..3639b12 --- /dev/null +++ b/LICENSES/Oregon-National-Guard-LICENCE.txt @@ -0,0 +1,50 @@ +################################################################### + +License +------- +This Work was prepared by a United States Government employee and, +therefore, is excluded from copyright by Section 105 of the Copyright +Act of 1976. Copyright and Related Rights in the Work worldwide are +waived through the CC0 1.0 Universal license. Portions of specific +scripts are licensed under Microsoft Limited Public License. + +https://creativecommons.org/publicdomain/zero/1.0/ + +################################################################### + +Disclaimer of Warranty +---------------------- +This Work is provided "as is." Any express or implied warranties, +including but not limited to, the implied warranties of merchantability +and fitness for a particular purpose are disclaimed. In no event shall +the United States Government be liable for any direct, indirect, +incidental, special, exemplary or consequential damages (including, +but not limited to, procurement of substitute goods or services, +loss of use, data or profits, or business interruption) however caused +and on any theory of liability, whether in contract, strict liability, +or tort (including negligence or otherwise) arising in any way out of +the use of this Guidance, even if advised of the possibility of such damage. + +The User of this Work agrees to hold harmless and indemnify the +United States Government, its agents and employees from every claim or +liability (whether in tort or in contract), including attorneys' fees, +court costs, and expenses, arising in direct consequence of Recipient's +use of the item, including, but not limited to, claims or liabilities +made for injury to or death of personnel of User or third parties, damage +to or destruction of property of User or third parties, and infringement or +other violations of intellectual property or technical data rights. + +Nothing in this Work is intended to constitute an endorsement, explicit or implied, +by the United States Government of any particular manufacturer's product or service. + +################################################################### + +Disclaimer of Endorsement +------------------------- +Reference herein to any specific commercial product, process, +or service by trade name, trademark, manufacturer, or otherwise, +in this Work does not constitute an endorsement, recommendation, +or favoring by the United States Government and shall not be used +for advertising or product endorsement purposes. + +################################################################### diff --git a/README.md b/README.md index 0ca9189..d2c1fd3 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,18 @@ reported as an error rather than silently treated as "no users" or "no activity" - `-AsJob` returns job objects. Retrieve results and errors with `Receive-Job -Wait -AutoRemoveJob`. Remote hosts need sqlite3 installed themselves. +## Security reporting and licensing + +Report vulnerabilities through the private route described in [SECURITY.md](SECURITY.md). +Do not disclose vulnerability details or private exports in public issues. The +GitHub reporting feature must be enabled separately by the repository owner; +[maintainer setup](docs/Maintenance.md) explains how to verify it. + +The root [LICENSE](LICENSE) remains the Unlicense. Consult +[third-party provenance and notices](THIRD_PARTY.md) and [preserved license texts](LICENSES/) +for identified upstream material. The historical O365Reports permission question +is still open; the review does not claim all historical code has been cleared. + ## Validation and contribution Use Pester **5.7.1**, PSScriptAnalyzer **1.24.0**, and sqlite3 **>=3.33** on Windows. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..3309f18 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,57 @@ +# Security policy + +## Reporting a vulnerability + +Use GitHub private vulnerability reporting for this repository. Sign in, open +[Security -> Advisories](https://github.com/SecopsEngineer/PowerShell/security/advisories) +and select **Report a vulnerability** when that button is available. The form +sends a private report to the repository maintainers; submitting this file does +not itself enable the GitHub reporting feature. + +If the button is unavailable, do not put vulnerability details in an issue, +discussion, pull request, or commit. You may open a public issue titled +**Private reporting channel unavailable** containing only a request for the +maintainer to enable private reporting. Do not include affected script names, +impact, reproduction steps, exploit code, screenshots, or attachments in that +public request. Wait for a private reporting channel before sharing details. +No security email address is published by this policy. + +In the private report, include: + +- Affected script and commit SHA, and whether the issue reproduces on `main`. +- PowerShell, operating system and relevant module versions. +- Expected behavior, observed behavior and security impact. +- Minimal reproduction steps using synthetic accounts, tenant names and data. +- A proposed fix or workaround, if known. + +Do not attach real passwords, tokens, private keys, unredacted report exports, +browser histories or personal data. Redact sensitive command-line arguments and +identifiers. Test only in environments you own or are authorized to assess. + +## Maintained versions + +Security fixes target the latest `main` branch. Older commits, copied scripts, +forks and any future release branches are not automatically maintained or +backported. Include the exact commit in reports so maintainers can identify the +affected code. A passing test suite is not certification of a live environment. + +## Scope and handling + +Report vulnerabilities in this repository's scripts or documentation, including +unintended administrative changes, credential disclosure and unsafe handling of +untrusted input. Ordinary functional bugs with no security impact can use the +public bug-report template, with synthetic and redacted examples. + +Maintainers will assess reports and discuss mitigation and disclosure through +the private report. Response and remediation are best effort; this project does +not publish a service-level commitment or bug-bounty promise. Coordinate any +public disclosure with the maintainer rather than publishing a working exploit +in a public issue while a report is being assessed. + +## For the repository owner + +Enable **Private vulnerability reporting** under **Settings -> Advanced Security** +and confirm that **Report a vulnerability** appears on the Advisories page. +Keep security-alert notifications enabled for your account. See the +[maintenance guide](docs/Maintenance.md) for setup verification and the remaining +provenance work before a release. diff --git a/THIRD_PARTY.md b/THIRD_PARTY.md index 25f0f1d..1c8b116 100644 --- a/THIRD_PARTY.md +++ b/THIRD_PARTY.md @@ -1,16 +1,96 @@ -# Third-party provenance - -The previous `O365 Holds Enabled Mailboxes` file credited the O365Reports Team and -linked to https://o365reports.com/2021/06/29/export-office-365-mailbox-holds-report-using-powershell/. -It has been replaced by `Export-O365MailboxHolds.ps1`, a smaller implementation of -mailbox-property reporting with explicit retention-pause semantics. The old source -and credit remain in Git history. Its original redistribution terms have not been -verified; the repository license must not be taken as a relicensing of upstream -material or history. - -Other accumulated scripts may also have outside origins. Existing history and -attribution are preserved. Do not claim new ownership of upstream contributions. - -`CODE_OF_CONDUCT.md` retains its Contributor Covenant attribution. Pester, -PSScriptAnalyzer, SQLite and GitHub Actions are external dependencies under their -respective terms; no downloaded dependency binaries are committed here. +# Third-party provenance and notices + +Reviewed on **2026-10-30**, against repository `main` at +[`fd33296`](https://github.com/SecopsEngineer/PowerShell/commit/fd33296). +The repository's [LICENSE](LICENSE) remains the Unlicense. It does not erase +upstream authorship, replace third-party notices, or establish rights in code +owned by someone else. The existing license text has not been changed. + +## Review scope and findings + +The review scanned all 35 runnable root PowerShell scripts and repository +documentation for credits/source links, inspected Git history, and compared +identified historical sources with upstream examples. It was a focused provenance +review, not an exhaustive determination of every contributor's rights. A source +match is evidence of related code, not proof of an entire chain of ownership. + +| Material | Evidence | Action / status | +|---|---|---| +| Historical `GraphAPI-GuestUserStatus.ps1` | Same original report filename and substantial matching report/Graph flow in Tony Redmond's Office365itpros sample; upstream publishes MIT terms | Restore historical-source credit in the current replacement; preserve the upstream MIT copyright/permission notice | +| Historical `Get-BrowserHistory.ps1` | Matching function, help, helper names and collection/remoting implementation in Oregon National Guard's script | Restore historical-source credit; preserve its complete published notice, including the stated exception for specific scripts | +| Historical `O365 Holds Enabled Mailboxes` | Original file explicitly credits O365Reports Team and matches the upstream mailbox report | Source confirmed; an applicable redistribution grant remains unverified in the inspected files | +| `CODE_OF_CONDUCT.md` | Contributor Covenant v2.0 adaptation, adopted in 2021; historical upstream license is CC BY 4.0 | Retain version/source and Mozilla credit; add license link and identify local enforcement-contact modification | +| Other repository-authored/accumulated material | Repository history and existing credits | Preserve attribution; no additional upstream ownership conclusions made | + +## Office365itpros guest-sign-in report + +- Local historical source: [GraphAPI-GuestUserStatus.ps1 at 3f9d705](https://github.com/SecopsEngineer/PowerShell/blob/3f9d705/GraphAPI-GuestUserStatus.ps1). +- Matching upstream: [ReportLastAccountSignIn-Mg.PS1 at ed927ed](https://github.com/12Knocksinna/Office365itpros/blob/ed927ed0120b5ca5f47e506c145be81954c5cdd8/ReportLastAccountSignIn-Mg.PS1). +- Upstream notice: [MIT license at the same revision](https://github.com/12Knocksinna/Office365itpros/blob/ed927ed0120b5ca5f47e506c145be81954c5cdd8/LICENSE), copyright (c) 2023 Tony Redmond. +- Preserved text: [LICENSES/Office365itpros-MIT.txt](LICENSES/Office365itpros-MIT.txt). + +The current report was rewritten in the safety update. Historical source credit +and the MIT notice are retained conservatively rather than claiming that the +repository's Unlicense replaces upstream terms. Include the relevant notice when +redistributing related material. + +## Oregon National Guard browser-history script + +- Local historical source: [Get-BrowserHistory.ps1 at 7cdf449](https://github.com/SecopsEngineer/PowerShell/blob/7cdf449/Get-BrowserHistory.ps1). +- Matching upstream: [Get-BrowserHistory.ps1 at 4c75ca9](https://github.com/oregon-national-guard/powershell/blob/4c75ca914ba57b5e8b5ed6429fc91df7f26786fa/Get-BrowserHistory.ps1). +- Upstream author credit: `@oregon-national-guard/cyberspace-operations`. +- Upstream notice: [LICENCE at the same revision](https://github.com/oregon-national-guard/powershell/blob/4c75ca914ba57b5e8b5ed6429fc91df7f26786fa/LICENCE). +- Preserved text: [LICENSES/Oregon-National-Guard-LICENCE.txt](LICENSES/Oregon-National-Guard-LICENCE.txt). + +The published notice states a US-government-work/CC0 basis and also says portions +of specific scripts are under Microsoft Limited Public License. That exception is +preserved; this review does not resolve the terms of every reference or component +listed by the historical script. The current SQLite-based collector replaced the +old regex/database-text implementation; credit here describes historical source, +not an endorsement by the upstream authors of this repository's replacement. + +## O365Reports mailbox-hold script: unresolved permission + +- Local historical source: [O365 Holds Enabled Mailboxes at 0bd3369](https://github.com/SecopsEngineer/PowerShell/blob/0bd3369/O365%20Holds%20Enabled%20Mailboxes). +- Original credit: **O365Reports Team**. +- Original article: [Export Office 365 Mailbox Hold Report Using PowerShell](https://o365reports.com/2021/06/29/export-office-365-mailbox-holds-report-using-powershell/). +- Matching upstream script: [MailboxHoldReport.ps1 at a0770ed](https://github.com/admindroid-community/powershell-scripts/blob/a0770ed26804f912653004ca9e7edcf9b10d35a1/Export%20Mailbox%20Hold%20Details/MailboxHoldReport.ps1). +- Inspected companion [README at the same revision](https://github.com/admindroid-community/powershell-scripts/blob/a0770ed26804f912653004ca9e7edcf9b10d35a1/Export%20Mailbox%20Hold%20Details/README.md) and repository root listing. + +No explicit redistribution grant was found in that bounded inspection. This does +not prove that no permission exists. The maintainer must locate the applicable +terms or obtain written permission before claiming the historical code is cleared +for redistribution. Do not infer a grant from public visibility or free download. +The current `Export-O365MailboxHolds.ps1` is a replacement with the original credit +retained; historical copies remain in Git. No upstream contact, permission grant, +history rewrite, or retroactive relicensing is asserted by this review. + +## Contributor Covenant v2.0 + +[CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) is adapted from +[Contributor Covenant v2.0](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html). +The [historical upstream license](https://github.com/EthicalSource/contributor_covenant/blob/519ee05a2a6c888129d5318db60893a8238f5c96/LICENSE.md) +that predates its adoption here is **Creative Commons Attribution 4.0 +International**; see [the license text](https://creativecommons.org/licenses/by/4.0/legalcode). +The adaptation replaces the generic enforcement-contact placeholder with this +repository's maintainer contact guidance. Preserve the existing Contributor +Covenant and Mozilla enforcement-ladder attribution. Do not apply a newer +upstream website/software license to this older document without checking scope. + +## External dependencies and references + +Pester, PSScriptAnalyzer, SQLite, GitHub Actions and the administrative PowerShell +modules are external dependencies under their respective terms. Downloaded +binaries and administrative modules are not vendored in this checkout. Workflow +pins and hashes identify validation dependencies; they do not replace upstream +license terms. Links to Microsoft/API documentation are source references, not +claims that this repository owns the referenced documentation or services. + +## Adding or redistributing material + +For a third-party addition, record the original source, immutable revision, +author/rights-holder notice, applicable license or permission, local changes and +required accompanying notices. Add evidence here and preserve required text in +`LICENSES/` where appropriate. If the terms are unclear, resolve them before +copying the material. Do not label material public domain merely because the +repository root uses the Unlicense. See [maintenance follow-ups](docs/Maintenance.md). diff --git a/docs/Maintenance.md b/docs/Maintenance.md new file mode 100644 index 0000000..b4f8c76 --- /dev/null +++ b/docs/Maintenance.md @@ -0,0 +1,52 @@ +# Maintainer setup and release readiness + +## Enable the private reporting channel + +`SECURITY.md` documents GitHub private vulnerability reporting. Adding a policy +or merging a pull request does not enable the feature. + +1. Sign in as the repository owner and open + [repository security settings](https://github.com/SecopsEngineer/PowerShell/settings/security_analysis). +2. In **Advanced Security**, find **Private vulnerability reporting** and select + **Enable**. If the settings layout differs, follow + [GitHub's current instructions](https://docs.github.com/en/code-security/how-tos/report-and-fix-vulnerabilities/configure-vulnerability-reporting/configure-for-a-repository). +3. Open [Security -> Advisories](https://github.com/SecopsEngineer/PowerShell/security/advisories) + and confirm that **Report a vulnerability** is offered to a signed-in reporter. + Do not submit a real or test vulnerability simply to check the button. +4. Check your repository security-alert and account notification preferences. + +The connected GitHub integration used for the documentation work does not have +repository-administration access. Feature enablement must be performed by an +authenticated owner/admin, then verified in GitHub. Do not label it enabled based +only on the presence of this document. The policy provides a details-free public +fallback if the private button is missing. + +## Outstanding source-permission question + +The old `O365 Holds Enabled Mailboxes` file credited O365Reports Team. Matching +upstream code was located, but no explicit redistribution grant was found in the +inspected script, directory README or root file listing. This is a bounded +review finding, not a determination that permission does or does not exist. + +Before distributing historical source as part of a release, locate and retain +the applicable permission/license or obtain written permission from the rights +holder. Do not assume that free downloads or a publicly visible repository grant +redistribution rights. If permission cannot be established, determine the proper +distribution/remediation approach with the rights holder or qualified advice. +The current replacement does not remove historical copies from Git history. +No upstream contact, history rewrite or new relicensing was performed here. + +See [THIRD_PARTY.md](../THIRD_PARTY.md) for pinned evidence and notices. That file +also distinguishes confirmed matching source from unverified authorship claims. + +## Before the first tagged release + +- Validate the administrative and report workflows in a controlled environment, + recording PowerShell/module versions and the tested commit. Mock tests alone + do not validate live roles, API behavior or policy propagation. +- Complete the private-channel setup and remaining source-permission work. +- Run the existing repository checks and require both protected-branch jobs. +- Prepare a changelog and release notes describing compatibility changes, known + limits and included license/notice files, then choose a version deliberately. + +No tag or release is created by this documentation change.