Remove local skills and use the shared catalog (#5)
Build Bifrost / build (push) Failing after 58s
Build Bifrost / build (push) Failing after 58s
Co-authored-by: Arnaud Dartois <admin@tordais.cc>
This commit was merged in pull request #5.
This commit is contained in:
1 parent
c9bb94bbc0
commit
bc4162a6c8
14 files changed
+8
-378
No files matched your search
@@ -1,37 +0,0 @@
|
|||||||
---
|
|
||||||
name: docker-test-environment
|
|
||||||
description: Use when changing the local Docker build, test Compose stack, SonarQube/Gitea/PostgreSQL images, or plugin mounting.
|
|
||||||
---
|
|
||||||
# Docker test environment
|
|
||||||
|
|
||||||
- Pin SonarQube Community Build to `25.9.0.112764-community` and pin PostgreSQL and Gitea image tags.
|
|
||||||
- Provide health checks and start dependencies before SonarQube; persist database data in named volumes.
|
|
||||||
- Mount the plugin JAR read-only into `/opt/sonarqube/extensions/plugins/` and restart SonarQube after packaging.
|
|
||||||
- Use test-only credentials from environment variables; never commit live tokens.
|
|
||||||
- Document Linux kernel prerequisites for Docker hosts (including `vm.max_map_count` where needed by the bundled search engine).
|
|
||||||
- Keep the Compose test stack isolated from production volumes and endpoints.
|
|
||||||
- Run full import tests under a dedicated Compose project name (`bifrost-e2e`) with its own named volumes. A clean reset may remove only that project's volumes. On Windows use `./scripts/e2e.ps1`; it invokes the native Windows Docker CLI rather than WSL Docker.
|
|
||||||
- Pin the browser runner image and Playwright npm dependency to the same release; keep `package-lock.json` and install with `npm ci`.
|
|
||||||
- Bootstrap Gitea through its CLI and documented API; configure SonarQube through documented Web APIs, then run a real Chromium page test.
|
|
||||||
- Leave the successful isolated stack available for inspection and document the exact command that removes it.
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
- [ ] All service image tags pinned.
|
|
||||||
- [ ] Health checks and durable named DB volumes present.
|
|
||||||
- [ ] Test plugin mount path correct.
|
|
||||||
- [ ] Setup and credentials documented safely.
|
|
||||||
- [x] Zero-to-import runner resets only its isolated project, checks readiness, and asserts created projects and links.
|
|
||||||
- [ ] Browser version and npm package are pinned together with a lockfile.
|
|
||||||
|
|
||||||
## Sources
|
|
||||||
- SonarQube Docker setup: https://docs.sonarsource.com/sonarqube-community-build/server-update-and-maintenance/update/update (consulted 2026-10-28)
|
|
||||||
- SonarQube Docker image tags: https://hub.docker.com/_/sonarqube (consulted 2026-10-28)
|
|
||||||
- Docker Compose specification: https://docs.docker.com/compose/compose-file/ (consulted 2026-10-28)
|
|
||||||
- Playwright Docker image: https://playwright.dev/docs/docker (consulted 2026-10-29)
|
|
||||||
- Gitea administration CLI: https://docs.gitea.com/administration/command-line/ (consulted 2026-10-29)
|
|
||||||
- Gitea API 1.23 token creation: https://docs.gitea.com/api/1.23/operations/user-create-token/ (consulted 2026-10-29)
|
|
||||||
- Gitea 1.23 organization repository creation: https://docs.gitea.com/api/1.23/operations/create-org-repo/ (consulted 2026-10-29)
|
|
||||||
- SonarQube page extension: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/developing-a-plugin/adding-pages-to-the-webapp (consulted 2026-10-29)
|
|
||||||
|
|
||||||
## Not verified
|
|
||||||
- Windows Docker image startup and local cross-container import passed via `./scripts/e2e.ps1` on 2026-10-29. Linux Docker execution of `scripts/e2e.sh` has not been run on this host.
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
---
|
|
||||||
name: gitea-actions-ci
|
|
||||||
description: Use when creating or changing CI workflows, artifact upload, release commits, tags, or Gitea release publishing.
|
|
||||||
---
|
|
||||||
# Gitea Actions CI
|
|
||||||
|
|
||||||
- Use `.gitea/workflows/*.yml`; trigger push, pull request, and manual dispatch as required.
|
|
||||||
- Fetch complete history and tags before version calculation (`fetch-depth: 0` where supported).
|
|
||||||
- Pin actions to immutable commits or exact versions and document when a mirror is required; act_runner compatibility must be checked.
|
|
||||||
- Cache Maven dependencies without caching secrets. Never put tokens in command output.
|
|
||||||
- Gate release on pushes to the configured main branch and a workflow-generated-commit guard. For this repository, every main-branch merge creates a release; Conventional Commits choose the major/minor/patch bump and other types default to patch.
|
|
||||||
- Update changelog, commit, tag that commit, push commit and tag, then create Gitea release from the exact changelog section.
|
|
||||||
- Use repository secrets for API credentials; describe branch protection permissions required for the release identity.
|
|
||||||
- Avoid release loops by checking actor/commit marker and tag state.
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
- [ ] Full history/tags available.
|
|
||||||
- [ ] PR validates changelog without mutation.
|
|
||||||
- [ ] Release job guarded against loops and branch scope.
|
|
||||||
- [ ] Secret only used for authenticated push/release.
|
|
||||||
- [ ] Actions are act_runner compatible or mirror requirements documented.
|
|
||||||
|
|
||||||
## Sources
|
|
||||||
- Gitea Actions documentation: https://docs.gitea.com/usage/actions/overview (consulted 2026-10-28)
|
|
||||||
- Gitea Actions migration guide: https://docs.gitea.com/usage/actions/comparison (consulted 2026-10-28)
|
|
||||||
- Gitea API documentation: https://docs.gitea.com/api/ (consulted 2026-10-28)
|
|
||||||
|
|
||||||
## Not verified
|
|
||||||
- Runner version, main branch name, and protected-branch policy are unspecified.
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
---
|
|
||||||
name: gitea-api-client
|
|
||||||
description: Use when implementing or modifying Gitea API requests, pagination, authentication, DTOs, errors, or HTTP retry behavior.
|
|
||||||
---
|
|
||||||
# Gitea API client
|
|
||||||
|
|
||||||
- Assume Gitea REST API v1 (OpenAPI documented by Gitea); use documented paths: `/user/orgs`, `/orgs/{org}/repos`, and `/user/repos` when personal repositories are enabled.
|
|
||||||
- Send the token only in the server-side `Authorization: token …` header; never echo it or include it in exceptions.
|
|
||||||
- Paginate with bounded `page` and `limit` parameters and stop only when a page is shorter than the requested limit.
|
|
||||||
- Use `java.net.http.HttpClient` with explicit connect and request timeouts.
|
|
||||||
- Do not automatically retry non-idempotent operations. If retries are added for GET, cap attempts and honor `Retry-After` when valid.
|
|
||||||
- Map 401 to invalid token, 403 to insufficient Gitea access, 404 to missing organization/resource, 429 to rate limit, and 5xx/network failures to temporary service errors.
|
|
||||||
- Parse only fields needed by the UI; handle absent optional branch fields safely.
|
|
||||||
- Validate configured base URL and disable redirects to prevent token forwarding to another host.
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
- [ ] Token remains server side and is redacted.
|
|
||||||
- [ ] Pagination bounded and tested.
|
|
||||||
- [ ] Timeouts and status mappings are explicit.
|
|
||||||
- [ ] Redirects disabled; base URL validated.
|
|
||||||
|
|
||||||
## Sources
|
|
||||||
- Gitea API documentation: https://docs.gitea.com/api/ (API 28.2.0 consulted 2026-10-28)
|
|
||||||
- Gitea user/org operations: https://docs.gitea.com/api/1.26/operations/tags/organization/ (consulted 2026-10-28)
|
|
||||||
- Java HttpClient: https://docs.oracle.com/en/java/javase/17/docs/api/java.net.http/java/net/http/HttpClient.html (consulted 2026-10-28)
|
|
||||||
|
|
||||||
## Not verified
|
|
||||||
- Deployment-specific Gitea version is unspecified; current endpoint compatibility across older Gitea versions must be checked against the test instance.
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
---
|
|
||||||
name: java-best-practices
|
|
||||||
description: Use when writing or reviewing Java production code in this plugin, especially HTTP, validation, lifecycle, concurrency, or error handling.
|
|
||||||
---
|
|
||||||
# Java best practices
|
|
||||||
|
|
||||||
- Compile with Java 17 (`maven.compiler.release=17`), the baseline supported by the target plugin API.
|
|
||||||
- Prefer immutable records for internal DTOs where compatible with JSON parsing; keep collections defensively copied.
|
|
||||||
- Validate null, length, and format at service boundaries. Use named constants for bounds and timeouts.
|
|
||||||
- Use try-with-resources for closeable resources; `java.net.http.HttpClient` is reusable and immutable.
|
|
||||||
- Do not create static mutable state, swallow exceptions, catch `Throwable`, or catch broad `Exception` without translating a known boundary failure.
|
|
||||||
- Keep errors actionable but never include authorization headers, tokens, or full secret-bearing URLs.
|
|
||||||
- Use SLF4J host-provided logging; log operation context without credentials.
|
|
||||||
- Keep packages under `cc.tordais.sonar.bifrost`; name types and methods in ASCII English.
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
- [ ] Java 17 compilation; immutable data and bounded inputs.
|
|
||||||
- [ ] Exceptions translated at boundaries, not hidden.
|
|
||||||
- [ ] No static mutable state or secret-bearing logs.
|
|
||||||
- [ ] Resources and HTTP timeouts handled.
|
|
||||||
|
|
||||||
## Sources
|
|
||||||
- SonarQube API JDK baseline: https://github.com/SonarSource/sonar-plugin-api (consulted 2026-10-28)
|
|
||||||
- Java 17 API documentation: https://docs.oracle.com/en/java/javase/17/docs/api/ (consulted 2026-10-28)
|
|
||||||
|
|
||||||
## Not verified
|
|
||||||
- No project-specific Sonar quality profile has been run yet.
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
---
|
|
||||||
name: java-testing
|
|
||||||
description: Use when adding or changing unit or integration tests for Java services, validation, project keys, or HTTP interactions.
|
|
||||||
---
|
|
||||||
# Java testing
|
|
||||||
|
|
||||||
- Use pinned JUnit Jupiter and AssertJ; use Mockito only for narrow collaborator seams.
|
|
||||||
- Mock HTTP at the transport boundary with a local in-process `HttpServer`; tests must not need a real Gitea instance or network.
|
|
||||||
- Test pagination, authentication failures, 404, 5xx, malformed payloads, timeout behavior, and secret redaction.
|
|
||||||
- Test project-key sanitization, invalid/empty inputs, and collisions across distinct source names.
|
|
||||||
- Test organization allowlist behavior in both fixed and all-accessible modes.
|
|
||||||
- Use deterministic fixtures, no sleeps, no dependence on wall-clock except injected clock behavior.
|
|
||||||
- Run `./mvnw test` (Windows: `mvnw.cmd test`) and report only results actually run.
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
- [ ] Gitea HTTP paths and failure mapping covered.
|
|
||||||
- [ ] Key and organization boundary cases covered.
|
|
||||||
- [ ] Tests are offline and deterministic.
|
|
||||||
- [ ] Test suite passes with Maven Wrapper.
|
|
||||||
|
|
||||||
## Sources
|
|
||||||
- JUnit 5 User Guide: https://junit.org/junit5/docs/current/user-guide/ (consulted 2026-10-28)
|
|
||||||
- AssertJ documentation: https://assertj.github.io/doc/ (consulted 2026-10-28)
|
|
||||||
- Java HttpServer API: https://docs.oracle.com/en/java/javase/17/docs/api/jdk.httpserver/com/sun/net/httpserver/HttpServer.html (consulted 2026-10-28)
|
|
||||||
|
|
||||||
## Not verified
|
|
||||||
- Plugin lifecycle integration tests against a running server are outside unit test scope.
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
---
|
|
||||||
name: local-e2e-validation
|
|
||||||
description: Use when building, changing, or running the reproducible Bifrost local stack validation that provisions Gitea fixtures and imports them through the SonarQube page.
|
|
||||||
---
|
|
||||||
# Local end-to-end validation
|
|
||||||
|
|
||||||
- Build the JAR from the repository tag-derived version before starting the stack; mount that exact file read-only into SonarQube.
|
|
||||||
- Use only Compose project `bifrost-e2e` for automated state. Reset its named volumes with `down --volumes --remove-orphans`; never delete the user's default `bifrost` project or other volumes.
|
|
||||||
- Wait for PostgreSQL, Gitea, and SonarQube health checks before provisioning. Require exact SonarQube version `25.9.0.112764` and verify plugin runtime before browser actions.
|
|
||||||
- Create a test-only Gitea administrator with the pinned Gitea CLI. Generate a disposable token through the documented Gitea API and keep credentials and tokens in process memory or test-only environment variables.
|
|
||||||
- Seed two organizations (`alpha-lab`, `beta-lab`) and two repositories in each (`api`, `web`) through the Gitea API. Repeated repository names across organizations are expected.
|
|
||||||
- Configure `sonar.bifrost.*` with SonarQube Web APIs. In the disposable 25.9 instance, accept `sonar.plugins.risk.consent` through the public settings API, then create a UI session through `api/authentication/login`.
|
|
||||||
- Dismiss SonarQube first-run welcome and Joyride overlays before checking controls. Wait for repository rows to reflect the selected organization before selecting all.
|
|
||||||
- Assert organization switching retains selection, all four projects are created with organization-prefixed keys, every project receives a Gitea link, imported rows are disabled, and the page emits no JavaScript errors. The fixture deliberately repeats `api` and `web` across the organizations.
|
|
||||||
- Keep the stack after a successful test for inspection. On failure retain the stack and Playwright trace/screenshots. Cleanup only with the dedicated project command.
|
|
||||||
- Do not report full validation unless the script exits successfully and the independent API assertions pass.
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
|
|
||||||
- [x] Exact plugin JAR version and manifest are used by Compose.
|
|
||||||
- [x] Fresh Gitea and SonarQube state is provisioned with test-only credentials.
|
|
||||||
- [x] Both organizations and all four repositories are verified in Gitea.
|
|
||||||
- [x] Chromium exercises the real plugin page and its selection/import controls.
|
|
||||||
- [x] SonarQube API confirms each project and its Gitea link.
|
|
||||||
- [x] Imported project state and browser errors are checked.
|
|
||||||
- [x] Only the `bifrost-e2e` project can be reset by the runner.
|
|
||||||
|
|
||||||
## Commands
|
|
||||||
|
|
||||||
```sh
|
|
||||||
./scripts/e2e.ps1
|
|
||||||
docker compose --project-name bifrost-e2e ps
|
|
||||||
docker compose --project-name bifrost-e2e down --volumes --remove-orphans
|
|
||||||
```
|
|
||||||
|
|
||||||
## Sources
|
|
||||||
|
|
||||||
- SonarQube page extensions: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/developing-a-plugin/adding-pages-to-the-webapp (consulted 2026-10-29)
|
|
||||||
- SonarQube project creation API: https://docs.sonarsource.com/sonarqube-community-build/project-administration/creating-project/automating-creation (consulted 2026-10-29)
|
|
||||||
- SonarQube settings Web API: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/web-api (consulted 2026-10-29)
|
|
||||||
- Gitea 1.23 token API: https://docs.gitea.com/api/1.23/operations/user-create-token/ (consulted 2026-10-29)
|
|
||||||
- Gitea 1.23 organization repository API: https://docs.gitea.com/api/1.23/operations/create-org-repo/ (consulted 2026-10-29)
|
|
||||||
- Gitea command line: https://docs.gitea.com/administration/command-line/ (consulted 2026-10-29)
|
|
||||||
- Playwright Docker: https://playwright.dev/docs/docker (consulted 2026-10-29)
|
|
||||||
- Playwright test configuration: https://playwright.dev/docs/test-configuration (consulted 2026-10-29)
|
|
||||||
- Docker Compose specification: https://docs.docker.com/compose/compose-file/ (consulted 2026-10-29)
|
|
||||||
|
|
||||||
## Not verified
|
|
||||||
|
|
||||||
- The full local flow passed on 2026-10-29 with SonarQube Community Build 25.9.0.112764, Gitea 1.23.8, PostgreSQL 17.2, and Playwright 1.64.1. External Gitea versions and Linux Docker hosts have not been exercised here.
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
---
|
|
||||||
name: maven-build-packaging
|
|
||||||
description: Use when changing Maven coordinates, compiler or plugin versions, wrapper, packaging, JavaScript resources, or Docker build integration.
|
|
||||||
---
|
|
||||||
# Maven build and packaging
|
|
||||||
|
|
||||||
- Use Maven and commit the Maven Wrapper; pin Maven distribution, compiler, Surefire, packaging, and flatten plugin versions.
|
|
||||||
- Inject `${revision}` through `-Drevision=...`; use `flatten-maven-plugin` so published metadata resolves the version.
|
|
||||||
- Set compiler release 17. Declare `org.sonarsource.api.plugin:sonar-plugin-api:13.0.0.3026` as `provided` for Community Build 25.9.
|
|
||||||
- Configure `sonar-packaging-maven-plugin` with plugin key `bifrost`, ASCII display fallback `Bifrost (Gitea Import)` until manifest UTF-8 is verified, and plugin API minimum `13.0.0.3026`.
|
|
||||||
- Do not confuse manifest `Sonar-Version` with a SonarQube product version: it records the minimum plugin API version. Track the minimum tested SonarQube release separately.
|
|
||||||
- Keep JavaScript dependency-free and package it as a static resource; no Node build step is needed.
|
|
||||||
- Produce `sonar-bifrost-plugin-${revision}.jar`; inspect manifest and contents after packaging.
|
|
||||||
- Build reproducibly where plugin versions permit; avoid timestamps and unpinned image tags.
|
|
||||||
- Docker build stages must use pinned JDK/Maven images and provide a clear host extraction command.
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
- [ ] Wrapper and all plugin versions pinned.
|
|
||||||
- [ ] Public API dependency provided, not packaged.
|
|
||||||
- [ ] JAR filename and manifest correct.
|
|
||||||
- [ ] Static page resource included.
|
|
||||||
- [ ] Container build can export the JAR.
|
|
||||||
|
|
||||||
## Sources
|
|
||||||
- SonarQube plugin packaging: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/developing-a-plugin/plugin-basics (consulted 2026-10-28)
|
|
||||||
- Maven Wrapper: https://maven.apache.org/wrapper/ (consulted 2026-10-28)
|
|
||||||
- Maven CI-friendly versions: https://maven.apache.org/maven-ci-friendly.html (consulted 2026-10-28)
|
|
||||||
- SonarSource packaging plugin: https://github.com/SonarSource/sonar-packaging-maven-plugin (consulted 2026-10-28)
|
|
||||||
- Manifest metadata reference: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/developing-a-plugin/plugin-basics (consulted 2026-10-28)
|
|
||||||
|
|
||||||
## Not verified
|
|
||||||
- Exact minimum-version manifest syntax must be checked against the pinned packaging plugin release during build implementation.
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
---
|
|
||||||
name: project-workflow
|
|
||||||
description: Use for every task in this repository to enforce its implementation order, evidence rules, skills, language, and definition of done.
|
|
||||||
---
|
|
||||||
# Project workflow
|
|
||||||
|
|
||||||
- Keep all source, docs, UI, logs, comments, workflows, and commit messages in English. Use ASCII identifiers; display text may use `Bifröst` only if UTF-8 manifest encoding is verified.
|
|
||||||
- Before implementation, read relevant project skills and verify any version-sensitive claims against their listed primary sources.
|
|
||||||
- Work in this order: compatibility research, skills, design, implementation, tests/build, packaging inspection, compliance review.
|
|
||||||
- If reality conflicts with a skill, confirm with primary documentation, fix the skill in the same change, and explain the correction.
|
|
||||||
- Keep security boundaries server-side; never trust UI visibility or client-provided organization names.
|
|
||||||
- Do not claim build, runtime, browser, or integration verification unless actually performed.
|
|
||||||
- When the user requests local integration proof, include the isolated zero-to-import stack and run its browser-based end-to-end test; unit tests alone are not completion.
|
|
||||||
- Definition of done: requested artifacts exist, unit tests/build pass, packaged metadata inspected, requested runtime flow verified at the stated level, limitations documented, and each skill checklist reviewed.
|
|
||||||
- Use Conventional Commit messages; do not claim commits were created unless the repository is a Git checkout and the commit actually exists.
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
- [ ] Relevant skills loaded and followed.
|
|
||||||
- [ ] English-only content and ASCII identifiers.
|
|
||||||
- [ ] Verification evidence accurately reported.
|
|
||||||
- [ ] Skill checklists and limitations reviewed.
|
|
||||||
|
|
||||||
## Sources
|
|
||||||
- User project requirements in the initial task (consulted 2026-10-28)
|
|
||||||
- SonarQube Community Build plugin basics: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/developing-a-plugin/plugin-basics (consulted 2026-10-28)
|
|
||||||
|
|
||||||
## Not verified
|
|
||||||
- Repository hosting policy, default branch, and commit identity are unspecified.
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
---
|
|
||||||
name: release-versioning-changelog
|
|
||||||
description: Use when changing semantic version calculation, release automation, Conventional Commit parsing, or CHANGELOG.md generation and validation.
|
|
||||||
---
|
|
||||||
# Release versioning and changelog
|
|
||||||
|
|
||||||
- Treat `vMAJOR.MINOR.PATCH` Git tags as the sole release version source.
|
|
||||||
- Parse commits since the latest reachable version tag: breaking change or `!` bumps major; `feat` bumps minor; `fix`, `perf`, and `refactor` bump patch. For this repository every merge to `main` releases, so other commit types default to a patch bump.
|
|
||||||
- Use a valid plugin manifest version format; keep snapshot metadata out of release tags.
|
|
||||||
- Keep `CHANGELOG.md` in Keep a Changelog 1.1.0 structure, newest first, with only Added, Changed, Deprecated, Removed, Fixed, and Security categories.
|
|
||||||
- Never invent a user-facing changelog detail from an unclear commit. Allow maintainers to edit generated entries before release.
|
|
||||||
- Validate headings, dates, allowed categories, order, and comparison links with a script.
|
|
||||||
- Extract release body directly from the version section in `CHANGELOG.md`.
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
- [ ] Tag parsing is deterministic and handles no-tag repositories.
|
|
||||||
- [ ] Bump mapping matches repository policy.
|
|
||||||
- [ ] Changelog validator catches malformed sections and links.
|
|
||||||
- [ ] Release tag points to the changelog update commit.
|
|
||||||
|
|
||||||
## Sources
|
|
||||||
- Keep a Changelog 1.1.0: https://keepachangelog.com/en/1.1.0/ (consulted 2026-10-28)
|
|
||||||
- Semantic Versioning 2.0.0: https://semver.org/spec/v2.0.0.html (consulted 2026-10-28)
|
|
||||||
- Conventional Commits 1.0.0: https://www.conventionalcommits.org/en/v1.0.0/ (consulted 2026-10-28)
|
|
||||||
|
|
||||||
## Not verified
|
|
||||||
- SonarQube's exact accepted plugin manifest version grammar needs build-time confirmation against target 25.9.
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
---
|
|
||||||
name: secure-coding-plugin
|
|
||||||
description: Use when adding or reviewing configuration, web-service inputs, authorization, outbound HTTP, secrets, or dependencies in the plugin.
|
|
||||||
---
|
|
||||||
# Secure coding for this plugin
|
|
||||||
|
|
||||||
- Require authenticated SonarQube users and check `Create Projects` on every action that enumerates or imports repositories.
|
|
||||||
- Fail closed when the current-user permission response is absent or malformed. Verify local connector authorization behavior on the target instance before deployment.
|
|
||||||
- Treat all browser input as untrusted. Bound batch size and string lengths; validate organization and repository identifiers before API calls.
|
|
||||||
- Validate configured Gitea URL as absolute HTTP(S) with host and no userinfo, query, or fragment. The URL is trusted administrator configuration and may target a private Gitea host; never accept a request-specific outbound URL.
|
|
||||||
- Disable redirects to avoid forwarding the Gitea token; do not expose outbound arbitrary URL input.
|
|
||||||
- Store the token in a `.secured` PASSWORD property. Never return it from web services, JS, logs, errors, or generated files.
|
|
||||||
- Use same-origin authenticated SonarQube requests for mutations; do not build custom cookie bypasses. Preserve SonarQube's normal CSRF/session protections by sending `X-XSRF-TOKEN` from the `XSRF-TOKEN` cookie on POST requests.
|
|
||||||
- Reject duplicate or colliding project keys before making any project mutations.
|
|
||||||
- Pin dependencies, inspect transitive dependency changes, and keep the Sonar API provided.
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
- [ ] Every endpoint checks Create Projects.
|
|
||||||
- [ ] URL, identifiers, and batch sizes validated.
|
|
||||||
- [ ] Secret handling and redirects safe.
|
|
||||||
- [ ] Project-key collisions fail closed.
|
|
||||||
- [ ] Dependency versions pinned.
|
|
||||||
|
|
||||||
## Sources
|
|
||||||
- OWASP SSRF Prevention Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html (consulted 2026-10-28)
|
|
||||||
- SonarQube Community Build Web API security: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/web-api (consulted 2026-10-28)
|
|
||||||
- SonarQube plugin configuration: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/developing-a-plugin/plugin-basics (consulted 2026-10-28)
|
|
||||||
|
|
||||||
## Not verified
|
|
||||||
- Community Build 25.9.0.112764 returned HTTP 401 when the POST omitted `X-XSRF-TOKEN`; the local browser flow passed after including it. The external Gitea endpoint and token policy remain administrator-controlled and were not evaluated.
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
---
|
|
||||||
name: sonarqube-frontend-extension
|
|
||||||
description: Use when implementing or changing a SonarQube 25.9 page extension, its JavaScript bundle, navigation placement, API calls, or browser permissions.
|
|
||||||
---
|
|
||||||
# SonarQube frontend extension
|
|
||||||
|
|
||||||
- Register a global page with `PageDefinition`; its key is `bifrost/import`.
|
|
||||||
- Put the matching unbundled JavaScript at `src/main/resources/static/import.js`; call `window.registerExtension("bifrost/import", start)`.
|
|
||||||
- Use only `options.el` as the page mount point; return a cleanup callback.
|
|
||||||
- Do not assume global libraries except React. Plain browser JavaScript avoids an unnecessary build step.
|
|
||||||
- Use same-origin `fetch` for `api/bifrost/*`; rely on the active SonarQube session and never send the Gitea token to the browser. For non-GET requests, copy the readable `XSRF-TOKEN` cookie into the `X-XSRF-TOKEN` header; SonarQube 25.9 rejects cookie-authenticated POSTs without it.
|
|
||||||
- Render API errors as accessible text; use labels for controls, semantic table headers, keyboard-accessible controls, and text status in addition to color.
|
|
||||||
- Validate repository links as HTTP or HTTPS before assigning them to an anchor.
|
|
||||||
- Grey out imported rows and disable their checkboxes. Keep selection in page state across organization changes.
|
|
||||||
- Page visibility is not authorization. The server must enforce Create Projects permission on every endpoint.
|
|
||||||
- Do not embed inline scripts or use `eval`.
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
- [ ] `PageDefinition` key matches JS registration key and resource filename.
|
|
||||||
- [ ] Bundle packaged under `/static/bifrost/import.js`.
|
|
||||||
- [x] Accessible labels, feedback and keyboard controls.
|
|
||||||
- [ ] No token in browser or authorization based only on menu visibility.
|
|
||||||
|
|
||||||
## Sources
|
|
||||||
- Adding pages to the webapp: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/developing-a-plugin/adding-pages-to-the-webapp (consulted 2026-10-28)
|
|
||||||
- SonarQube Web API: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/web-api (consulted 2026-10-28)
|
|
||||||
|
|
||||||
## Not verified
|
|
||||||
- Live page routing, bundle loading, accessible controls, selection retention, and POST CSRF behavior were verified on Community Build 25.9.0.112764. Conditional menu hiding based on Create Projects permission is not supported by the selected public page API.
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
---
|
|
||||||
name: sonarqube-plugin-development
|
|
||||||
description: Use when adding or changing Java plugin entry points, extension registration, properties, web services, manifest metadata, or packaging compatibility for SonarQube Community Build 25.9.0.112764.
|
|
||||||
---
|
|
||||||
# SonarQube plugin development
|
|
||||||
|
|
||||||
- Target SonarQube Community Build `25.9.0.112764`; use Java 17 bytecode and plugin API `13.0.0.3026`, inferred from target server dependency metadata and confirmed by a successful plugin load on the exact target image.
|
|
||||||
- Declare all server extensions through `Plugin.Context.addExtensions`; keep constructors free of service work.
|
|
||||||
- Use only `org.sonar.api.*` public API. Never import `org.sonar.server.*`, DAO classes, or implementation packages.
|
|
||||||
- Define settings through `PropertyDefinition`; secured values must use a `.secured` key and PASSWORD type.
|
|
||||||
- Add web services using `WebService` and `@ServerSide`; authorize each action explicitly.
|
|
||||||
- Inspect the pinned API JAR before importing any auth type. `org.sonar.api.user.UserSession` and `org.sonar.api.permissions.GlobalPermission` are absent from API 13.0.0.3026. The current implementation reads current-user permissions through the public `Request.localConnector()` interface and must be checked against the target server's response.
|
|
||||||
- Set key, display name, version and minimum plugin API version in packaging metadata. The manifest `Sonar-Version` is an API version, not a SonarQube product release. Keep the minimum tested server release separately.
|
|
||||||
- Use SLF4J supplied by the host; never package logging implementations or log credentials.
|
|
||||||
- Verify extension APIs against the exact API artifact/Javadoc when changing the target release.
|
|
||||||
- For project creation within a web service, use `Request.localConnector()` to call public SonarQube Web APIs in the current request context; never invoke internal project creation services.
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
- [ ] Entry point and only public API types.
|
|
||||||
- [ ] Extensions registered and server side scoped correctly.
|
|
||||||
- [ ] Secure configuration and explicit authorization.
|
|
||||||
- [ ] Manifest key/name/version/minimum version inspected in final JAR.
|
|
||||||
- [ ] `mvnw verify` succeeds.
|
|
||||||
|
|
||||||
## Sources
|
|
||||||
- SonarQube Community Build Plugin basics: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/developing-a-plugin/plugin-basics (consulted 2026-10-28)
|
|
||||||
- SonarSource API compatibility matrix: https://github.com/SonarSource/sonar-plugin-api (consulted 2026-10-28)
|
|
||||||
- SonarQube target dependency metadata: https://central.sonatype.com/artifact/org.sonarsource.sonarqube/sonar-core/25.9.0.112764 (consulted 2026-10-28)
|
|
||||||
- Pinned API source artifact: https://repo.maven.apache.org/maven2/org/sonarsource/api/plugin/sonar-plugin-api/13.0.0.3026/sonar-plugin-api-13.0.0.3026-sources.jar (consulted 2026-10-28)
|
|
||||||
- SonarQube project creation REST API: https://docs.sonarsource.com/sonarqube-community-build/project-administration/creating-project/automating-creation (consulted 2026-10-28)
|
|
||||||
|
|
||||||
## Not verified
|
|
||||||
- Full target-tag SonarQube source checkout was not available; the plugin build and startup were verified against the exact target image.
|
|
||||||
- The target server's `api/users/current` permissions response and local connector caller context were not tested live.
|
|
||||||
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- Remove repository-local agent skills in favor of the shared skills catalog.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Add Gitea organization and repository browsing, selection, server-side validation, project creation, and repository links.
|
- Add Gitea organization and repository browsing, selection, server-side validation, project creation, and repository links.
|
||||||
|
|||||||
@@ -113,6 +113,10 @@ Validate the changelog with:
|
|||||||
|
|
||||||
sh scripts/check-changelog.sh
|
sh scripts/check-changelog.sh
|
||||||
|
|
||||||
|
## Agent guidance
|
||||||
|
|
||||||
|
This repository has no local agent-skill copies. Shared agent guidance is installed from the user's global catalog; keep this README, workflows, and scripts as the source for Bifrost-specific build and acceptance facts.
|
||||||
|
|
||||||
## Known limitations
|
## Known limitations
|
||||||
|
|
||||||
- Compatibility has been verified on Community Build 25.9.0.112764; other versions are unverified.
|
- Compatibility has been verified on Community Build 25.9.0.112764; other versions are unverified.
|
||||||
|
|||||||
Reference in new issue
Block a user