Skip to content

fix(shims,docs): resolve CodeQL and AI code quality findings#388

Merged
rhuanbarreto merged 5 commits into
mainfrom
fix/security-quality-findings
May 30, 2026
Merged

fix(shims,docs): resolve CodeQL and AI code quality findings#388
rhuanbarreto merged 5 commits into
mainfrom
fix/security-quality-findings

Conversation

@rhuanbarreto

Copy link
Copy Markdown
Contributor

Summary

Resolves all open findings from GitHub Security > Code Quality (both standard CodeQL and AI-powered findings).

Standard findings (CodeQL) — 10 findings across 4 shims

  • C# shim (shims/nuget/Archgate.Tool/Program.cs):

    • Replace generic catch (Exception) / bare catch with specific exception types (HttpRequestException, IOException, etc.)
    • Use Path.Join instead of Path.Combine to avoid silent argument dropping when a later arg is absolute
    • Replace manual foreach + break with LINQ FirstOrDefault
    • Make checksum fetch failure a hard error instead of silently skipping verification (security hardening)
  • Java shim (shims/maven/.../Shim.java):

    • Wrap Long.parseLong(sizeStr, 8) in try-catch to handle corrupt tar headers with non-octal size fields
  • Python shim (shims/pypi/archgate/_shim.py, shims/pypi/tests/test_shim.py):

    • Remove unused import os
    • Consolidate duplicate import unittest / from unittest import mock into single import

