diff --git a/ACCESSIBILITY.md b/ACCESSIBILITY.md index 668db27..878418e 100644 --- a/ACCESSIBILITY.md +++ b/ACCESSIBILITY.md @@ -32,7 +32,7 @@ No module claims a WCAG conformance level. Colours that an app's theme sets are ## Supported environments The PowerShell Universal versions and browsers under -[Requirements](https://powershell-universal-components.eize.dev/#requirements). +[Compatibility](https://powershell-universal-components.eize.dev/compatibility/). ## Known limitations diff --git a/README.md b/README.md index f3e419e..a31071e 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ License: MIT

-**[Documentation](https://powershell-universal-components.eize.dev/)** · [Getting started](https://powershell-universal-components.eize.dev/getting-started/) · [Requirements](https://powershell-universal-components.eize.dev/#requirements) · [Releases](https://github.com/eizedev/powershell-universal-components/releases) +**[Documentation](https://powershell-universal-components.eize.dev/)** · [Getting started](https://powershell-universal-components.eize.dev/getting-started/) · [Compatibility](https://powershell-universal-components.eize.dev/compatibility/) · [Releases](https://github.com/eizedev/powershell-universal-components/releases) > [!NOTE] > The modules are 0.x. A minor release can break things, so read the module's `CHANGELOG.md` before diff --git a/SECURITY.md b/SECURITY.md index 941dec6..a4a23e8 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -4,18 +4,13 @@ The PowerShell modules and JavaScript bundles in this repository, the demo modules included. -The modules treat these as untrusted: - -- the data (`-Data`): the components show its values as text and never run them as HTML or code -- what comes back from the browser: a view from a link, the address bar or a save, and `$EventData` - (which the app checks as well) -- view files, from `-TemplatePath` or a template store -- a file a reader loads into a pivot report (`-AllowImport`) -- the request headers the pivot module takes the origin of a view file's `$schema` from +The modules treat as untrusted: the data, what comes back from the browser (views and `$EventData`), +view files, a reader's own files and request headers. The full list, what runs where and which +requests the modules make: [Security](https://powershell-universal-components.eize.dev/security/). Report a way to: -- run script in the browser, or PowerShell on the server, from any of them +- run script in the browser, or PowerShell on the server, from any untrusted input - make a template store read or write outside its folder - make an exported or downloaded file (CSV, XLSX, HTML report, SVG) dangerous to open - leak a request, header or token into an error, `$Error`, a log line or an event diff --git a/docs/compatibility.md b/docs/compatibility.md new file mode 100644 index 0000000..51874f7 --- /dev/null +++ b/docs/compatibility.md @@ -0,0 +1,23 @@ +--- +title: Compatibility +description: Which versions of PowerShell Universal and PowerShell and which browsers the modules work with, and how each was tested. +--- + +# Compatibility + +What the modules work with, and how that was tested. A version not named here may work, but nobody +has checked it. + +| Works with | Supported | Tested with | How | +| --- | --- | --- | --- | +| PowerShell Universal | 2026.2 and 2026.3 | 2026.2.5 and 2026.3.4 | by hand on PSU test instances, in a browser, before a change to a component is done ([Development](development/index.md#browser-tests-on-psu)) | +| PowerShell | 7.4 or later, in the PSU environment the app runs in | the PowerShell 7 of GitHub's runner, not pinned; 7.4 itself is not tested | Pester tests on every pull request, and each built component module loaded in a new process | +| Browsers | desktop browsers built on Chromium, Firefox and WebKit | Chromium, Firefox and WebKit, the engine of Safari | Playwright: the components on this site on every pull request, the showcase apps on PSU by hand | +| pivotkit's command line, for `Invoke-UDPivotReport -Engine Node` | what [Two engines](pivot/reports.md#two-engines) names | pivotkit-cli 0.5.0 and 0.6.0 | the pivot module's opt-in tests against the real command line ([Development](development/index.md#report-command-against-the-real-pivotkit)) | + +Not tested: the Safari app, iOS and Android browsers. Windows PowerShell 5.1 does not load the +modules. + +The lowest supported versions of PowerShell Universal and PowerShell are public interface: raising +one is a breaking change ([Versioning](versioning.md#what-is-public-interface)). What a pivot feature +needs from a pivotkit-server is on its page, such as [Rows from a server](pivot/server-rows.md). diff --git a/docs/index.md b/docs/index.md index fc51d02..6390ce8 100644 --- a/docs/index.md +++ b/docs/index.md @@ -84,10 +84,8 @@ New-UDPivotReport -Id 'python' -Data (Invoke-RestMethod 'https://endoflife.date/ ## Requirements -- PowerShell Universal 2026.2 or 2026.3, with PowerShell 7.4 or later. -- Tested on PowerShell Universal 2026.2.5 and 2026.3.4. -- `Invoke-UDPivotReport -Engine Node` tested with pivotkit-cli 0.5.0 and 0.6.0 ([what it needs](pivot/reports.md#two-engines)). -- Tested in Chromium, Firefox and WebKit, the engine of Safari. The Safari app and iOS are not tested. +PowerShell Universal 2026.2 or 2026.3 with PowerShell 7.4 or later, and a desktop browser built on +Chromium, Firefox or WebKit (Safari). What was tested and how: [Compatibility](compatibility.md). ## Questions and stability diff --git a/docs/security.md b/docs/security.md new file mode 100644 index 0000000..ddb9a30 --- /dev/null +++ b/docs/security.md @@ -0,0 +1,53 @@ +--- +title: Security +description: What runs on the PowerShell Universal server and what in the browser, what the modules treat as untrusted, and which network requests they make; with links to each module's security notes. +--- + +# Security + +For app authors and PSU admins who decide what an app may show and do. Each module's page has the +details; how to report a vulnerability is in +[SECURITY.md](https://github.com/eizedev/powershell-universal-components/blob/HEAD/SECURITY.md). + +## What runs where + +| Where | What | +| --- | --- | +| PSU server, in the app's PowerShell | the module's commands: they convert the data, read files the app names (themes, view files, template stores) and return what PSU sends to the browser | +| Browser | the module's JavaScript bundle, served by PSU: it draws the component, filters, exports and copies from the rows it got | + +Every row in `-Data` reaches the browser, with every column. Select what a reader may see first +(`Select-Object`, the SQL query). The bundles bring their libraries along and load no code from +elsewhere. + +## What the modules treat as untrusted + +- the data (`-Data`): the components show its values as text and never run them as HTML or code +- what comes back from the browser: a view from a link, the address bar or a save, and `$EventData` + (which the app checks as well) +- view files, from `-TemplatePath` or a template store +- a file a reader loads into a pivot report (`-AllowImport`) +- the request headers the pivot module takes the origin of a view file's `$schema` from + +What the modules trust because it comes from the app author, such as `-Options` or a theme, and +what is not a vulnerability by design: +[SECURITY.md](https://github.com/eizedev/powershell-universal-components/blob/HEAD/SECURITY.md#scope). + +## Network requests + +- **ECharts** makes none: neither its commands nor its bundle request anything. +- **Perspective** makes none, except the base map tiles of the map charts a reader can pick in the + editor, which the browser loads from map tile servers + ([Security notes](perspective/events.md#security-notes)). +- **Pivot** makes requests from the PSU server only, to addresses the app's script names: a + `-Schema` address, a pivotkit-server and its token endpoint + ([Network requests](pivot/events.md#network-requests)). +- **The showcase apps**, from the PSU server: the ECharts showcase's Public data page calls five public + web services ([ECharts showcase](demo.md)); the Pivot showcase only when its Live data switch is on + ([Pivot showcase](pivot/demo.md#public-data-offline-or-live)). + +## Each module + +- [ECharts: security and limits](echarts/security.md) +- [Perspective: events, security and limits](perspective/events.md#security-notes) +- [Pivot: events, security and limits](pivot/events.md#security-notes) diff --git a/docs/versioning.md b/docs/versioning.md index 673bab5..7296a4e 100644 --- a/docs/versioning.md +++ b/docs/versioning.md @@ -50,7 +50,7 @@ These are the parts a break can hit: `Get-UDElement`. - Environment variables, such as `PSU_COMPONENT_PIVOT_SCHEMA_URL`. - The addresses of the showcase apps' pages where the docs name them. -- The lowest supported versions of PowerShell Universal and PowerShell ([requirements](index.md#requirements)). +- The lowest supported versions of PowerShell Universal and PowerShell ([compatibility](compatibility.md)). These are not public interface and can change in any release: diff --git a/modules/PowerShellUniversal.Component.ECharts/README.md b/modules/PowerShellUniversal.Component.ECharts/README.md index 3bae985..fbc28d7 100644 --- a/modules/PowerShellUniversal.Component.ECharts/README.md +++ b/modules/PowerShellUniversal.Component.ECharts/README.md @@ -9,7 +9,7 @@ events, light and dark theme and CSV/Excel export. New-UDEChart -Data (Get-Process | Sort-Object CPU -Descending | Select-Object -First 10 Name, CPU) -Type bar -X Name -Y CPU ``` -Supported and tested versions: [Requirements](https://powershell-universal-components.eize.dev/#requirements). +Supported and tested versions: [Compatibility](https://powershell-universal-components.eize.dev/compatibility/). **Documentation: [powershell-universal-components.eize.dev](https://powershell-universal-components.eize.dev/echarts/)** - every chart type with live examples next to their code, and the parameter reference. diff --git a/modules/PowerShellUniversal.Component.Perspective/README.md b/modules/PowerShellUniversal.Component.Perspective/README.md index bbc23ad..589b371 100644 --- a/modules/PowerShellUniversal.Component.Perspective/README.md +++ b/modules/PowerShellUniversal.Component.Perspective/README.md @@ -10,7 +10,7 @@ thousands of rows stay fast. New-UDPerspective -Data (Invoke-Sqlcmd -Query 'SELECT * FROM Tickets') -GroupBy Team -SplitBy Priority -Columns Id -Aggregates @{ Id = 'count' } ``` -Supported and tested versions: [Requirements](https://powershell-universal-components.eize.dev/#requirements). +Supported and tested versions: [Compatibility](https://powershell-universal-components.eize.dev/compatibility/). **Documentation: [powershell-universal-components.eize.dev](https://powershell-universal-components.eize.dev/perspective/)** - data and types, the starting view, events, security notes, with live examples. diff --git a/modules/PowerShellUniversal.Component.Pivot/README.md b/modules/PowerShellUniversal.Component.Pivot/README.md index 1962697..1809c57 100644 --- a/modules/PowerShellUniversal.Component.Pivot/README.md +++ b/modules/PowerShellUniversal.Component.Pivot/README.md @@ -16,7 +16,7 @@ New-UDPivotReport -Id 'tickets' -Data (Invoke-Sqlcmd -Query 'SELECT * FROM Ticke New-UDPivotReport -Id 'own-data' -Data @() -AllowImport -TemplateStore Browser # the reader's own file ``` -Supported and tested versions: [Requirements](https://powershell-universal-components.eize.dev/#requirements). +Supported and tested versions: [Compatibility](https://powershell-universal-components.eize.dev/compatibility/). **Documentation: [powershell-universal-components.eize.dev](https://powershell-universal-components.eize.dev/pivot/)** - data and dates, views and templates, events, security notes, with live examples. diff --git a/tests/js/compatibility.test.js b/tests/js/compatibility.test.js new file mode 100644 index 0000000..1bda6a3 --- /dev/null +++ b/tests/js/compatibility.test.js @@ -0,0 +1,32 @@ +// docs/compatibility.md names the versions the modules support; each module's manifest enforces the +// lowest PowerShell as PowerShellVersion, and the start page's Requirements sum them up in one line. +// All must say the same, so raising one raises the others. +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { readFileSync, readdirSync } from "node:fs"; + +const root = new URL("../../", import.meta.url); + +test("the PowerShell version on the compatibility page is every manifest's PowerShellVersion", () => { + const page = readFileSync(new URL("docs/compatibility.md", root), "utf8"); + const documented = /^\| PowerShell \| (\d+\.\d+) or later\b/m.exec(page)?.[1]; + assert.ok(documented, 'docs/compatibility.md has no row "| PowerShell | or later"'); + const modules = readdirSync(new URL("modules/", root), { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name); + assert.ok(modules.length > 0, "no modules found"); + const versions = Object.fromEntries(modules.map((name) => { + const manifest = readFileSync(new URL(`modules/${name}/${name}.psd1`, root), "utf8"); + return [name, /^\s*PowerShellVersion\s*=\s*'([^']+)'/m.exec(manifest)?.[1]]; + })); + assert.deepEqual(versions, Object.fromEntries(modules.map((name) => [name, documented])), "raise the version in docs/compatibility.md and every manifest together"); +}); + +test("the start page's Requirements name the versions of the compatibility page", () => { + const page = readFileSync(new URL("docs/compatibility.md", root), "utf8"); + const psu = /^\| PowerShell Universal \| (\S+) and (\S+) \|/m.exec(page); + const powershell = /^\| PowerShell \| (\d+\.\d+) or later\b/m.exec(page)?.[1]; + assert.ok(psu && powershell, "docs/compatibility.md: the PowerShell Universal or PowerShell row is not found"); + const start = readFileSync(new URL("docs/index.md", root), "utf8"); + const requirements = start.slice(start.indexOf("\n## Requirements\n"), start.indexOf("\n## ", start.indexOf("\n## Requirements\n") + 1)); + assert.ok(requirements.includes(`PowerShell Universal ${psu[1]} or ${psu[2]}`), `docs/index.md, Requirements: name PowerShell Universal ${psu[1]} or ${psu[2]}`); + assert.ok(requirements.includes(`PowerShell ${powershell} or later`), `docs/index.md, Requirements: name PowerShell ${powershell} or later`); +}); diff --git a/tests/js/docs-pages.test.js b/tests/js/docs-pages.test.js index 1ed5382..5d6d0f0 100644 --- a/tests/js/docs-pages.test.js +++ b/tests/js/docs-pages.test.js @@ -132,8 +132,8 @@ const RELEASE_NAMES_ALLOWED = [ { file: "docs/versioning.md" }, // the breaks of each module's newest release, by release { file: "docs/upgrading.md" }, - // the versions the modules were tested with - { file: "docs/index.md", section: "Requirements" }, + // the versions the modules support and were tested with + { file: "docs/compatibility.md" }, ]; /** diff --git a/zensical.toml b/zensical.toml index b56484c..eabbbf4 100644 --- a/zensical.toml +++ b/zensical.toml @@ -19,6 +19,8 @@ nav = [ { "Getting started" = "getting-started.md" }, { "Versioning" = "versioning.md" }, { "Upgrading" = "upgrading.md" }, + { "Compatibility" = "compatibility.md" }, + { "Security" = "security.md" }, { "ECharts" = [ { "Overview" = "echarts/index.md" }, { "Showcase app (demo)" = "demo.md" }, @@ -117,7 +119,7 @@ PowerShell objects. Not affiliated with Devolutions. llms-full.txt holds every p """ [project.plugins.llmstxt.sections] -"Start" = ["index.md", "getting-started.md", "versioning.md", "upgrading.md"] +"Start" = ["index.md", "getting-started.md", "versioning.md", "upgrading.md", "compatibility.md", "security.md"] "ECharts module" = ["echarts/*.md", "demo.md"] "Perspective module" = ["perspective/*.md"] "Pivot module" = ["pivot/*.md"]