Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Run `pnpm format`, `pnpm lint`, `pnpm typecheck`, `pnpm contracts:check`, `pnpm

Tests use synthetic fixtures and mocked native fetch. Never use customer credentials, real SAP subscriptions, captured production responses, or private source. Review all staged files and scan public content before each commit.

Shared packages are pinned exactly to `@commercekit-tools/notification-contract@0.0.2` and `@commercekit-tools/ccv2-client@0.0.2`. The repository `.npmrc` selects GitHub Packages for this scope. Configure your personal read credential in your user-level `.npmrc`; never put a token in the repository. Use `npm config get userconfig` to check which configuration your shell selects if an IDE overrides it. Do not print authentication settings in diagnostics.
Shared packages are pinned exactly to `@commercekit-tools/notification-contract@0.0.3` and `@commercekit-tools/ccv2-client@0.0.3`. The repository `.npmrc` selects GitHub Packages for this scope. Configure your personal read credential in your user-level `.npmrc`; never put a token in the repository. Use `npm config get userconfig` to check which configuration your shell selects if an IDE overrides it. Do not print authentication settings in diagnostics.

Repository Actions need read access to both packages. CI uses `contents: read`, `packages: read`, setup-node registry configuration, and `NODE_AUTH_TOKEN` from `secrets.GITHUB_TOKEN` for install steps only. The repository must be granted access in each package's Actions access settings. A successful local install does not prove that the repository token has access.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,6 @@ See [API contract](docs/api-contract.md), [Sandbox](docs/sandbox.md), [security]

## Shared packages

Exact runtime pins are `@commercekit-tools/notification-contract@0.0.2` and `@commercekit-tools/ccv2-client@0.0.2`. The former owns NotificationEvent v1 types, deployment event creation, validation, context, links, and event text sanitization. The latter provides framework-independent technical-user OAuth and CCv2 HTTP transport, including token refresh, URL validation, timeouts, redaction, and safe-read/unsafe-mutation policies.
Exact runtime pins are `@commercekit-tools/notification-contract@0.0.3` and `@commercekit-tools/ccv2-client@0.0.3`. The former owns NotificationEvent v1 types, deployment event creation, validation, context, links, and event text sanitization. The latter provides framework-independent technical-user OAuth and CCv2 HTTP transport, including token refresh, URL validation, timeouts, redaction, and safe-read/unsafe-mutation policies.

Deploy retains inputs, endpoint DTO validation, mode preflight, the deployment lifecycle, green decisions, traffic split, cancellation, results, outputs, and summaries. Both packages are bundled into `dist`; workflow users need no registry configuration or package credentials. Maintainers and CI need GitHub Packages read access. Package upgrades require the full deployment regression suite and guarded Sandbox verification before release. See the [ownership inventory](docs/shared-packages.md). The Action remains **UNRELEASED**.
2 changes: 1 addition & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ No tags, moving v1, GitHub Release, npm publishing, or Marketplace publication u

Merging an implementation is not release authorization.

The current shared dependencies are exactly `@commercekit-tools/notification-contract@0.0.2` and `@commercekit-tools/ccv2-client@0.0.2`. These package versions being published does not release this Action. Any package upgrade requires complete deployment regression tests, all ten guarded Sandbox scenarios (including canary traffic split), and coordinated build → deploy → notify validation again. Rebuild and verify committed dist and license notices. Workflow consumers require no package configuration because dependencies are bundled. Maintainers/CI need GitHub Packages read access for installation.
The current shared dependencies are exactly `@commercekit-tools/notification-contract@0.0.3` and `@commercekit-tools/ccv2-client@0.0.3`. These package versions being published does not release this Action. Any package upgrade requires complete deployment regression tests, all ten guarded Sandbox scenarios (including canary traffic split), and coordinated build → deploy → notify validation again. Rebuild and verify committed dist and license notices. Workflow consumers require no package configuration because dependencies are bundled. Maintainers/CI need GitHub Packages read access for installation.
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ Safe reads and token requests retry transient failures; unsafe mutations allow o

Fixtures must be synthetic. Public scanning detects common credential formats and local paths; human review is required for unknown tenant identifiers. Never run real SAP credentials in automated tests.

Authentication and transport use exactly `@commercekit-tools/ccv2-client@0.0.2`; event creation, validation, context/link checks, and sanitization use exactly `@commercekit-tools/notification-contract@0.0.2`. Deploy registers runtime secrets with the runner and applies its conservative output disclosure policy on top of shared sanitization. Even sanitized provider problem title/detail fields are not published. Only the four technical-user credentials enter the token manager; lifecycle inputs are never registered as credentials.
Authentication and transport use exactly `@commercekit-tools/ccv2-client@0.0.3`; event creation, validation, context/link checks, and sanitization use exactly `@commercekit-tools/notification-contract@0.0.3`. Deploy registers runtime secrets with the runner and applies its conservative output disclosure policy on top of shared sanitization. Even sanitized provider problem title/detail fields are not published. Only the four technical-user credentials enter the token manager; lifecycle inputs are never registered as credentials.

Packages are bundled into the committed Action, with no runtime registry access. Package installation credentials are maintainer/CI concerns and never enter the bundle. CI grants package read permission only. Package upgrades require full deployment regression and Sandbox verification; the Action remains unreleased until coordinated release gates pass.
4 changes: 2 additions & 2 deletions THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This Action is MIT licensed. Deployment conventions were adapted from the public
Runtime dependencies are pinned exactly:

- `@actions/core@3.0.1` (MIT): runner outputs, masking and summary APIs.
- `@commercekit-tools/ccv2-client@0.0.2` (MIT): framework-independent technical-user authentication and CCv2 transport.
- `@commercekit-tools/notification-contract@0.0.2` (MIT): NotificationEvent v1 schema, types, factories, validation, context/link safety and sanitization. Ajv and ajv-formats are transitive package dependencies; there is no separate schema copy or direct Ajv dependency here.
- `@commercekit-tools/ccv2-client@0.0.3` (MIT): framework-independent technical-user authentication and CCv2 transport.
- `@commercekit-tools/notification-contract@0.0.3` (MIT): NotificationEvent v1 schema, types, factories, validation, context/link safety and sanitization. Ajv and ajv-formats are transitive package dependencies; there is no separate schema copy or direct Ajv dependency here.

Published packages include their licenses. `dist/licenses.txt` contains the bundled dependency license inventory. Development tools provide TypeScript, linting, formatting, Vitest coverage and ncc bundling. SAP documentation is production authority but its authored OpenAPI is not redistributed. Tests use hand-authored models and independently authored CommerceKit Sandbox compatibility evidence.
2 changes: 1 addition & 1 deletion contracts/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NotificationEvent contract

NotificationEvent v1 is provided by the exact published MIT-licensed package `@commercekit-tools/notification-contract@0.0.2`. Its public `schema` export is the contract authority used by the local compatibility check; its deployment factory validates every emitted event with the package's full validator. There is no duplicate schema or local Ajv compilation in this repository.
NotificationEvent v1 is provided by the exact published MIT-licensed package `@commercekit-tools/notification-contract@0.0.3`. Its public `schema` export is the contract authority used by the local compatibility check; its deployment factory validates every emitted event with the package's full validator. There is no duplicate schema or local Ajv compilation in this repository.

`pnpm contracts:check` verifies both installed shared package versions and manifest pins, the schemaVersion 1 export, all five deployment event outcomes, and removal of superseded schema/auth/transport files. It runs entirely offline. Action tests also validate every emitted event, including handled failures. Sandbox assertions use the same package validator.

Expand Down
6 changes: 3 additions & 3 deletions dist/index.js

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions docs/shared-packages.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Shared package ownership

Both packages are published GitHub Packages dependencies pinned exactly to **0.0.2**. No local checkout, workspace link, runtime registry request, or package publishing step is used. The Action remains **UNRELEASED**.
Both packages are published GitHub Packages dependencies pinned exactly to **0.0.3**. No local checkout, workspace link, runtime registry request, or package publishing step is used. The Action remains **UNRELEASED**.

| Area | Classification | Ownership after migration |
| ----------------------------------------------------------------------------- | ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
Expand Down Expand Up @@ -35,8 +35,14 @@ Dependencies are bundled into `dist/index.js` with notices in `dist/licenses.txt