AI findings (validated) — 7 findings across 5 files

  • Go shim (shims/go/internal/shim/shim.go):

    • Make missing checksum a hard failure instead of a warning (security hardening, same as C# fix)
  • Docs (docs/src/content/docs/reference/):

    • Fix GrepMatch.file description from "Absolute path" to "Project-relative path" (en, nb, pt-br) — verified against runner.ts implementation
    • Remove duplicate ## RuleSet sections at bottom of rule-api pages (en, nb, pt-br)
    • Correct init.mdx generated filenames: ARCH-001-exampleGEN-001-example, archgate.config.tsREADME.md — verified against init-project.ts

Toolchain

  • Add Go 1.21, .NET 8.0, and Java 11 to .prototools so shim tests can run locally via proto

Test plan

  • bun run validate passes (lint, typecheck, format, test, ADR check, knip, build)
  • Python shim tests pass (pytest shims/pypi/tests/ -v — 15/15)
  • Go shim tests pass (go test ./... — 7/7)
  • C# shim tests pass (dotnet test — 7/7)
  • Java shim tests (CI only — Maven not available via proto)
  • npm/rubygem shim tests (CI matrix)

rhuanbarreto and others added 3 commits May 30, 2026 22:47
Address all open findings from GitHub Security > Code Quality:

Standard findings (CodeQL):
- C# shim: replace generic catch clauses with specific exception types
- C# shim: use Path.Join instead of Path.Combine to avoid silent arg drops
- C# shim: replace foreach loop with LINQ FirstOrDefault
- C# shim: make checksum fetch failure a hard error (security hardening)
- Java shim: catch NumberFormatException from Long.parseLong in tar parsing
- Python shim: remove unused `import os`
- Python test: consolidate duplicate unittest import styles

AI findings (validated and fixed):
- Go shim: make missing checksum a hard failure instead of silent warning
- Docs: fix GrepMatch.file description from "Absolute" to "Project-relative"
- Docs: remove duplicate RuleSet sections in en/nb/pt-br rule-api pages
- Docs: correct init.mdx generated filenames (GEN-001, not ARCH-001)
- Docs: correct init.mdx lint dir file (README.md, not archgate.config.ts)

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Add toolchain pins so contributors can run shim tests locally via proto:
- Go 1.21 (built-in proto plugin)
- .NET 8.0 (community proto-dotnet-plugin)
- Java 11 (Eclipse Adoptium via openjdk-adoptium-proto-plugin)

Maven still requires manual install — no proto plugin exists.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 30, 2026

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 67081c3
Status: ✅  Deploy successful!
Preview URL: https://aa8c5421.archgate-cli.pages.dev
Branch Preview URL: https://fix-security-quality-finding.archgate-cli.pages.dev

View logs

The C# and Java shim source code constants were stuck at 0.39.0 while
package.json is 0.41.1. The release script (.simple-release.js) updated
package manifests (.csproj, pom.xml) but missed the hardcoded Version
constants used to construct download URLs.

Fixes:
- Update Program.cs and Shim.java version constants to 0.41.1
- Add both source files to .simple-release.js bump targets
- Extend ARCH-013/shim-version-sync rule to check source constants
- Sync nb/pt-br init.mdx translations (GEN-001, README.md filenames)

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@github-actions

github-actions Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

Code Coverage

Metric Value
Lines 90.3% (6735 / 7458)
Threshold 90% minimum — met
Platforms Linux + Windows

Full HTML report available in workflow artifacts.

Per-directory breakdown
Directory Coverage Lines
src/commands/ 88.0% 2082 / 2365
src/engine/ 93.1% 1379 / 1481
src/formats/ 100.0% 141 / 141
src/helpers/ 90.3% 3133 / 3471

The Java proto plugin (openjdk-adoptium-proto-plugin) doesn't have a
compatible WASM asset for proto 0.57.x used in CI, causing the Windows
smoke test to fail on `proto install`. This cascaded into coverage
failure (no Windows coverage merged → 88.3% < 90% threshold).

Shim toolchains (Go, .NET, Java) should be managed separately — CI
already handles them via actions/setup-* in the shim-tests matrix.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@rhuanbarreto rhuanbarreto merged commit 63ec93f into main May 30, 2026
24 checks passed
@rhuanbarreto rhuanbarreto deleted the fix/security-quality-findings branch May 30, 2026 21:16
@archgatebot archgatebot Bot mentioned this pull request May 30, 2026
rhuanbarreto pushed a commit that referenced this pull request May 30, 2026
# archgate

## [0.42.0](v0.41.1...v0.42.0)
(2026-05-30)

### Features

* **engine:** add inline suppression via archgate-ignore comments
([#383](#383))
([1240860](1240860))

### Bug Fixes

* **deps:** resolve dependency dashboard deprecation and lookup warnings
([#387](#387))
([18eae44](18eae44)),
closes [#107](#107)
* **docs:** restore Norwegian Bokmål diacritical marks across nb/ locale
([#384](#384))
([ef98b39](ef98b39))
* **shims,docs:** resolve CodeQL and AI code quality findings
([#388](#388))
([63ec93f](63ec93f))

---
This PR was generated with
[simple-release](https://github.com/TrigenSoftware/simple-release).

<details>
<summary>📄 Cheatsheet</summary>
<br>



You can configure the bot's behavior through a pull request comment
using the `!simple-release/set-options` command.

### Command Format

````md
!simple-release/set-options

```json
{
  "bump": {},
  "publish": {}
}
```
````

### Useful Parameters

#### Bump

| Parameter | Type | Description |
|-----------|------|-------------|
| `version` | `string` | Force set specific version |
| `as` | `'major' \| 'minor' \| 'patch' \| 'prerelease'` | Release type
|
| `prerelease` | `string` | Pre-release identifier (e.g., "alpha",
"beta") |
| `firstRelease` | `boolean` | Whether this is the first release |
| `skip` | `boolean` | Skip version bump |
| `byProject` | `Record<string, object>` | Per-project bump options for
monorepos |

#### Publish

| Parameter | Type | Description |
|-----------|------|-------------|
| `skip` | `boolean` | Skip publishing |
| `access` | `'public' \| 'restricted'` | Package access level |
| `tag` | `string` | Tag for npm publication |

### Usage Examples

#### Force specific version

````md
!simple-release/set-options

```json
{
  "bump": {
    "version": "2.0.0"
  }
}
```
````

#### Force major bump

````md
!simple-release/set-options

```json
{
  "bump": {
    "as": "major"
  }
}
```
````

#### Create alpha pre-release

````md
!simple-release/set-options

```json
{
  "bump": {
    "prerelease": "alpha"
  }
}
```
````

#### Publish with specific access and tag

````md
!simple-release/set-options

```json
{
  "bump": {
    "prerelease": "beta"
  },
  "publish": {
    "access": "public",
    "tag": "beta"
  }
}
```
````

### Access Restrictions

The command can only be used by users with permissions:
- repository owner
- organization member
- collaborator

### Notes

- The last comment with `!simple-release/set-options` command takes
priority
- JSON must be valid, otherwise the command will be ignored
- Parameters apply only to the current release execution
- The command can be updated by editing the comment or adding a new one


</details>

<!--
  Please do not edit this comment.
  simple-release-pull-request: true
  simple-release-branch-from: release
  simple-release-branch-to: main
-->

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@archgatebot archgatebot Bot mentioned this pull request May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant