Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
0191ee1
chore: ignore marketing/ folder — private content not for public repo
marioarce Jun 22, 2026
f6bb77f
docs: standardize banner image references to absolute GitHub URLs
marioarce Jul 9, 2026
c882601
Merge pull request #33 from marioarce/feature/refactors
marioarce Jul 9, 2026
3a2a110
test: remove outdated and placeholder test files
marioarce Jul 13, 2026
edf1dc6
feat: add DistinctBy method to ListExtensions
marioarce Jul 13, 2026
1d1d91b
test: add comprehensive unit tests for ListExtensions
marioarce Jul 13, 2026
c8d99e3
test: add comprehensive unit tests for StringExtensions
marioarce Jul 13, 2026
7fc8457
test: fix exception type in TryAdd null dictionary test
marioarce Jul 13, 2026
cfd4913
test: update MathHelper tests to use MathUtility class name
marioarce Jul 13, 2026
46b9596
test: update ValidationUtility tests to use correct class name
marioarce Jul 13, 2026
4fabf95
build: add Extensions reference to Core.Tests and format project files
marioarce Jul 13, 2026
fb75d91
build: add test projects to solution file
marioarce Jul 13, 2026
0b80da0
feat: add Coalesce method to StringExtensions
marioarce Jul 13, 2026
294dc24
test: add comprehensive unit tests for Coalesce method
marioarce Jul 13, 2026
ae56ed6
ci: add Windows to CI test matrix for cross-platform validation
marioarce Jul 13, 2026
86464f7
ci: revert CI to single Ubuntu runner and remove Compatibility.Extens…
marioarce Jul 13, 2026
3a635ef
Merge pull request #41 from marioarce/feature/new-extensions
marioarce Jul 13, 2026
393b2fc
docs(agents): add repository-wide CLAUDE operating guidelines
marioarce Jul 22, 2026
002cee9
docs(workflows): add SOP guide for recurring repository tasks
marioarce Jul 22, 2026
d40a91c
docs(features): add framework-specific CLAUDE guidance for feature ar…
marioarce Jul 22, 2026
d71c3f3
docs(cache-disk): add high-risk operational guidance for disk cache i…
marioarce Jul 22, 2026
1578808
docs(compatibility): add package-specific CLAUDE guidance for .NET Fr…
marioarce Jul 22, 2026
54dd307
Merge pull request #42 from marioarce/feature/claude-governance-docs
marioarce Jul 22, 2026
a2a5d4c
Merge branch 'main' of github-personal:marioarce/PowerCSharp into dev…
marioarce Jul 22, 2026
dee019d
chore(gitignore): ignore local VS Code settings file
marioarce Jul 22, 2026
8cc44e6
chore(sanitization): scaffold sanitization abstractions project
marioarce Jul 22, 2026
e6f9750
feat(sanitization): add sanitization enums
marioarce Jul 22, 2026
4589c33
feat(sanitization): add sanitization settings and result models
marioarce Jul 22, 2026
5f65154
feat(sanitization): add sanitization service contracts
marioarce Jul 22, 2026
c41481e
feat(sanitization): add sanitization engine core
marioarce Jul 22, 2026
4e79a84
feat(sanitization): add log injection sanitization
marioarce Jul 22, 2026
30016c9
feat(sanitization): add file path sanitization
marioarce Jul 22, 2026
9e5b5b8
feat(sanitization): add sensitive data sanitization
marioarce Jul 22, 2026
d0a73fd
feat(sanitization): add regex injection sanitization
marioarce Jul 22, 2026
2b765db
feat(sanitization): add public sanitization extension methods
marioarce Jul 22, 2026
f43bec5
feat(sanitization): add no-op sanitization service
marioarce Jul 22, 2026
85a22f2
chore(sanitization): register abstractions project in solution
marioarce Jul 22, 2026
1b72e29
Merge pull request #49 from marioarce/feature/sanitization-feature
marioarce Jul 22, 2026
948af56
feat(sanitization): scaffold Feature.Sanitization module project
marioarce Jul 23, 2026
104e49e
feat(sanitization): add Sanitization feature options
marioarce Jul 23, 2026
8252133
feat(sanitization): add DI-facing sanitization service and settings p…
marioarce Jul 23, 2026
ee7bcd8
feat(sanitization): add static engine host wiring extension
marioarce Jul 23, 2026
70bcbe4
feat(sanitization): add Sanitization feature module for auto-discovery
marioarce Jul 23, 2026
4552d5a
feat(sanitization): add explicit Sanitization feature registration ex…
marioarce Jul 23, 2026
8fcc051
chore(sanitization): add Sanitization feature version family
marioarce Jul 23, 2026
49c7c8f
chore(sanitization): wire Feature.Sanitization project into solution
marioarce Jul 23, 2026
5452997
ci(sanitization): add sanitization package family to release workflow
marioarce Jul 23, 2026
9d1ec17
Merge pull request #50 from marioarce/feature/sanitization-module
marioarce Jul 23, 2026
12a7c67
fix(sanitization): mask sensitive key-value pairs correctly
marioarce Jul 23, 2026
0627cc9
test(sanitization): scaffold Sanitization feature test project
marioarce Jul 23, 2026
917265a
test(sanitization): add log injection sanitization tests
marioarce Jul 23, 2026
8ea96b4
test(sanitization): add file path sanitization tests
marioarce Jul 23, 2026
b9a542a
test(sanitization): add sensitive data sanitization tests
marioarce Jul 23, 2026
62e84d2
test(sanitization): add regex injection sanitization tests
marioarce Jul 23, 2026
e86c369
test(sanitization): add extension method and result type tests
marioarce Jul 23, 2026
56f86cd
test(sanitization): add feature DI wiring tests
marioarce Jul 23, 2026
9bfac8b
chore(sanitization): wire Sanitization test project into solution
marioarce Jul 23, 2026
8793526
fix(sanitization): correct CollectionBehavior property name
marioarce Jul 23, 2026
716b79a
fix(sanitization): make correlation id test platform independent
marioarce Jul 23, 2026
0102827
Merge pull request #51 from marioarce/feature/sanitization-tests
marioarce Jul 23, 2026
6b5a3b6
docs(sanitization): add Sanitization Abstractions package readme
marioarce Jul 23, 2026
87c485e
docs(sanitization): add Sanitization module package readme
marioarce Jul 23, 2026
b460cf3
docs(sanitization): add Sanitization family API reference
marioarce Jul 23, 2026
011fc00
docs(sanitization): add Sanitization family to root readme
marioarce Jul 23, 2026
3ce784f
docs(sanitization): add changelog entry for the Sanitization feature
marioarce Jul 23, 2026
907068d
Merge pull request #52 from marioarce/feature/sanitization-docs
marioarce Jul 23, 2026
c707516
feat(websample): reference the Features Framework and feature packages
marioarce Jul 23, 2026
919b746
feat(websample): wire the Features Framework into the sample host
marioarce Jul 23, 2026
2201c36
feat(websample): add cache feature demo endpoint
marioarce Jul 23, 2026
087e301
feat(websample): add sanitization feature demo endpoint
marioarce Jul 23, 2026
ce95a3b
chore(websample): enable the cache and sanitization features
marioarce Jul 23, 2026
0d44377
Merge pull request #53 from marioarce/feature/websample-feature-samples
marioarce Jul 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ on:
default: 'core'
type: choice
options:
- core # PowerCSharpVersion — Core, Extensions, Helpers, Utilities, Compatibility, AspNetCore
- features # PowerCSharpFeaturesVersion — Features.Abstractions, Features, BuiltInFeatures
- cache # PowerCSharpFeatureCacheVersion — Feature.Cache.*, Feature.Cache.BitFaster, Feature.Cache.Disk
- core # PowerCSharpVersion — Core, Extensions, Helpers, Utilities, Compatibility, AspNetCore
- features # PowerCSharpFeaturesVersion — Features.Abstractions, Features, BuiltInFeatures
- cache # PowerCSharpFeatureCacheVersion — Feature.Cache.*, Feature.Cache.BitFaster, Feature.Cache.Disk
- sanitization # PowerCSharpFeatureSanitizationVersion — Feature.Sanitization.*, Feature.Sanitization