## Remaining adapters

The package owns the GitHub environment allowlist; Deploy filters values as the package reads them to reject registered secrets and controls without enumerating the environment. Input credential types and result event-status/error types come from the packages. Base URLs are validated once by the appropriate shared validator. Shared sanitizers own secret encodings, bearer/header redaction, URL removal, text bounds and stack removal. Deploy retains HTML/JWT filtering and summary escaping because neither pinned package exports those protections.
The package owns the GitHub environment allowlist; Deploy filters values as the package reads them to reject registered secrets and controls without enumerating the environment. Input credential types and result event-status/error types come from the packages. Base URLs are validated once by the appropriate shared validator. Shared sanitizers own secret encodings, bearer/header redaction, URL removal, text bounds and stack removal. The package now supplies markup/JWT filtering primitives; Deploy retains their ordering and its local summary escaping.

Sandbox prerequisite OAuth, Management requests and polling sleep also use `ccv2-client`. The separate control API helper remains local: its run/scenario/cleanup operations use a control token with ordinary `Authorization`, not technical-user `x-approuter-authorization`. All ten scenarios, fixed origin, confirmation and always-run cleanup remain unchanged.

Lint rules prevent direct fetch in Action modules and Sandbox preparation, and direct Ajv imports in contract consumers. This keeps new transport and schema validation work routed through the shared packages. Small local adapters still translate transport errors into stable Deploy errors, count progress requests and enforce endpoint DTOs and unsafe-mutation policy.

