diff --git a/.checker-floor.json b/.checker-floor.json new file mode 100644 index 000000000..624978fd7 --- /dev/null +++ b/.checker-floor.json @@ -0,0 +1,71 @@ +{ + "measured_at": "2026-11-14T15:35:56Z", + "commit": "2d4aceb33c4d337c1cfa87a0eb8537399c6c32b4", + "tool": "common-ground-checker scan-local", + "tool_version": "0.0.2+aa578398248c", + "scoring_digest": "9fecce06b1cacea2", + "score": 100, + "criteria": { + "adrvalidator": "pass", + "changelog": "pass", + "cicd": "pass", + "codeofconduct": "pass", + "complexity": "pass", + "contributing": "pass", + "copyrightowner": "pass", + "coverage": "pass", + "docker": "pass", + "dockerimage": "pass", + "documentation": "pass", + "eupllicense": "pass", + "fivelayer": "pass", + "helmchart": "pass", + "licenceconsistency": "pass", + "license": "pass", + "maintainability": "pass", + "openapi": "pass", + "opensourcehealth": "pass", + "openssfscorecard": "info", + "owaspsecurecoding": "pass", + "publiccode": "pass", + "sbom": "pass", + "secretscanning": "pass", + "security": "pass", + "semver": "pass", + "sourcecode": "pass", + "spdxheaders": "pass", + "testcoderatio": "pass", + "tests": "pass" + }, + "stars": { + "adrvalidator": 5, + "changelog": 5, + "cicd": 5, + "codeofconduct": 5, + "complexity": 5, + "contributing": 5, + "copyrightowner": 5, + "coverage": 5, + "docker": 5, + "dockerimage": 5, + "documentation": 5, + "eupllicense": 5, + "fivelayer": 5, + "helmchart": 5, + "licenceconsistency": 5, + "license": 5, + "maintainability": 4, + "openapi": 5, + "opensourcehealth": 4, + "owaspsecurecoding": 5, + "publiccode": 5, + "sbom": 5, + "secretscanning": 5, + "security": 5, + "semver": 5, + "sourcecode": 5, + "spdxheaders": 5, + "testcoderatio": 4, + "tests": 5 + } +} diff --git a/.claude/commands/check.md b/.claude/commands/check.md new file mode 100644 index 000000000..7bdcdda1c --- /dev/null +++ b/.claude/commands/check.md @@ -0,0 +1,32 @@ +--- +description: Run the Stackiq quality suite (PHP lint, static analysis, frontend lint and translation checks) +--- + +Run this repo's quality suite from the repo root and report each failure with its file and line. Do not change baselines or suppression files to make a check pass. + +Requires `composer install` and `npm ci` to have been run. + +1. PHP suite (lint, phpcs, phpmd, psalm, phpstan, then the full PHPUnit run; `test:all` skips itself outside a Nextcloud server tree): + + ```bash + composer check:strict + ``` + + For a faster pass use `composer check` (lint, phpcs, psalm, unit tests). + +2. Frontend lint and formatting: + + ```bash + npm run lint + npm run stylelint + npm run format + ``` + +3. Translation and manifest checks: + + ```bash + npm run test:l10n + npm run check:manifest + ``` + +Summarise which commands passed and which failed. If a failure is fixable automatically, the fix commands are `composer phpcs:fix` and `npm run lint-fix`; only run them when asked. diff --git a/.claude/commands/e2e.md b/.claude/commands/e2e.md new file mode 100644 index 000000000..8ee510968 --- /dev/null +++ b/.claude/commands/e2e.md @@ -0,0 +1,25 @@ +--- +description: Run the Stackiq Playwright end-to-end tests against an isolated Nextcloud instance +--- + +Run the Playwright suite (`playwright.config.ts`, specs in `tests/e2e/`). + +1. The suite has no default target. Set one of the variables accepted by `tests/e2e/base-url.ts`, for example `PLAYWRIGHT_BASE_URL`, to an isolated instance with Stackiq and OpenRegister enabled. Never point it at a shared development container: the suite creates data. Admin credentials come from `NC_ADMIN_USER` and `NC_ADMIN_PASS` (both default to `admin`). + +2. Make sure browsers are installed: `npx playwright install chromium`. + +3. Run the smoke project first; it only checks that the app bundle mounts: + + ```bash + npm run test:smoke + ``` + +4. If smoke passes, run the full suite: + + ```bash + npm run test:e2e + ``` + + To run one spec: `npx playwright test --project chromium`. + +Report passed and failed specs. The `visual` project is opt-in and not gating; do not update snapshots unless asked. diff --git a/.claude/commands/new-change.md b/.claude/commands/new-change.md new file mode 100644 index 000000000..7e13b181d --- /dev/null +++ b/.claude/commands/new-change.md @@ -0,0 +1,18 @@ +--- +description: Start a new OpenSpec change for Stackiq +--- + +Start a new OpenSpec change named `$ARGUMENTS` (kebab-case, describing what it does, for example `contracts-expiry-and-owner`). + +1. Read `openspec/config.yaml` (project context and per-artifact rules) and look at one or two existing changes in `openspec/changes/` for the expected shape, for example `openspec/changes/landscape-completeness-score/`. +2. Check `openspec/specs/` for an existing capability spec that the change extends, and `openspec/changes/` for an open change that already covers it. +3. Create `openspec/changes//` with: + - `proposal.md`: front matter (`kind`, optional `depends_on`), then Summary, Why, what the app has today, and what the change builds. + - `design.md`: the decisions, each with the alternatives considered and why they were rejected. + - `specs//spec.md`: delta requirements with GIVEN/WHEN/THEN scenarios. + - `tasks.md`: numbered tasks, each with `spec_ref`, `files`, `acceptance_criteria` and Implement/Test checkboxes. + + Templates for each artifact are in `openspec/schemas/conduction/templates/`. +4. Do not write code yet. Show the proposal and ask for review. + +When the change has shipped, it is moved to `openspec/changes/archive/-/` and its requirements are merged into `openspec/specs/`. diff --git a/.claude/commands/unit-test.md b/.claude/commands/unit-test.md new file mode 100644 index 000000000..22c710411 --- /dev/null +++ b/.claude/commands/unit-test.md @@ -0,0 +1,23 @@ +--- +description: Run the Stackiq unit tests (PHPUnit and Vitest) +--- + +Run the unit tests from the repo root. Requires `composer install` and `npm ci`. + +1. PHP unit tests (`phpunit-unit.xml`, tests in `tests/Unit/`): + + ```bash + composer test:unit + ``` + + To run one test file: `vendor/bin/phpunit -c phpunit-unit.xml `. + +2. JavaScript unit tests (Vitest, `vitest.config.js`, specs in `tests/vitest/`): + + ```bash + npm test + ``` + + To run one spec: `npx vitest run `. + +Report the totals and, for each failure, the test name and assertion message. If `$ARGUMENTS` names a file, run only that file with the matching single-file command above. diff --git a/.coverage-baseline b/.coverage-baseline index 13e0537c3..895a0321c 100644 --- a/.coverage-baseline +++ b/.coverage-baseline @@ -1 +1 @@ -13.01 +45.00 diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..ec2ed7ce4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,20 @@ +# Build context for the evaluation image. The image installs vendor/ and +# builds js/ itself, so local dependencies stay out. +# Rendered from ConductionNL/.github templates/app-deploy. +.git +**/node_modules +vendor +coverage +.phpunit.cache +.phpunit.result.cache +tests/e2e/results +playwright-report +test-results +*.log +.env +# The deployment files themselves, so editing them does not rebuild the app. +Dockerfile +.dockerignore +docker-compose*.yml +charts +.github diff --git a/.gitattributes b/.gitattributes index 895b43272..7ba98314f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -15,7 +15,6 @@ bin/console text eol=lf *.ico binary *.png binary -.github export-ignore .travis.yml export-ignore LICENSE export-ignore README.md export-ignore diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..f5f4f071b --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,36 @@ +# CODEOWNERS — auto-request reviewers based on path domain. +# Last-match-wins; broad rules first, specific overrides below. +# Created 2026-05-03 from the OR-abstraction audit follow-up. + +# Default: every named codeowner reviews unmatched paths. +* @rubenvdlinde @rjzondervan @Rem-Dam @remko48 @WilcoLouwerse @bbrands02 @SudoThijn + +# Backend (PHP) — services, controllers, mappers, db, migration, etc. +lib/ @bbrands02 @rjzondervan @WilcoLouwerse +appinfo/ @bbrands02 @rjzondervan @WilcoLouwerse +**/*.php @bbrands02 @rjzondervan @WilcoLouwerse +phpcs.xml @bbrands02 @rjzondervan @WilcoLouwerse +phpmd.xml @bbrands02 @rjzondervan @WilcoLouwerse +phpstan.neon @bbrands02 @rjzondervan @WilcoLouwerse +phpstan-baseline.neon @bbrands02 @rjzondervan @WilcoLouwerse +phpmd.baseline.xml @bbrands02 @rjzondervan @WilcoLouwerse +composer.json @bbrands02 @rjzondervan @WilcoLouwerse +composer.lock @bbrands02 @rjzondervan @WilcoLouwerse + +# Frontend (Vue / TS / JS) — components, stores, pages, build config. +src/ @SudoThijn @remko48 +**/*.vue @SudoThijn @remko48 +**/*.ts @SudoThijn @remko48 +**/*.js @SudoThijn @remko48 +package.json @SudoThijn @remko48 +package-lock.json @SudoThijn @remko48 +jest.config.js @SudoThijn @remko48 +playwright.config.ts @SudoThijn @remko48 +webpack.config.js @SudoThijn @remko48 +babel.config.js @SudoThijn @remko48 + +# Specs / docs / ADRs / openspec. +openspec/ @rubenvdlinde @Rem-Dam +docs/ @rubenvdlinde @Rem-Dam +**/*.md @rubenvdlinde @Rem-Dam +README.md @rubenvdlinde @Rem-Dam diff --git a/.github/sig-floor.json b/.github/sig-floor.json new file mode 100644 index 000000000..aa4c7da02 --- /dev/null +++ b/.github/sig-floor.json @@ -0,0 +1,28 @@ +{ + "about": "SIG 4-star checks this app meets and must keep meeting (gate 123, sig-floor). Generated by check_sig_floor.py write; raised by the workflow, never lowered by hand.", + "schema": 1, + "profile": "four-star", + "tools": { + "lizard": "1.24.3" + }, + "measured_at": "dd80cc1c259151f94ad7fcc2abe0b9d617237aff", + "checks": [ + "javascript duplication", + "javascript unit_complexity >25", + "javascript unit_interfacing >2", + "javascript unit_interfacing >4", + "javascript unit_interfacing >6", + "php module_coupling >10", + "php unit_interfacing >4", + "php unit_interfacing >6", + "vue unit_complexity >10", + "vue unit_complexity >25", + "vue unit_complexity >5", + "vue unit_interfacing >2", + "vue unit_interfacing >4", + "vue unit_interfacing >6", + "vue unit_size >15", + "vue unit_size >30", + "vue unit_size >60" + ] +} diff --git a/.github/workflows/branch-protection.yml b/.github/workflows/branch-protection.yml index 3d7f6785d..af215de62 100644 --- a/.github/workflows/branch-protection.yml +++ b/.github/workflows/branch-protection.yml @@ -6,6 +6,9 @@ on: - main - beta +permissions: + contents: read + jobs: branch-protection: # The callee's `check-branch` job is a single bash comparison of diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 81c61d62d..b487839ea 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -94,39 +94,42 @@ on: # be redder than a PR — that is the honest answer, not a regression. workflow_dispatch: -# Permission CEILING for the called quality pipeline, NOT a grant. Copied -# verbatim from openconnector, where this exact block is live on `development` -# with all ~30 quality jobs green — so it is a measured ceiling, not a guess. -# -# ⚠️ Most jobs in the callee declare NO permissions of their own (only -# journeydoc-capture and features-extract do), which means they inherit THIS -# ceiling exactly. Every entry below is load-bearing: -# -# contents: write journeydoc-capture and update-baseline `git push` -# the regenerated screenshots / coverage baseline -# actions: write journeydoc-capture re-dispatches downstream work -# (a GITHUB_TOKEN push does not fire workflow_run) -# issues / pull-requests: write -# the Quality Report comment — `github.rest.issues -# .createComment`, which 403s under contents+packages -# read alone (quality.yml notes this at its own step) -# packages: read pulling org images for the Nextcloud test matrix -# -# ⚠️ Do NOT "tighten" any of these to `read`. GitHub statically validates the -# called workflow's DECLARED job permissions against this grant — including for -# jobs an `if:` will skip — so capping one makes the whole call fail to START: -# zero jobs, no annotations, and a Code Quality run that is absent rather than -# red. That is quieter than the outage it would cause. +# Read-only by default; the write grants sit on the job that needs them. permissions: - contents: write - actions: write - issues: write - pull-requests: write - packages: read + contents: read jobs: quality: if: (github.event_name != 'pull_request' || github.head_ref != 'development') + # Permission CEILING for the called quality pipeline, NOT a grant. Copied + # verbatim from openconnector, where this exact block is live on `development` + # with all ~30 quality jobs green, so it is a measured ceiling, not a guess. + # + # ⚠️ Most jobs in the callee declare NO permissions of their own (only + # journeydoc-capture and features-extract do), which means they inherit THIS + # ceiling exactly. Every entry below is load-bearing: + # + # contents: write journeydoc-capture and update-baseline `git push` + # the regenerated screenshots / coverage baseline + # actions: write journeydoc-capture re-dispatches downstream work + # (a GITHUB_TOKEN push does not fire workflow_run) + # issues / pull-requests: write + # the Quality Report comment, `github.rest.issues + # .createComment`, which 403s under contents+packages + # read alone (quality.yml notes this at its own step) + # packages: read pulling org images for the Nextcloud test matrix + # + # ⚠️ Do NOT "tighten" any of these to `read`. GitHub statically validates the + # called workflow's DECLARED job permissions against this grant, including for + # jobs an `if:` will skip, so capping one makes the whole call fail to START: + # zero jobs, no annotations, and a Code Quality run that is absent rather than + # red. That is quieter than the outage it would cause. + permissions: + contents: write + actions: write + issues: write + pull-requests: write + packages: read uses: ConductionNL/.github/.github/workflows/quality.yml@main with: app-name: stackiq @@ -165,7 +168,7 @@ jobs: # `tests/e2e/workflows/integrations-page.spec.ts` fails on every run. # `app` is `integriq`, verified in its appinfo/info.xml on `development` # on 2026-09-14. - additional-apps: '[{"repo":"ConductionNL/openregister","app":"openregister","ref":"development"},{"repo":"ConductionNL/integriq","app":"integriq","ref":"development"}]' + additional-apps: '[{"repo":"ConductionNL/openregister","app":"openregister","ref":"main"},{"repo":"ConductionNL/integriq","app":"integriq","ref":"development"}]' # Newman disabled: tests/magic-mapper-import.postman_collection.json was # written against a dev env with URL rewriting + a fixed disk layout — it # hits bare paths like `/configurations` and uploads files from @@ -265,6 +268,15 @@ jobs: # here — the job reported `skipped`, which the Quality Report renders # identically to a pass. enable-hydra-gates: true + # Gate 122 (SIG unit ratchet) blocks: a unit this change adds or makes + # worse must stay at NLOC 60, McCabe 10 and at most 4 parameters, and a + # new duplicated fragment of 6+ lines fails. Units the change does not + # touch, or touches without making worse, are inherited and do not count. + hydra-gates-sig-blocking: true + # Maintainability floor: no rating in .maintainability-floor.json may drop + # more than 0.01 against the merge base (pull request) or below the + # committed floor (push). The floor is raised after improving merges. + enable-maintainability-floor: true # No `hydra-gates-ref` here on purpose. The shared workflow defaults it # to @main, and this workflow is itself consumed at @main, so the two # sides move together and a gate fix reaches this repo without a commit diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..827d07cfe --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,46 @@ +# SPDX-FileCopyrightText: 2026 Conduction B.V. +# SPDX-License-Identifier: EUPL-1.2 + +# CodeQL static analysis of the JavaScript/TypeScript frontend and of the +# workflows themselves. CodeQL has no PHP extractor; the PHP side is covered by +# psalm and phpstan in the quality pipeline. +name: CodeQL + +on: + push: + branches: [development, main] + pull_request: + branches: [development, main] + schedule: + - cron: '17 3 * * 2' + +permissions: read-all + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ubuntu-latest + permissions: + security-events: write + contents: read + actions: read + strategy: + fail-fast: false + matrix: + language: [javascript-typescript, actions] + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Initialise CodeQL + uses: github/codeql-action/init@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3 + with: + languages: ${{ matrix.language }} + build-mode: none + + - name: Analyse + uses: github/codeql-action/analyze@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3 + with: + category: /language:${{ matrix.language }} diff --git a/.github/workflows/container-image.yml b/.github/workflows/container-image.yml new file mode 100644 index 000000000..25688520e --- /dev/null +++ b/.github/workflows/container-image.yml @@ -0,0 +1,91 @@ +name: Container image + +# Builds the evaluation image (root Dockerfile) for a release and pushes it to +# ghcr.io/conductionnl/stackiq. A stable release gets its version and +# `latest`; a beta or unstable release only moves `edge`. +# +# Releases are created by the Release workflow with the workflow token, and a +# release made that way starts no other workflow. So this one follows the +# Release run instead, and builds the newest release it finds. +# +# Rendered from ConductionNL/.github templates/app-deploy. + +on: + workflow_run: + workflows: [Release] + types: [completed] + release: + types: [published] + workflow_dispatch: + inputs: + tag: + description: "Release tag to build, for example v1.2.3 (empty: the newest release)" + required: false + type: string + +permissions: + contents: read + +concurrency: + group: container-image + cancel-in-progress: false + +jobs: + image: + permissions: + contents: read + packages: write + if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' + runs-on: ubuntu-latest + steps: + - name: Resolve the release + id: release + env: + GH_TOKEN: ${{ github.token }} + REPO: ${{ github.repository }} + EVENT_TAG: ${{ github.event.release.tag_name }} + INPUT_TAG: ${{ inputs.tag }} + run: | + set -euo pipefail + tag="${EVENT_TAG:-${INPUT_TAG:-}}" + if [ -z "$tag" ]; then + tag="$(gh release list --repo "$REPO" --limit 1 --exclude-drafts --json tagName --jq '.[0].tagName')" + fi + [ -n "$tag" ] || { echo "::error::No release to build."; exit 1; } + version="${tag#v}" + image=ghcr.io/conductionnl/stackiq + case "$version" in + *-*) tags="$image:edge" ;; + *) tags="$image:$version,$image:latest" ;; + esac + echo "tag=$tag" >> "$GITHUB_OUTPUT" + echo "version=$version" >> "$GITHUB_OUTPUT" + echo "tags=$tags" >> "$GITHUB_OUTPUT" + echo "Building $tag as $tags" + + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ steps.release.outputs.tag }} + + - name: Record the commit + id: commit + run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + + - uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 + + - uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + + - uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 + with: + context: . + push: true + tags: ${{ steps.release.outputs.tags }} + labels: | + org.opencontainers.image.version=${{ steps.release.outputs.version }} + org.opencontainers.image.revision=${{ steps.commit.outputs.sha }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 4c664413e..e558ef4d8 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -12,6 +12,9 @@ on: pull_request: branches: [development] +permissions: + contents: read + jobs: deploy: # Permission CEILING for the called workflow, not a grant: the callee's diff --git a/.github/workflows/issue-triage.yml b/.github/workflows/issue-triage.yml index d188b67f1..682f212b6 100644 --- a/.github/workflows/issue-triage.yml +++ b/.github/workflows/issue-triage.yml @@ -10,6 +10,9 @@ on: type: boolean default: true +permissions: + contents: read + jobs: triage: # Permission CEILING for the called workflow, not a grant. All three jobs in diff --git a/.github/workflows/l10n.yml b/.github/workflows/l10n.yml index 0334d5bba..4306c44e5 100644 --- a/.github/workflows/l10n.yml +++ b/.github/workflows/l10n.yml @@ -16,8 +16,8 @@ jobs: # Observed fleet-wide n=225: median 0.1 min, max 1.2 min. Bound loosely at 15. timeout-minutes: 15 steps: - - uses: actions/checkout@v7 - - uses: actions/setup-node@v4 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: "22" # check-l10n.js uses only Node built-ins (fs/path) — no npm ci needed. diff --git a/.github/workflows/merge-hygiene.yml b/.github/workflows/merge-hygiene.yml index 14e7e209a..ec396ad89 100644 --- a/.github/workflows/merge-hygiene.yml +++ b/.github/workflows/merge-hygiene.yml @@ -33,7 +33,7 @@ jobs: name: Conflict markers and PHP syntax runs-on: ubuntu-latest steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 # Conflict markers, anywhere in the tree we author. A marker means a merge # was committed half-finished; every downstream signal from that commit is @@ -64,7 +64,7 @@ jobs: fi echo "No conflict markers." - - uses: shivammathur/setup-php@v2 + - uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0 with: php-version: '8.3' coverage: none diff --git a/.github/workflows/openspec-sync.yml b/.github/workflows/openspec-sync.yml index 96e434822..c3889d5ad 100644 --- a/.github/workflows/openspec-sync.yml +++ b/.github/workflows/openspec-sync.yml @@ -6,6 +6,9 @@ on: paths: ['openspec/**'] workflow_dispatch: +permissions: + contents: read + jobs: sync: # Permission CEILING for the called workflow, not a grant. The callee's diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fe530b863..f32549ad0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,6 +27,9 @@ concurrency: group: release-${{ github.ref_name }} cancel-in-progress: false +permissions: + contents: read + # `previous-app-id` is the App Store id this app shipped under before the # rename. The store keys everything on the id, so `stackiq` is a brand new # entry starting from nothing -- without this the version line restarts diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml new file mode 100644 index 000000000..22f3656a5 --- /dev/null +++ b/.github/workflows/scorecard.yml @@ -0,0 +1,52 @@ +# SPDX-FileCopyrightText: 2026 Conduction B.V. +# SPDX-License-Identifier: EUPL-1.2 + +# OpenSSF Scorecard: rates this repository's supply-chain practices and +# publishes the result to the public Scorecard API and the Security tab. +name: Scorecard supply-chain security + +on: + branch_protection_rule: + schedule: + - cron: '30 4 * * 1' + push: + branches: [main] + workflow_dispatch: + +permissions: read-all + +jobs: + analysis: + name: Scorecard analysis + runs-on: ubuntu-latest + permissions: + # Upload the results to code scanning. + security-events: write + # Publish the results and get a badge (OIDC token for the Scorecard API). + id-token: write + contents: read + actions: read + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Run analysis + uses: ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e # v2.5.0 + with: + results_file: results.sarif + results_format: sarif + publish_results: true + + - name: Upload artifact + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + - name: Upload to code scanning + uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3 + with: + sarif_file: results.sarif diff --git a/.github/workflows/sync-to-beta.yml b/.github/workflows/sync-to-beta.yml index c21f6f0d8..419de2252 100644 --- a/.github/workflows/sync-to-beta.yml +++ b/.github/workflows/sync-to-beta.yml @@ -5,6 +5,9 @@ on: branches: - development +permissions: + contents: read + jobs: sync: # Permission CEILING for the called workflow, not a grant. The callee's diff --git a/.gitleaks.toml b/.gitleaks.toml new file mode 100644 index 000000000..6b1e53fd0 --- /dev/null +++ b/.gitleaks.toml @@ -0,0 +1,54 @@ +# gitleaks configuration: the default rules, plus allowlists for findings +# that are not secrets. Each allowlist names the exact files and only the +# rules that fire there, so anything else in those files is still reported. + +[extend] +useDefault = true + +[[allowlists]] +description = "Editor agent instructions: curl examples with the default admin:admin login of the local development container." +targetRules = ["curl-auth-user"] +paths = [ + '''(^|/)\.cursor/rules/global\.mdc$''', +] + +[[allowlists]] +description = "Editor agent instructions: curl examples with the default admin:admin login of the local development container." +targetRules = ["curl-auth-user"] +paths = [ + '''(^|/)\.cursorrules$''', +] + +[[allowlists]] +description = "Bug-fix notes: curl examples with Basic auth for admin:admin (base64) on the local development container." +targetRules = ["curl-auth-header"] +paths = [ + '''(^|/)BUG_FIX_ORGANISATION_USER_ASSIGNMENT\.md$''', +] + +[[allowlists]] +description = "README example: curl with the default admin:admin login of the local development container." +targetRules = ["curl-auth-user"] +paths = [ + '''(^|/)README\.md$''', +] + +[[allowlists]] +description = "Documentation and testing guides: curl examples with the default admin:admin login of the local development container." +targetRules = ["curl-auth-user"] +paths = [ + '''(^|/)docs/ANONYMOUS_USER_REGISTRATION_USECASE\.md$''', + '''(^|/)docs/API_TESTING\.md$''', + '''(^|/)docs/ARCHIMATE_QUICK_TEST\.md$''', + '''(^|/)docs/ARCHIMATE_TESTING_GUIDE\.md$''', + '''(^|/)docs/ARCHITECTURE\.md$''', + '''(^|/)docs/Installation/demo\-environment\.md$''', + '''(^|/)docs/TESTING_ORGANIZATION_SYNC\.md$''', +] + +[[allowlists]] +description = "E2E seed script: curl login built from the ADMIN_USER/ADMIN_PASSWORD environment variables, not a literal." +targetRules = ["curl-auth-user"] +paths = [ + '''(^|/)tests/e2e/ci\-seed\.sh$''', +] diff --git a/.maintainability-floor.json b/.maintainability-floor.json new file mode 100644 index 000000000..e2ca0fbca --- /dev/null +++ b/.maintainability-floor.json @@ -0,0 +1,21 @@ +{ + "measured_at": "2026-11-11T15:41:56Z", + "commit": "263abe46020fed53e24112e9e2d4286809729b56", + "tool_version": "estimator sha256:391d6ca5ea39; lizard 1.24.3; jscpd 4.0.5; profile five-star", + "tolerance": 0.01, + "overall": 3.13, + "overall_range": [ + 3.13, + 3.28 + ], + "properties": { + "volume": null, + "duplication": 3.43, + "unit_size": 2.33, + "unit_complexity": 1.79, + "unit_interfacing": 4.67, + "module_coupling": 1.48, + "component_independence": 5.5, + "component_entanglement": 5.5 + } +} diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..39aa7e6e3 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,91 @@ +# AGENTS.md + +Guidance for coding agents working in this repository. Every command and path below exists in this repo. + +## What this app is + +Stackiq is a Nextcloud app for software portfolio management: it registers the applications, modules and connections (koppelingen) of an organisation's IT landscape, aligned with the Dutch GEMMA standards. It stores all its data as OpenRegister objects (no own database tables) and provisions Nextcloud users and groups from register contacts (see `README.md` and `appinfo/info.xml`). + +## Setup + +- `CONTRIBUTING.md` (Development Setup) lists the prerequisites: PHP 8.1+, Node.js 20+, Composer, then `composer install` and `npm install`, inside the external Nextcloud development environment ConductionNL/nextcloud-docker-dev. +- `docker-compose.yml` is an evaluation stack (Nextcloud with Stackiq and OpenRegister, PostgreSQL, Redis): `docker compose -f docker-compose.yml up -d --build`, then open http://localhost:8080/apps/stackiq/. Its header comments list the settings. +- `stackiq-compose.yaml` is a demo environment, explicitly not a development environment: it does not bind-mount your working copy. +- OpenRegister must be installed and enabled for the app to work. + +## Build + +```bash +npm run build # production webpack bundle (runs check:vue-demi first) +npm run dev # development bundle +npm run watch # development bundle, rebuild on change +``` + +## Test + +PHP (PHPUnit): + +```bash +composer test:unit # unit tests, phpunit-unit.xml, tests/Unit +composer test:all # full phpunit.xml suite; needs a Nextcloud server tree (skips otherwise) +``` + +JavaScript (Vitest, config in `vitest.config.js`, specs in `tests/vitest/`): + +```bash +npm test # vitest run +npm run test:coverage # with coverage summary +``` + +End-to-end (Playwright, config in `playwright.config.ts`, specs in `tests/e2e/`): + +```bash +npm run test:e2e # all projects +npm run test:smoke # smoke project only +``` + +Translations and manifest: + +```bash +npm run test:l10n # every t()/n() key is present in l10n/en.json +npm run test:l10n:parity # opt-in check that every required locale is complete +npm run check:manifest # schema-validates src/manifest.json +``` + +## Lint and quality + +```bash +composer check # lint, phpcs, psalm, test:unit +composer check:strict # lint, phpcs, phpmd, psalm, phpstan, test:all +composer cs:check # php-cs-fixer dry run (composer cs:fix to apply) +composer phpcs # PHP_CodeSniffer with phpcs.xml +composer phpstan +composer psalm +npm run lint # ESLint over src, tests, scripts +npm run stylelint +npm run format # Prettier check (npm run format:fix to apply) +``` + +## OpenSpec flow + +Work is planned with OpenSpec (`openspec/config.yaml`, schema `conduction`): + +1. A change starts in `openspec/changes//` with `proposal.md`, `design.md`, `tasks.md` and delta specs under `specs/`. +2. Accepted requirements live in `openspec/specs//spec.md` (see `openspec/specs/README.md`). +3. Finished changes move to `openspec/changes/archive/-/`. + +Templates for these files are in `openspec/schemas/conduction/templates/`. + +## Architecture decisions + +App-level decisions that have shipped are recorded as numbered records in [docs/adr/](docs/adr/README.md). New decisions are first written in the `design.md` file of an OpenSpec change (`openspec/changes/**/design.md`, including `archive/`). `docs/ARCHITECTURE.md` describes the services and the synchronisation design. The files under `.claude/openspec/architecture/` are copies of organisation-wide records, not decisions specific to this app. + +## Repo conventions + +- Thin client: the app owns no database tables; all data goes through OpenRegister. The register definition is `lib/Settings/softwarecatalogus_register.json`, and there is no `lib/Migration/` directory. +- Pages and navigation are manifest configuration: `src/manifest.json` declares the pages, and `src/main.js` merges the per-change fragments in `src/manifest.d/` at build time and primes the router from the manifest pages. +- User-visible strings are wrapped for translation; `l10n/` holds the catalogues and `npm run test:l10n` checks coverage. + +## Commit format + +Conventional Commits (`feat:`, `fix:`, `chore:`, `docs:`, `refactor:`), present tense, imperative mood, first line at most 72 characters, as stated in `CONTRIBUTING.md`. diff --git a/CHANGELOG.md b/CHANGELOG.md index 74c048e88..274ac0fb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,35 @@ ## [Unreleased] ### Added +- Health and metrics documentation (adopt-apphost): `docs/features/observability.md` + describes the public `/api/health` check, the administrator-only Prometheus + `/api/metrics`, the manifest's `observability` block that drives both, and + why `/api/settings/status` is not a health check. +- MCP action surface (mcp-full-action-surface), for hermiq agents: 28 derived + read tools (search and get on 14 catalogue schemas), create and update on + `vulnerability`, and 27 curated tools in the `stackiq` provider. The curated + tools cover the caller's profile, offers and usages, portfolio report, + moderation, reviews, SBOM import and status, architecture views, + organisation merge (with a preview), publication and the end-of-life sync. + Every tool runs the guard its REST route runs; organisation membership + grant and revoke are not tools yet. +- Integration leaves (adopt-integration-leaves): contact persons and + organisations link their Nextcloud contact (`contacts`), contracts and module + versions get a `calendar` tab, software reviews a `deck` tab, modules and + services `bookmarks`. A contract keeps its `decidesk-decisions` leaf. +- Lifecycle dates on the calendar: saving a contract keeps one linked + "Contract ends: {contractNumber}" event on its end date, and saving a module + version one "End of support: {module} {version}" event on its end-of-support + date (including dates the EOL sync stamps again). A changed date moves the + event, a cleared date removes it, and an unavailable calendar only logs a + warning. - CMDB import: a Nextcloud admin imports a TOPdesk CMDB export (xlsx) for one municipality from the admin settings. Every application row of the two CMDB sheets becomes or updates a module, its vendor, a usage for the municipality and a contact person for its owner; a repeat import matches on APPID, so it updates instead of duplicating. See `docs/features/cmdb-import.md`. - CMDB import: on an OpenRegister with the migration-pack editor - (openregister#4602), the import runs the mapping packs kept in + (OpenRegister 2.1.41 or later), the import runs the mapping packs kept in OpenRegister's migration pack store, where an administrator edits them. The `SeedCmdbImportPacks` repair step stores them on install and upgrade; a pack nobody edited follows newer releases, an edited one is kept. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 000000000..43c994c2d --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..7f61bdbd9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,109 @@ +# syntax=docker/dockerfile:1 +# +# Evaluation image for stackiq: the official Nextcloud image with this app, +# built from this repository, and OpenRegister, taken from its release. +# +# docker build -t ghcr.io/conductionnl/stackiq . +# +# The supported production install is still the Nextcloud App Store. This image +# is for trying the app out, for demos and for test environments. +# +# Rendered from ConductionNL/.github templates/app-deploy. Change the template, +# not this copy, and render it again. +# +# SPDX-FileCopyrightText: 2026 Conduction B.V. +# SPDX-License-Identifier: EUPL-1.2 + +# Nextcloud 33 is the newest major whose image still ships PHP 8.3. The 34 and +# 35 images ship PHP 8.5, which some apps in the fleet do not support yet. +ARG NEXTCLOUD_IMAGE=nextcloud:33.0.10-apache +ARG APP_ID=stackiq + +# ── Frontend: the same steps the release workflow runs ── +FROM node:22-bookworm-slim AS frontend +WORKDIR /app +COPY . . +# Honour engines.npm: Node 22 bundles npm 10, several apps require npm 11. +RUN set -eu; \ + range="$(node -p "((require('./package.json').engines)||{}).npm||''")"; \ + if [ -n "$range" ]; then npm install -g "npm@$range"; fi; \ + npm ci --no-audit --no-fund; \ + npm run build; \ + rm -rf node_modules + +# ── Backend: runtime composer dependencies only ── +FROM composer:2 AS vendor +WORKDIR /app +COPY --from=frontend /app /app +# The lock was resolved for the app's own platform; the composer image does not +# carry Nextcloud's PHP extensions, so platform checks are left to Nextcloud. +RUN composer install --no-dev --no-interaction --no-progress \ + --optimize-autoloader --classmap-authoritative --ignore-platform-reqs + +# ── Package: the same file set as the release tarball ── +FROM alpine:3.20 AS package +ARG APP_ID +# hadolint ignore=DL3018 +RUN apk add --no-cache rsync +COPY --from=vendor /app /app +RUN mkdir -p "/out/${APP_ID}" && rsync -a \ + --exclude='/.git*' --exclude='/.github' --exclude='/.claude' \ + --exclude='/.hydra' --exclude='/.vscode' --exclude='/.nextcloud' \ + --exclude='/docker' --exclude='/charts' \ + --exclude='/Dockerfile' --exclude='/.dockerignore' \ + --exclude='/docker-compose*.yml' --exclude='/*-compose.yaml' \ + --exclude='/docs' --exclude='/docusaurus' --exclude='/website' \ + --exclude='/node_modules' \ + --include='/src/' --include='/src/manifest.json' --exclude='/src/*' \ + --exclude='/tests' --exclude='/test-scenarios' --exclude='/openspec' \ + --exclude='/data' --exclude='/resources' --exclude='/phpcs-custom-sniffs' \ + --exclude='/package*.json' --exclude='/composer.*' \ + --exclude='/*.config.js' --exclude='/*.config.mjs' --exclude='/*.config.ts' \ + --exclude='/php*.xml' --exclude='/psalm.xml' --exclude='/phpstan*' \ + --exclude='/sbom.cdx.json' --exclude='/.phpunit*' \ + /app/ "/out/${APP_ID}/" + +# ── OpenRegister: the newest stable release, checked against its SHA-256 ── +FROM alpine:3.20 AS openregister +ARG APP_ID +# Empty means the newest stable release at build time. Prereleases are refused. +# Pin it for a reproducible build: --build-arg OPENREGISTER_VERSION=2.1.0 +ARG OPENREGISTER_VERSION= +SHELL ["/bin/ash", "-euo", "pipefail", "-c"] +# hadolint ignore=DL3018 +RUN apk add --no-cache curl jq tar +RUN mkdir -p /out; \ + if [ "${APP_ID}" = "openregister" ]; then exit 0; fi; \ + version="${OPENREGISTER_VERSION#v}"; \ + if [ -z "$version" ]; then \ + version="$(curl -fsSL https://api.github.com/repos/ConductionNL/openregister/releases/latest \ + | jq -r '.tag_name' | sed 's/^v//')"; \ + fi; \ + case "$version" in \ + ''|*-*) echo "OpenRegister '$version' is not a stable release" >&2; exit 1 ;; \ + esac; \ + base="https://github.com/ConductionNL/openregister/releases/download/v${version}/openregister-${version}.tar.gz"; \ + curl -fsSL -o /tmp/or.tar.gz "$base"; \ + sha="$(curl -fsSL "${base}.sha256" | cut -d' ' -f1)"; \ + echo "${sha} /tmp/or.tar.gz" | sha256sum -c -; \ + mkdir /tmp/stage && tar -xzf /tmp/or.tar.gz -C /tmp/stage; \ + mv "$(find /tmp/stage -mindepth 1 -maxdepth 1 -type d | head -n 1)" /out/openregister; \ + printf '%s sha256:%s\n' "$version" "$sha" > /out/openregister/.image-release + +# ── Runtime ── +# hadolint ignore=DL3006 +FROM ${NEXTCLOUD_IMAGE} +ARG APP_ID +LABEL org.opencontainers.image.title="${APP_ID}" \ + org.opencontainers.image.description="Nextcloud with ${APP_ID} and OpenRegister, for evaluation" \ + org.opencontainers.image.source="https://github.com/ConductionNL/${APP_ID}" \ + org.opencontainers.image.vendor="Conduction B.V." +# The entrypoint copies these into the custom_apps volume on first start; the +# before-starting hook keeps that copy in step with the image afterwards. +COPY --from=openregister --chown=www-data:www-data /out/ /usr/src/nextcloud/custom_apps/ +COPY --from=package --chown=www-data:www-data /out/ /usr/src/nextcloud/custom_apps/ +COPY --chmod=0755 docker/entrypoint-hooks/before-starting/ /docker-entrypoint-hooks.d/before-starting/ +# Enabled in this order: OpenRegister owns the registers the app declares into. +ENV NEXTCLOUD_IMAGE_APPS="openregister ${APP_ID}" +# Apache starts as root to bind port 80 and serves every request as www-data; +# the entrypoint and its hooks run occ as www-data too. diff --git a/README.md b/README.md index 24811141d..989b3b815 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,29 @@ npm run build php occ app:enable stackiq ``` +### Try it with Docker + +The repository builds an evaluation image: the official Nextcloud image with stackiq and OpenRegister installed and enabled. It is meant for trying the app out and for test environments. For production, install the app from the Nextcloud App Store. + +```bash +docker compose -f docker-compose.yml up -d --build +``` + +Open http://localhost:8080/apps/stackiq/ and sign in as `admin` with password `admin`. The first start takes a minute or two. Set `NEXTCLOUD_ADMIN_PASSWORD` and `APP_PORT` to change the password and the port; `docker-compose.yml` lists every setting. `docker compose -f docker-compose.yml down -v` removes the stack and its data. + +Released versions are published as `ghcr.io/conductionnl/stackiq`, so leaving out `--build` uses the published image. + +### Run it on Kubernetes + +`charts/stackiq` wraps the official [Nextcloud Helm chart](https://github.com/nextcloud/helm) and runs the same image with PostgreSQL: + +```bash +helm dependency build charts/stackiq +helm install stackiq charts/stackiq --set nextcloud.nextcloud.host=stackiq.example.org +``` + +Change the passwords in `charts/stackiq/values.yaml` before you install it anywhere that matters. + ## Development ### Start the environment @@ -208,6 +231,12 @@ Every commit runs through the [Conduction quality workflow](https://github.com/C All checks must pass before a release. Run locally with `composer check:strict` (full PHP pipeline) or `npm run lint` (frontend). +### Test coverage + + +Measured test coverage: 85.7% of statements (PHP 85.0% of 31,623 statements, JavaScript 87.9% of 8,915 statements), at commit `e75ababa` on 2026-11-13. The figures come from [`coverage-summary.json`](coverage-summary.json); refresh them with `composer coverage:publish`. + + ### API Tests (454 Assertions) A dedicated Newman/Postman collection validates the entire API surface with **454 automated assertions** across 334 requests organized in 11 test folders: diff --git a/REUSE.toml b/REUSE.toml new file mode 100644 index 000000000..fcbafe0eb --- /dev/null +++ b/REUSE.toml @@ -0,0 +1,16 @@ +# SPDX-FileCopyrightText: 2026 Conduction B.V. +# SPDX-License-Identifier: EUPL-1.2 + +# Licensing for files that cannot carry a header of their own. +# See https://reuse.software/spec-3.3/#reusetoml +version = 1 +SPDX-PackageName = "stackiq" +SPDX-PackageSupplier = "Conduction B.V. " +SPDX-PackageDownloadLocation = "https://github.com/ConductionNL/stackiq" + +# Translation catalogues, written by the translation tooling in a fixed format. +[[annotations]] +path = ["l10n/**.js", "l10n/**.json"] +precedence = "aggregate" +SPDX-FileCopyrightText = "2026 Conduction B.V. " +SPDX-License-Identifier = "EUPL-1.2" diff --git a/SECURITY.md b/SECURITY.md index 0c0df29b2..8e7b8daf2 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -60,7 +60,7 @@ curl -sL https://github.com/ConductionNL/stackiq/releases/download/v1.0.0/sbom.c ### Update cadence -A new SBOM is generated and attached on every release tag. We do not commit SBOMs into the repository tree — they are published exclusively as release assets to keep main-branch history clean and to guarantee every SBOM corresponds to an immutable release artifact. +A new SBOM is generated and attached on every release tag. The `sbom.cdx.json` at the repository root is a snapshot of the dependencies on the `development` branch. For an SBOM that matches an immutable release, use the release assets above. ### Format diff --git a/appinfo/info.xml b/appinfo/info.xml index aa719115b..21d4d4797 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -50,7 +50,8 @@ Vrij en open source onder de EUPL-licentie. **Ondersteuning:** Voor ondersteuning, neem contact op via support@conduction.nl. Voor een Service Level Agreement (SLA), neem contact op via sales@conduction.nl. ]]> - 0.2.6-unstable.20261012120000 + 0.2.14-unstable.20261122023915 + EUPL-1.2 Conduction Stackiq @@ -99,6 +100,8 @@ Vrij en open source onder de EUPL-licentie. OCA\Stackiq\BackgroundJob\ContractStatusJob OCA\Stackiq\BackgroundJob\FederationSyncJob OCA\Stackiq\BackgroundJob\EolSyncJob + OCA\Stackiq\BackgroundJob\RoleGrantSyncJob + OCA\Stackiq\BackgroundJob\AttestationOverdueJob @@ -230,10 +233,39 @@ Vrij en open source onder de EUPL-licentie. would rewrite a key nothing reads. Idempotent, and guarded on the exact stored value so an admin's own register is never touched. --> OCA\Stackiq\Repair\RepointEolSyncConfig + + OCA\Stackiq\Repair\ClearDisallowedDependentValues OCA\Stackiq\Repair\InitializeSettings + + OCA\Stackiq\Repair\BackfillConnectionSharing + + OCA\Stackiq\Repair\BackfillUsageProvider + + OCA\Stackiq\Repair\RestoreReviewReadRule OCA\Stackiq\Repair\MigrateContactsToNc OCA\Stackiq\Repair\BackfillContractApprovalState + + OCA\Stackiq\Repair\DefaultComplianceResultToMeets OCA\Stackiq\Repair\BackfillModuleVersionPublication + + OCA\Stackiq\Repair\BackfillRecordStatus + + OCA\Stackiq\Repair\RescoreDataQuality OCA\Stackiq\Repair\SeedCmdbImportPacks + + OCA\Stackiq\Repair\LogSwitchedOffSync + + OCA\Stackiq\Repair\SeedRolesFromGroups OCA\Stackiq\Repair\RepointEolSyncConfig + + OCA\Stackiq\Repair\ClearDisallowedDependentValues OCA\Stackiq\Repair\InitializeSettings + + OCA\Stackiq\Repair\RestoreReviewReadRule OCA\Stackiq\Repair\SeedCmdbImportPacks + + OCA\Stackiq\Repair\SeedRolesFromGroups @@ -344,6 +395,14 @@ Vrij en open source onder de EUPL-licentie. shared `contractNumber`: a wrong cross-app link is worse than an empty one. --> OCA\Stackiq\Command\ReferencesAuditCommand + + OCA\Stackiq\Command\OrganisationLinkCommand + + OCA\Stackiq\Command\GemmaStandardLinksCommand diff --git a/appinfo/routes.php b/appinfo/routes.php index 5558d9de5..a0b135825 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -13,9 +13,13 @@ * @author Conduction b.v. * @license EUPL-1.2 https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12 * @link https://github.com/ConductionNL/stackiq + * + * SPDX-FileCopyrightText: 2024 Conduction B.V. + * SPDX-License-Identifier: EUPL-1.2 */ -return [ +// Every unversioned API route is also served under /api/v1/; see ApiPathAliases. +return \OCA\Stackiq\Middleware\Support\ApiPathAliases::withVersionedAliases([ 'routes' => [ // Dashboard routes // First-time setup wizard (ADR-042) - the standard CnSetupWizard contract. @@ -24,6 +28,8 @@ ['name' => 'setup#saveConfig', 'url' => '/api/setup/config', 'verb' => 'POST'], ['name' => 'dashboard#page', 'url' => '/', 'verb' => 'GET'], ['name' => 'dashboard#index', 'url' => '/api/dashboard', 'verb' => 'GET'], + // The OpenAPI document, public (spec api-contract). + ['name' => 'openApi#show', 'url' => '/api/openapi.json', 'verb' => 'GET'], // Generic per-user preferences (used by shared nextcloud-vue widgets, e.g. CnSupportDialog). ['name' => 'preferences#getPreference', 'url' => '/api/preferences/{key}', 'verb' => 'GET'], @@ -35,6 +41,8 @@ ['name' => 'contractApproval#config', 'url' => '/api/contracts/approval/config', 'verb' => 'GET'], ['name' => 'contractApproval#submit', 'url' => '/api/contracts/{contractUuid}/approval/submit', 'verb' => 'POST'], ['name' => 'contractApproval#submitRenewal', 'url' => '/api/contracts/{contractUuid}/approval/renewal', 'verb' => 'POST'], + // A reviewer outside the supplier marks a compliance claim verified (REQ-CLR-022). + ['name' => 'complianceVerification#verify', 'url' => '/api/compliancy/{id}/verify', 'verb' => 'POST'], // Core Settings API routes (minimal, for basic app functionality) ['name' => 'settings#index', 'url' => '/api/settings', 'verb' => 'GET'], @@ -81,7 +89,13 @@ ['name' => 'settings#getEmailTemplateDefault', 'url' => '/api/email/templates/{templateName}/default', 'verb' => 'GET'], ['name' => 'settings#getEmailTemplateVariables', 'url' => '/api/email/templates/{templateName}/variables', 'verb' => 'GET'], - // Note: /api/health is served by settings#status above + // Health and metrics (adopt-apphost task 2.2): the OpenRegister AppHost + // generics, registered as Health/MetricsController in Application.php and + // driven by the manifest's `observability` block. Health is public (an + // uptime probe needs no session), metrics are administrators only. + // `settings#status` above is the settings configuration status, not health. + ['name' => 'health#index', 'url' => '/api/health', 'verb' => 'GET'], + ['name' => 'metrics#index', 'url' => '/api/metrics', 'verb' => 'GET'], // Configuration cache management ['name' => 'settings#clearCache', 'url' => '/api/settings/clear-cache', 'verb' => 'POST'], @@ -95,7 +109,11 @@ // ArchiMate import/export routes ['name' => 'settings#importArchiMate', 'url' => '/api/archimate/import', 'verb' => 'POST'], ['name' => 'settings#exportArchiMate', 'url' => '/api/archimate/export', 'verb' => 'POST'], + // @spec openspec/changes/architecture-round-trip-check/specs/archimate-round-trip-check/spec.md#requirement-req-art-003-only-an-admin-shall-run-the-check-and-the-old-round-trip-endpoint-shall-be-removed + ['name' => 'settings#checkArchiMateRoundTrip', 'url' => '/api/archimate/round-trip-check', 'verb' => 'POST'], ['name' => 'settings#exportOrgArchiMate', 'url' => '/api/archimate/export/organization/{organizationUuid}', 'verb' => 'GET'], + // Whether the caller may export that organisation: the detail page's action asks before it shows (insight-exports-and-custom-reports). + ['name' => 'settings#orgExportAccess', 'url' => '/api/archimate/export/organization/{organizationUuid}/access', 'verb' => 'GET'], ['name' => 'settings#downloadArchiMate', 'url' => '/api/archimate/download/{fileName}', 'verb' => 'GET'], // ArchiMate status management routes (status reading is via main settings endpoint) @@ -110,7 +128,7 @@ ['name' => 'cmdbImport#import', 'url' => '/api/cmdb-import', 'verb' => 'POST'], ['name' => 'cmdbImport#cancel', 'url' => '/api/cmdb-import/{operationId}/cancel', 'verb' => 'POST'], // The mapping the CMDB import uses, read-only — same posture as the import (Nextcloud admins only, CSRF). - // @spec openspec/changes/cmdb-import-mapping-view/specs/cmdb-export-import/spec.md#requirement-the-admin-settings-shall-show-the-mapping-the-import-uses-req-cmdb-020 + // @spec openspec/specs/cmdb-export-import/spec.md#requirement-the-admin-settings-shall-show-the-mapping-the-import-uses-req-cmdb-020 ['name' => 'settings#getCmdbImportMapping', 'url' => '/api/settings/cmdb-import/mapping', 'verb' => 'GET'], // User Groups management routes @@ -186,6 +204,13 @@ ['name' => 'contactpersonen#disableUser', 'url' => '/api/contactpersonen/{contactpersoonId}/disable', 'verb' => 'POST'], ['name' => 'contactpersonen#enableUser', 'url' => '/api/contactpersonen/{contactpersoonId}/enable', 'verb' => 'POST'], + // Access review (organisations-role-mapping-and-access-review): a Nextcloud + // admin for any organisation, a functioneel-beheerder or organisatie-beheerder + // for their own active organisation; the controller checks before any read. + ['name' => 'accessReview#index', 'url' => '/api/access-review/{organisationUuid}', 'verb' => 'GET'], + ['name' => 'accessReview#confirm', 'url' => '/api/access-review/{contactPersonId}/confirm', 'verb' => 'POST'], + ['name' => 'accessReview#withdraw', 'url' => '/api/access-review/{contactPersonId}/withdraw', 'verb' => 'POST'], + // ======================================================================== // VIEW API ENDPOINTS - ArchiMate Views with Enrichment Support // ======================================================================== @@ -193,6 +218,8 @@ // View API endpoints for querying and enriching ArchiMate views ['name' => 'view#getAllViews', 'url' => '/api/views', 'verb' => 'GET'], ['name' => 'view#getApiDocumentation', 'url' => '/api/views/docs', 'verb' => 'GET'], + ['name' => 'view#getViewImage', 'url' => '/api/views/{viewId}/image.svg', 'verb' => 'GET'], + ['name' => 'viewDocument#createViewDocument', 'url' => '/api/views/{viewId}/document', 'verb' => 'POST'], ['name' => 'view#getView', 'url' => '/api/views/{viewId}', 'verb' => 'GET'], // ======================================================================== @@ -203,14 +230,26 @@ // @spec openspec/specs/gemma-faceted-search/spec.md#requirement-facet-aggregation-endpoint-returns-gemma-dimension-counts ['name' => 'facet#getFacets', 'url' => '/api/facets/{schema}', 'verb' => 'GET'], + // The Applications and Services lists as filtered, as CSV or XLSX (insight-exports-and-custom-reports). + // @spec openspec/changes/insight-exports-and-custom-reports/specs/catalogue-exports-and-reports/spec.md#requirement-req-cer-002-the-applications-and-services-pages-shall-export-the-rows-the-facets-the-quick-filter-and-the-search-leave + ['name' => 'catalogExport#export', 'url' => '/api/catalog/{schema}/export', 'verb' => 'GET'], + // ======================================================================== // AANBOD API ENDPOINTS - Unified API for all aanbod types // ======================================================================== // Aanbod API endpoints for managing offers (gebruik, dienst, module, koppeling) ['name' => 'aanbod#getAanbod', 'url' => '/api/aanbod', 'verb' => 'GET'], + // Usages other organisations claim of the active organisation's products (supplier-accepts-claimed-usage). + ['name' => 'claimedUsage#index', 'url' => '/api/aanbod/claimed', 'verb' => 'GET'], + ['name' => 'claimedUsage#accept', 'url' => '/api/aanbod/claimed/{uuid}/accept', 'verb' => 'PUT'], + ['name' => 'claimedUsage#decline', 'url' => '/api/aanbod/claimed/{uuid}/decline', 'verb' => 'PUT'], ['name' => 'aanbod#acceptAanbod', 'url' => '/api/aanbod/{uuid}/accept', 'verb' => 'PUT'], ['name' => 'aanbod#denyAanbod', 'url' => '/api/aanbod/{uuid}/deny', 'verb' => 'DELETE'], + // Derived connection suggestions of a usage (connections-derived-dependencies REQ-DCN-001..003). + ['name' => 'connectionSuggestion#index', 'url' => '/api/usages/{uuid}/connection-suggestions', 'verb' => 'GET'], + ['name' => 'connectionSuggestion#accept', 'url' => '/api/usages/{uuid}/connection-suggestions/accept', 'verb' => 'POST'], + ['name' => 'connectionSuggestion#dismiss', 'url' => '/api/usages/{uuid}/connection-suggestions/dismiss', 'verb' => 'POST'], // OPEN-DATA PUBLISH ENDPOINTS — set/clear publicatiedatum (the live OR // RBAC publish gate). Authenticated + per-object ownership guard (IDOR-safe). @@ -234,6 +273,8 @@ // submission (author/status always server-stamped, never from the // client) + public approved-only aggregate for module/dienst detail. ['name' => 'review#submit', 'url' => '/api/reviews', 'verb' => 'POST'], + // Ask the catalogue (insight-assistant-answers-and-action-trail D1): read only. + ['name' => 'ask#ask', 'url' => '/api/ask', 'verb' => 'POST'], ['name' => 'review#aggregate', 'url' => '/api/reviews/aggregate', 'verb' => 'GET'], // ORGANISATION MERGE (gemeentelijke herindeling / leveranciersovername) — @@ -241,6 +282,16 @@ // @spec openspec/specs/organisation-merge/spec.md#requirement-both-merge-endpoints-must-be-admin-only-with-an-explicit-per-object-authorization-guard ['name' => 'merge#dryRun', 'url' => '/api/organisaties/{uuid}/merge/dry-run', 'verb' => 'POST'], ['name' => 'merge#execute', 'url' => '/api/organisaties/{uuid}/merge', 'verb' => 'POST'], + // landscape-move-between-organisations: move chosen entries to another organisation, keeping their identity. + ['name' => 'ownershipTransfer#plan', 'url' => '/api/ownership-transfers/plan', 'verb' => 'POST'], + ['name' => 'ownershipTransfer#execute', 'url' => '/api/ownership-transfers/execute', 'verb' => 'POST'], + + // ENTRY TYPE CHANGE — an application becomes a service or system software and + // back without a new uuid. The caller's own rights on both schemas are checked + // in EntryTypeService before OpenRegister moves the object. + // @spec openspec/changes/landscape-change-entry-type/specs/entry-type-change/spec.md#requirement-req-etc-001-an-entry-changes-type-and-keeps-its-identity + ['name' => 'entryType#preview', 'url' => '/api/entries/{uuid}/type-change', 'verb' => 'GET'], + ['name' => 'entryType#change', 'url' => '/api/entries/{uuid}/type-change', 'verb' => 'POST'], // SELF-SERVICE COLLEAGUE ACCESS (multi-org-membership) — beheerder-of-this- // organisation gated (authorizeBeheerder() guard in the controller body, @@ -255,6 +306,7 @@ ['name' => 'federation#addPeer', 'url' => '/api/federation/peers', 'verb' => 'POST'], ['name' => 'federation#removePeer', 'url' => '/api/federation/peers', 'verb' => 'DELETE'], ['name' => 'federation#pull', 'url' => '/api/federation/pull', 'verb' => 'POST'], + ['name' => 'federation#setEnabled', 'url' => '/api/federation/enabled', 'verb' => 'PUT'], // ======================================================================== // AANGEBODEN GEBRUIK API ENDPOINTS - Custom Objects API for Gebruiks (Legacy) @@ -302,6 +354,8 @@ ['name' => 'settings#updateEolSyncConfig', 'url' => '/api/eol-sync/config', 'verb' => 'POST'], ['name' => 'settings#triggerEolSync', 'url' => '/api/eol-sync/trigger', 'verb' => 'POST'], ['name' => 'settings#getEolSyncStatus', 'url' => '/api/eol-sync/status', 'verb' => 'GET'], + // The organisation sync's schedule, last run and running run (operations-sync-status-and-progress). + ['name' => 'syncStatus#status', 'url' => '/api/sync/status', 'verb' => 'GET'], // SERVICE DESK EXCHANGE (sharing-itsm-exchange): status for the CMDB // page, set-up and file import for admins. The flows themselves run @@ -314,10 +368,34 @@ // Gebruik by group ['name' => 'gebruik#getGebruiken', 'url' => '/api/gebruik', 'verb' => 'GET'], ['name' => 'gebruik#getGebruikenForDeelnemer', 'url' => '/api/gebruik/deelnemer', 'verb' => 'GET'], + // @spec openspec/changes/shared-usage-visible-to-participants/specs/deelnames-gebruik/spec.md#requirement-the-connections-list-says-with-whom-a-connection-is-shared-req-dlg-011 + ['name' => 'gebruik#getSharedConnections', 'url' => '/api/gebruik/shared-connections', 'verb' => 'GET'], + // security-baseline-classification REQ-BCL-003/004: the GEMMA suggestion and the anonymous summary. + ['name' => 'usageClassification#suggestion', 'url' => '/api/gebruik/{usageId}/classification-suggestion', 'verb' => 'GET'], + ['name' => 'usageClassification#summary', 'url' => '/api/modules/{moduleId}/classification-summary', 'verb' => 'GET'], // Portfolio rationalization report (TIME quadrants + EOL + cloud + cost), JSON or CSV (?format=csv). // @spec openspec/changes/portfolio-rationalization-time/specs/portfolio-rationalization-time/spec.md#requirement-portfolio-rationalization-report-aggregates-per-organisation ['name' => 'portfolioReport#index', 'url' => '/api/portfolio-report', 'verb' => 'GET'], + // @spec openspec/changes/landscape-completeness-score/specs/catalogue-data-quality/spec.md#requirement-req-cdq-003-a-data-quality-page-shows-how-complete-and-current-an-organisation-s-register-is + ['name' => 'dataQualityReport#index', 'url' => '/api/data-quality', 'verb' => 'GET'], + // @spec openspec/changes/landscape-completeness-score/specs/catalogue-data-quality/spec.md#requirement-req-cdq-002-a-user-confirms-an-entry-is-current-and-its-freshness-resets + [ + 'name' => 'entryConfirmation#confirm', + 'url' => '/api/data-quality/confirm/{kind}/{id}', + 'verb' => 'POST', + 'requirements' => ['kind' => 'module|usage'], + ], + // @spec openspec/changes/architecture-reference-component-coverage/specs/reference-component-coverage/spec.md#requirement-req-rcc-001-stackiq-shall-give-each-reference-component-a-coverage-state-for-one-organisation + // @spec openspec/changes/gemma-plate-views-peers-and-definitions/specs/gemma-plate/spec.md#requirement-the-plate-shows-what-comparable-organisations-use-req-gpl-002 + ['name' => 'referenceComponentCoverage#peers', 'url' => '/api/reference-component-coverage/peers', 'verb' => 'GET'], + ['name' => 'referenceComponentCoverage#index', 'url' => '/api/reference-component-coverage', 'verb' => 'GET'], + // @spec openspec/changes/architecture-future-state-scenarios/specs/future-state-scenarios/spec.md#requirement-req-fss-002-an-information-manager-shall-compare-todays-landscape-with-the-plan-on-a-date + ['name' => 'landscapeComparison#index', 'url' => '/api/landscape-comparison', 'verb' => 'GET'], + // @spec openspec/changes/landscape-owner-attestation/specs/owner-attestation/spec.md#requirement-req-oat-001-an-information-manager-starts-a-confirmation-round-for-a-scope + ['name' => 'attestation#start', 'url' => '/api/attestation-rounds', 'verb' => 'POST'], + // @spec openspec/changes/landscape-owner-attestation/specs/owner-attestation/spec.md#requirement-req-oat-003-an-owner-confirms-or-corrects-each-entry + ['name' => 'attestation#confirm', 'url' => '/api/attestation-requests/{id}/confirm', 'verb' => 'POST'], // SPA catch-all — serves the Vue app for any frontend route (history mode routing) // `postfix` keeps this SPA catch-all from colliding with the bare-root @@ -329,4 +407,4 @@ // match an empty path. ['name' => 'dashboard#page', 'url' => '/{path}', 'verb' => 'GET', 'requirements' => ['path' => '.+'], 'defaults' => ['path' => ''], 'postfix' => 'spa'], ], -]; +]); diff --git a/charts/stackiq/.gitignore b/charts/stackiq/.gitignore new file mode 100644 index 000000000..93b4d6e14 --- /dev/null +++ b/charts/stackiq/.gitignore @@ -0,0 +1,2 @@ +# Fetched by `helm dependency build`; Chart.lock pins the version. +charts/ diff --git a/charts/stackiq/.helmignore b/charts/stackiq/.helmignore new file mode 100644 index 000000000..19965bae9 --- /dev/null +++ b/charts/stackiq/.helmignore @@ -0,0 +1,5 @@ +.DS_Store +.git/ +*.tgz.prov +*.orig +*.swp diff --git a/charts/stackiq/Chart.lock b/charts/stackiq/Chart.lock new file mode 100644 index 000000000..cfd7b32ce --- /dev/null +++ b/charts/stackiq/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: nextcloud + repository: https://nextcloud.github.io/helm/ + version: 9.4.1 +digest: sha256:4061c443b9e3af22200fb7c95d889a5b20bc260098c5479707340e37cd14f5e2 +generated: "2026-11-11T23:55:49.035197134+01:00" diff --git a/charts/stackiq/Chart.yaml b/charts/stackiq/Chart.yaml new file mode 100644 index 000000000..f7ca10abf --- /dev/null +++ b/charts/stackiq/Chart.yaml @@ -0,0 +1,18 @@ +# Rendered from ConductionNL/.github templates/app-deploy. +apiVersion: v2 +name: stackiq +description: Nextcloud with stackiq and OpenRegister, on the official Nextcloud chart. For evaluation and test environments. +type: application +version: 0.1.0 +appVersion: "latest" +home: https://github.com/ConductionNL/stackiq +sources: + - https://github.com/ConductionNL/stackiq + - https://github.com/nextcloud/helm +maintainers: + - name: Conduction B.V. + email: info@conduction.nl +dependencies: + - name: nextcloud + version: 9.4.1 + repository: https://nextcloud.github.io/helm/ diff --git a/charts/stackiq/templates/NOTES.txt b/charts/stackiq/templates/NOTES.txt new file mode 100644 index 000000000..95689c33f --- /dev/null +++ b/charts/stackiq/templates/NOTES.txt @@ -0,0 +1,10 @@ +{{- /* Rendered from ConductionNL/.github templates/app-deploy. */ -}} +stackiq is starting on Nextcloud (image {{ .Values.nextcloud.image.registry }}/{{ .Values.nextcloud.image.repository }}:{{ .Values.nextcloud.image.tag }}). + +The first start installs Nextcloud and enables OpenRegister and stackiq, +which takes a few minutes. Follow it with: + + kubectl logs -f -n {{ .Release.Namespace }} deploy/{{ .Release.Name }}-nextcloud + +Then open https://{{ .Values.nextcloud.nextcloud.host }}/apps/stackiq/ and sign in as +{{ .Values.nextcloud.nextcloud.username }}. diff --git a/charts/stackiq/values.yaml b/charts/stackiq/values.yaml new file mode 100644 index 000000000..0a5e16af6 --- /dev/null +++ b/charts/stackiq/values.yaml @@ -0,0 +1,53 @@ +# Values for the stackiq evaluation chart. Everything under `nextcloud:` is +# passed to the official Nextcloud chart; see +# https://github.com/nextcloud/helm/tree/main/charts/nextcloud for all options. +# +# The image is ghcr.io/conductionnl/stackiq: the official Nextcloud image +# with stackiq and OpenRegister baked in. Its before-starting hook enables +# both apps, so no hook or app list is needed here. +# +# helm dependency build charts/stackiq +# helm install stackiq charts/stackiq \ +# --set nextcloud.nextcloud.host=stackiq.example.org \ +# --set nextcloud.nextcloud.password= \ +# --set nextcloud.postgresql.global.postgresql.auth.password= +# +# Rendered from ConductionNL/.github templates/app-deploy. + +nextcloud: + image: + registry: ghcr.io + repository: conductionnl/stackiq + # Pin a released version for anything you want to keep. + tag: latest + pullPolicy: IfNotPresent + + nextcloud: + host: stackiq.local + username: admin + # Set your own, or point existingSecret at a Secret you manage. + password: changeme + + # OpenRegister needs a real database; SQLite is not supported. + internalDatabase: + enabled: false + externalDatabase: + enabled: true + type: postgresql + user: nextcloud + database: nextcloud + postgresql: + enabled: true + global: + postgresql: + auth: + username: nextcloud + password: changeme + database: nextcloud + primary: + persistence: + enabled: true + + persistence: + enabled: true + size: 8Gi diff --git a/compare_archimate.php b/compare_archimate.php index ab0ad79c3..b1fd46fd6 100644 --- a/compare_archimate.php +++ b/compare_archimate.php @@ -4,6 +4,9 @@ * * This script compares the original GEMMA_release.xml with the exported XML * to identify differences and ensure round-trip compatibility. + * + * SPDX-FileCopyrightText: 2025 Conduction B.V. + * SPDX-License-Identifier: EUPL-1.2 */ require_once '/var/www/html/lib/base.php'; diff --git a/compare_archimate.py b/compare_archimate.py index 116cf265a..eb53687ac 100644 --- a/compare_archimate.py +++ b/compare_archimate.py @@ -1,4 +1,7 @@ #!/usr/bin/env python3 +# SPDX-FileCopyrightText: 2026 Conduction B.V. +# SPDX-License-Identifier: EUPL-1.2 + """ ArchiMate XML Semantic Comparison Tool @@ -20,356 +23,302 @@ 2 = error (file not found, parse error, etc.) """ -import sys import json as json_module +import sys import xml.etree.ElementTree as ET -from collections import Counter +from collections import Counter, namedtuple NS = {"am": "http://www.opengroup.org/xsd/archimate/3.0/"} XSI = "http://www.w3.org/2001/XMLSchema-instance" +# Both parsed models with the outcome of compare(). +Comparison = namedtuple("Comparison", "original exported results all_pass") + + +def name_text(node): + """Stripped text of the node's child, or an empty string.""" + name_el = node.find("am:name", NS) + return (name_el.text or "").strip() if name_el is not None else "" + + +def xsi_type(node): + """The node's xsi:type attribute, or an empty string.""" + return node.get(f"{{{XSI}}}type", "") + + +def relationship_info(node): + """Type, source and target of a relationship node.""" + return { + "type": xsi_type(node), + "source": node.get("source", ""), + "target": node.get("target", ""), + } + + +# Section key -> (path of its nodes, value kept per identifier). +SECTION_NODES = { + "elements": (".//am:elements/am:element", xsi_type), + "relationships": (".//am:relationships/am:relationship", relationship_info), + "views": (".//am:views/am:diagrams/am:view", name_text), + "property_definitions": (".//am:propertyDefinitions/am:propertyDefinition", name_text), +} + + +def parse_section(root, key): + """Map identifier -> value for every node of a section that has an identifier.""" + path, value = SECTION_NODES[key] + return { + node.get("identifier", ""): value(node) + for node in root.findall(path, NS) + if node.get("identifier", "") + } + + +def parse_organizations(root): + """Count all organization s: total, element references and folders. + + ArchiMate organizations use with an optional identifierRef (an element + reference) or a