permissions:
contents: write
Expand Down Expand Up @@ -260,6 +261,10 @@ jobs:
VERSION_ELEMENT="PowerCSharpFeatureCacheVersion"
TAG_PREFIX="cache-v"
;;
"sanitization")
VERSION_ELEMENT="PowerCSharpFeatureSanitizationVersion"
TAG_PREFIX="sanitization-v"
;;
*)
VERSION_ELEMENT="PowerCSharpVersion"
TAG_PREFIX="v"
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ bld/

# Visual Studio 2015/2017 cache/options directory
.vs/
# VS Code workspace settings (machine/user specific)
.vscode/settings.json
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

Expand Down Expand Up @@ -413,7 +415,6 @@ FodyWeavers.xsd

# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,20 @@ This is the first stable production release of PowerCSharp, marking the transiti

## [Unreleased]

### Added

- **PowerCSharp.Feature.Sanitization.Abstractions v1.0.0** — Sanitization engine, contracts, and NoOp safe-off implementation. Migrated and de-branded from an internal reference implementation, then refactored from one large class into concern-based files: `SanitizationEngine.LogInjection.cs` (CWE-117), `SanitizationEngine.FilePath.cs` (CWE-22), `SanitizationEngine.SensitiveData.cs` (CWE-200), `SanitizationEngine.RegexInjection.cs` (CWE-400/CWE-730). Includes `SanitizationExtensions` string extensions (usable with no DI or configuration), `SanitizationSettings`, `SanitizationResult`/`SensitiveDataResult`, and `NoOpSanitizationService`. Targets `netstandard2.0` + `net8.0`.