## Shared primitives in 0.0.3

CCv2 path-segment validation/encoding now delegates to `encodeCcv2PathSegment`. The Action keeps input diagnostics and translates `INVALID_PATH_ENCODING` to its existing malformed-Unicode failure classification. Markup filtering and JWT-shaped token redaction delegate to `stripAngleBracketText` and `redactJwtLikeTokens` at their original positions in the sanitization pipeline. The new JWT scanner removes the copied regex's quadratic behavior on repeated prefixes. No provider rendering, masking registration, HTML summary escaping, endpoint validation or lifecycle logic moves into the package.

The frozen integration corpus compares 25 text cases and 29 identifier cases with the pre-extraction Action. It includes the long-markup/truncation behavior that differs between Build and Deploy. Action metadata and existing notification-event fixtures remain unchanged.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
},
"dependencies": {
"@actions/core": "3.0.1",
"@commercekit-tools/ccv2-client": "0.0.2",
"@commercekit-tools/notification-contract": "0.0.2"
"@commercekit-tools/ccv2-client": "0.0.3",
"@commercekit-tools/notification-contract": "0.0.3"
},
"devDependencies": {
"@eslint/js": "10.0.1",
Expand Down
20 changes: 10 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
minimumReleaseAgeExclude:
- "@commercekit-tools/ccv2-client@0.0.2"
- "@commercekit-tools/notification-contract@0.0.2"
- "@commercekit-tools/ccv2-client@0.0.3"
- "@commercekit-tools/notification-contract@0.0.3"
# Development tooling mitigation for GHSA-g3hv-75wg-m249.
overrides:
minimatch: 11.0.1
4 changes: 2 additions & 2 deletions scripts/contracts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ for (const name of [
"@commercekit-tools/notification-contract",
"@commercekit-tools/ccv2-client",
]) {
assert.equal(manifest.dependencies[name], "0.0.2");
assert.equal(require(`${name}/package.json`).version, "0.0.2");
assert.equal(manifest.dependencies[name], "0.0.3");
assert.equal(require(`${name}/package.json`).version, "0.0.3");
}
assert.equal(schema.properties.schemaVersion.const, 1);
for (const file of [
Expand Down
14 changes: 12 additions & 2 deletions src/inputs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {
validateTechnicalUserTokenEndpoint,
encodeCcv2PathSegment,
Ccv2TransportError,
validateManagementApiBaseUrl,
type TechnicalUserCredentials,
} from "@commercekit-tools/ccv2-client";
Expand Down Expand Up @@ -35,9 +37,17 @@ export function httpsUrl(
}
export function segment(value: string): string {
textInput(value, "path identifier", 128);
if (/[/?#\\]/.test(value) || value === "." || value === "..")
try {
return encodeCcv2PathSegment(value);
} catch (error) {
// Preserve the existing malformed-Unicode failure classification.
if (
error instanceof Ccv2TransportError &&
error.code === "INVALID_PATH_ENCODING"
)
throw new URIError("URI malformed", { cause: error });
throw new ActionError("INVALID_INPUT", "Invalid path identifier.");
return encodeURIComponent(value);
}
}
export type Operation = "deploy" | "resume" | "decide" | "cancel";
export type Decision = "ACCEPT" | "PREPARE_CANARY" | "REJECT";
Expand Down
21 changes: 5 additions & 16 deletions src/security.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { redactTransportText } from "@commercekit-tools/ccv2-client";
import {
sanitizeBoundedText,
stripAngleBracketText,
redactJwtLikeTokens,
sanitizeErrorMessage,
redactKnownSecrets,
} from "@commercekit-tools/notification-contract";
Expand All @@ -14,9 +16,9 @@ export class Sanitizer {
}
text(value: string, max = 1000): string {
// Keep Deploy's plain-text/URL/JWT disclosure policy atop shared redaction.
const text = plainText(
redactTransportText(value, [...this.secrets]),
).replace(/eyJ[\w-]+\.[\w-]+\.[\w-]+/g, "[REDACTED]");
const text = redactJwtLikeTokens(
stripAngleBracketText(redactTransportText(value, [...this.secrets])),
);
return text.trim()
? sanitizeBoundedText(
sanitizeErrorMessage(text, [...this.secrets]),
Expand All @@ -39,16 +41,3 @@ export const escapeHtml = (value: string) =>
c
]!,
);

// A conservative text filter: discard tag contents, including unclosed tags.
// Every angle bracket is consumed, so nested/malformed markup cannot reappear.
function plainText(value: string): string {
let inside = false;
let output = "";
for (const character of value) {
if (character === "<") inside = true;
else if (character === ">") inside = false;
else if (!inside) output += character;
}
return output;
}
Loading
Loading