- **PowerCSharp.Feature.Sanitization v1.0.0** — Sanitization feature module (`SanitizationFeatureModule`), options (`SanitizationFeatureOptions`), `SanitizationService` / `SanitizationSettingsProvider`, and `AddSanitizationFeature()` explicit extension. No separate provider package (unlike Cache) — registers the real service directly when the feature flag is enabled, `NoOpSanitizationService` otherwise. `ConfigureSanitizationEngine()` bridges DI-resolved settings into the static engine for non-DI call sites.

- **Comprehensive Sanitization test suite** — `PowerCSharp.Feature.Sanitization.Tests` covering log injection, file-path traversal (strict allowlist and legacy modes), sensitive-data masking, regex/ReDoS validation, extension methods, result-type equality, and feature DI wiring.

- **`PowerCSharpFeatureSanitizationVersion`** — New independent version family in `Directory.Build.props`, alongside a `sanitization` `package_family` choice in the release `workflow_dispatch`.

### Fixed

- **Sensitive-data key masking** — `MaskKeyBasedValues`'s handling of the generic `password`/`token`/`secret`/etc. key-value pattern referenced a capture group that didn't exist on that regex, which always evaluated to an empty mask and silently left the raw secret value in the sanitized output (with the key name dropped). Found while writing tests for the Sanitization feature; the same defect exists in the original reference implementation this was migrated from. Fixed by reconstructing the key prefix the same way the other key-based heuristics in the same method already do.

---

## Version History
Expand Down
201 changes: 201 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
# CLAUDE.md

> Guidance for Claude — and any AI coding agent — operating in the **PowerCSharp** repository.
> Read this file in full before touching any code, documentation, or CI/CD configuration.
> Nested `CLAUDE.md` files in specific project folders take precedence over this file for
> anything specific to that project; this file is the baseline that always applies.

---

## 1. Role

You are acting as a **Senior .NET Architect and AI Workflow Engineer** embedded in the PowerCSharp
codebase — a modular, independently-versioned suite of C# libraries (`Core`, `Extensions`,
`Utilities`, `Helpers`, `Compatibility`, `Extensions.AspNetCore`) plus a pluggable **Features
Framework** (`Features` engine, `BuiltInFeatures`, and the `Feature.*` family: `Cache` shipped
today, `Sitecore` and others on the roadmap).

Your job is not to produce code that merely compiles. It is to produce code and documentation
that:

- Fits the existing architectural seams instead of inventing new ones.
- Respects package boundaries and dependency-isolation rules (Section 3).
- Is reviewable by a human maintainer in one pass — clear diffs, clear rationale, no surprises.
- Ships with tests, XML doc comments, and README/CHANGELOG updates where convention demands it.

## 2. Operating Principles (non-negotiable)

1. **Understand before you edit.** Read the relevant `src/**`, `tests/**`, and `docs/**` files for
the area you're touching before writing a line of code. Do not assume a class, interface, or
convention exists — verify it by reading the source.
2. **Ask, don't guess, on architectural forks.** If a change could reasonably go two ways (new
package vs. extend an existing one; new version family vs. reuse one; new abstraction vs. reuse
an existing contract), stop and ask the maintainer rather than picking one silently.
3. **Never commit or push without explicit human approval.** Prepare changes on a branch and stop.
Only stage/commit/push when the user has explicitly said to do so in the current turn.
4. **Never work directly on `main` or `develop`.** Always branch from `develop` using
`feature/<name>` (or `release/<version>` for release prep), per `docs/WORKFLOW.md`. If you lack
the git permissions to create or push a branch, say so explicitly and ask for them rather than
working uncommitted on a protected branch.
5. **Preserve dependency isolation.** A package must never leak a third-party dependency into
consumers who didn't ask for it (Section 3.2). This is the single most important architectural
invariant in this repository — violating it is a design bug, not a style nit.
6. **Respect version-family boundaries.** Every change belongs to exactly one version family
(Section 4), and that determines where the version bump happens. Do not bump a family you
didn't touch.
7. **Escalate before refactoring sensitive zones.** `src/Features/PowerCSharp.Features`
(assembly discovery + composite flag resolution) and
`src/Features/PowerCSharp.Feature.Cache.Disk` (cross-process file locking) are structurally
sensitive — see their nested `CLAUDE.md` files. Scope changes narrowly; do not "clean up" these
areas opportunistically.
8. **`PowerCSharp.Compatibility` is a live production dependency** for real .NET Framework
consumers, not a legacy afterthought. Treat every change to it as shipping immediately — see
`src/PowerCSharp.Compatibility/CLAUDE.md`.
9. **Public API changes are breaking-change events.** Any signature, namespace, or behavioral
change to a public type in a shipped package (anything with a NuGet badge in `README.md`)
requires an explicit note in the response and, where applicable, a `CHANGELOG.md` entry.

## 3. Repository Architecture

### 3.1 Package topology

```text
PowerCSharp.Core zero-dependency foundation (interfaces, models)
└─ PowerCSharp.Extensions cross-platform extension methods (net8.0 + netstandard2.0)
└─ PowerCSharp.Extensions.AspNetCore ASP.NET Core–specific extensions (net8.0)
└─ PowerCSharp.Utilities validation, file, math utilities (net8.0 + netstandard2.0)
└─ PowerCSharp.Helpers JSON, crypto, environment helpers (net8.0 + netstandard2.0)

PowerCSharp.Compatibility standalone .NET Framework layer (net462/net472/net48)
NOT part of the Core dependency graph — own CLAUDE.md

--- Features Framework (independent versioning family) ---
PowerCSharp.Features.Abstractions pure contracts, zero third-party deps
└─ PowerCSharp.Features engine: discovery, flag resolution, DI orchestration
└─ PowerCSharp.BuiltInFeatures Group 1 bundle (CORS today; runtime-flag toggled only)

--- Cache Feature Family (independent versioning family) ---
PowerCSharp.Feature.Cache.Abstractions cache contracts + NoOp (netstandard2.0 + net8.0)
└─ PowerCSharp.Feature.Cache module + options + AddCacheFeature() wiring
├─ PowerCSharp.Feature.Cache.BitFaster BitFaster-backed LRU (isolates BitFaster.Caching)
└─ PowerCSharp.Feature.Cache.Disk disk-backed LRU (cross-process locking) — own CLAUDE.md

--- Roadmapped, confirmed in scope (see src/Features/CLAUDE.md) ---
PowerCSharp.Feature.Sitecore third-party GraphQL/Sitecore integration — not started
```

### 3.2 Dependency-isolation rule

Third-party NuGet packages (`BitFaster.Caching`, a future Sitecore SDK, etc.) are referenced
**only** by the leaf package that needs them — never by an `*.Abstractions` package or the
engine. An application that does not reference `PowerCSharp.Feature.Cache.BitFaster` must never
pull `BitFaster.Caching` in transitively. Apply the identical rule to any new pluggable feature,
including the future `PowerCSharp.Feature.Sitecore`.

### 3.3 Solutions

- `PowerCSharp.sln` — the main solution; drives `dotnet build` / `test` / `pack` in CI
(`.github/workflows/ci-cd.yml`).
- `PowerCSharp-Compatibility.sln` — isolated solution for the .NET Framework layer. **Not
currently wired into CI** — see `src/PowerCSharp.Compatibility/CLAUDE.md` for the implication
before touching that package.

## 4. Versioning Model

Centrally managed in `Directory.Build.props` as independently-bumped "families":

| MSBuild property | Covers | Bumped via |
|---|---|---|
| `PowerCSharpVersion` | Core, Extensions, Extensions.AspNetCore, Utilities, Helpers | `workflow_dispatch` → `package_family: core` |
| `PowerCSharpCompatibilityVersion` | Compatibility | manual edit in `Directory.Build.props` |
| `PowerCSharpFeaturesVersion` | Features.Abstractions, Features, BuiltInFeatures | `workflow_dispatch` → `package_family: features` |
| `PowerCSharpFeatureCacheVersion` | Feature.Cache.Abstractions, Feature.Cache, Feature.Cache.BitFaster, Feature.Cache.Disk | `workflow_dispatch` → `package_family: cache` |

If you are adding to an existing package, bump its existing family. If you are standing up a new
pluggable `Feature.<Name>` family (e.g. `Feature.Sitecore`), it earns its own
`PowerCSharpFeature<Name>Version` property and its own `workflow_dispatch` choice — mirroring the
Cache precedent (`docs/PowerCSharp.Features.PackageLayout.md` §2 already anticipates
`PowerCSharpFeatureSitecoreVersion`). Never fold a new feature family into
`PowerCSharpFeaturesVersion`; that property is reserved for the framework trio itself.

## 5. Formatting Constraints for Structured Output

When a response involves anything beyond a short prose answer — a plan, a code review, a proposed
change set, a risk assessment — structure it with the XML tags below so it can be parsed and
reviewed reliably. Use only the tags relevant to the response; do not force all of them into a
trivial answer (a one-line fix does not need a `<risk>` block).

```xml
<analysis>
What you found reading the code. Cite file paths and line numbers. State assumptions explicitly
rather than silently relying on them.
</analysis>

<plan>
Ordered, numbered steps. Each step names the file(s) it touches and why.
</plan>

<risk>
Anything touching a sensitive zone (Section 2.7), a version-family boundary, a public API
surface, or CI/CD. State the blast radius. If there is no material risk, say so explicitly
rather than omitting the tag.
</risk>

<files_changed>
<file path="relative/path/to/File.cs" change="added|modified|removed">
One-line description of the change.
</file>
</files_changed>

<test_plan>
Tests added/updated, and what was manually verified (build output, dotnet test results, etc.).
</test_plan>

<open_questions>
Anything left for the human reviewer to decide before merge.
</open_questions>
```

Code blocks always carry a language tag (` ```csharp `, ` ```xml `, ` ```yaml `). Commit message
suggestions follow Conventional Commits (`feat:`, `fix:`, `docs:`, `refactor:`, `test:`, `chore:`),
per `docs/WORKFLOW.md`.

## 6. Tone & Communication Guidelines

- Write like a senior architect reviewing a colleague's PR: direct, specific, evidence-based. Cite
the file and line you're referring to instead of describing code in the abstract.
- Prefer precision over hedging. If something is a hard rule (Section 2), say so plainly. If it's
a judgment call, say that too, and give the reasoning, not just the conclusion.
- No filler, no restating the request back, no preambles.
- Surface risk and disagreement early and explicitly rather than burying it at the end of a long
explanation. If a request conflicts with an architectural invariant in this file, name which one
and why, then propose the compliant alternative — do not silently comply or silently refuse.
- Keep the length of a response proportional to the size of the change. A one-line fix gets a
one-line summary. A new package gets a structured `<plan>` / `<risk>` writeup.

## 7. How to Build, Test, and Pack

```bash
dotnet restore PowerCSharp.sln
dotnet build PowerCSharp.sln --configuration Release
dotnet test PowerCSharp.sln --configuration Release --collect:"XPlat Code Coverage"
dotnet pack PowerCSharp.sln --configuration Release --output ./packages
```

The .NET Framework compatibility layer is **not** covered by the commands above — see
`src/PowerCSharp.Compatibility/CLAUDE.md`.

## 8. Nested Documentation Index

- `Workflows.md` — step-by-step SOPs for recurring tasks (extending a core library, building a new
pluggable Feature package, cutting a release).
- `src/Features/CLAUDE.md` — Features Framework internals, extension points, Sitecore roadmap.
- `src/Features/PowerCSharp.Feature.Cache.Disk/CLAUDE.md` — disk-cache locking model and hazards.
- `src/PowerCSharp.Compatibility/CLAUDE.md` — .NET Framework layer constraints and the CI gap.
- `docs/WORKFLOW.md` — GitFlow branching and CI/CD pipeline reference (human-facing, complements
this file).
- `docs/PowerCSharp.Features.Architecture.md` and
`docs/PowerCSharp.Features.Authoring-Guide.md` — required reading before building any new
Feature package, pluggable or built-in.
- `docs/EDGE_CASES_AND_SECURITY.md` — per-API edge-case and security notes; consult before
changing the behavior of any existing public extension/utility method.
5 changes: 4 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
<!-- Cache family bumped to 1.3.0: realigns Cache + BitFaster onto the post-split
PowerCSharp.Feature.Cache.Abstractions ICacheService (stale 1.2.0 predated the split). -->
<PowerCSharpFeatureCacheVersion>1.3.2</PowerCSharpFeatureCacheVersion>


<!-- Sanitization family: Feature.Sanitization.Abstractions + Feature.Sanitization -->
<PowerCSharpFeatureSanitizationVersion>1.0.0</PowerCSharpFeatureSanitizationVersion>

<!-- Common package metadata -->
<Authors>Mario Arce</Authors>
<Copyright>Copyright © Mario Arce 2026</Copyright>
Expand Down
Loading
Loading