Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
91 changes: 73 additions & 18 deletions .reviewmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
# Processed in order; prefix a pattern with '!' to exclude.
needs-review:
- "**/*.cs" # All C# source and test files
- "requirements.yaml" # Root requirements file
- "docs/reqstream/*.yaml" # Per-software-item requirements files
- "docs/design/*.md" # Software design documents
- "!**/obj/**" # Exclude build output
- "!**/bin/**" # Exclude build output

Expand All @@ -30,51 +32,104 @@ reviews:
- id: ReviewMark-Context
title: Review of Context software unit (command-line argument handling)
paths:
- "docs/reqstream/cli-requirements.yaml" # requirements
- "docs/reqstream/unit-context.yaml" # requirements
- "docs/design/context.md" # design
- "src/**/Context.cs" # implementation
- "test/**/ContextTests.cs" # tests

- id: ReviewMark-GlobMatcher
title: Review of GlobMatcher software unit (file pattern matching)
paths:
- "src/**/GlobMatcher.cs" # implementation
- "test/**/GlobMatcherTests.cs" # tests
- "docs/reqstream/unit-glob-matcher.yaml" # requirements
- "docs/design/glob-matcher.md" # design
- "src/**/GlobMatcher.cs" # implementation
- "test/**/GlobMatcherTests.cs" # tests

- id: ReviewMark-Index
title: Review of Index software unit (review evidence indexing)
- id: ReviewMark-ReviewIndex
title: Review of ReviewIndex software unit (review evidence indexing)
paths:
- "docs/reqstream/index-requirements.yaml" # requirements
- "src/**/Index.cs" # implementation
- "docs/reqstream/unit-review-index.yaml" # requirements
- "docs/design/review-index.md" # design
- "src/**/ReviewIndex.cs" # implementation
- "test/**/IndexTests.cs" # tests

- id: ReviewMark-PathHelpers
title: Review of PathHelpers software unit (file path utilities)
paths:
- "src/**/PathHelpers.cs" # implementation
- "test/**/PathHelpersTests.cs" # tests
- "docs/reqstream/unit-path-helpers.yaml" # requirements
- "docs/design/path-helpers.md" # design
- "src/**/PathHelpers.cs" # implementation
- "test/**/PathHelpersTests.cs" # tests

- id: ReviewMark-Program
title: Review of Program software unit (main entry point and tool orchestration)
paths:
- "docs/reqstream/cli-requirements.yaml" # requirements
- "docs/reqstream/platform-requirements.yaml" # platform requirements
- "docs/reqstream/unit-program.yaml" # requirements
- "docs/design/program.md" # design
- "docs/guide/guide.md" # user guide
- "src/**/Program.cs" # implementation
- "test/**/ProgramTests.cs" # unit tests
- "test/**/IntegrationTests.cs" # integration tests
- "test/**/Runner.cs" # test infrastructure
- "test/**/TestDirectory.cs" # test infrastructure
- "test/**/AssemblyInfo.cs" # test infrastructure

- id: ReviewMark-Configuration
title: Review of ReviewMarkConfiguration software unit (configuration parsing and processing)
paths:
- "docs/reqstream/configuration-requirements.yaml" # requirements
- "src/**/ReviewMarkConfiguration.cs" # implementation
- "test/**/ReviewMarkConfigurationTests.cs" # tests
- "docs/reqstream/subsystem-configuration.yaml" # requirements
- "docs/design/review-mark-configuration.md" # design
- "src/**/ReviewMarkConfiguration.cs" # implementation
- "test/**/ReviewMarkConfigurationTests.cs" # tests

- id: ReviewMark-Validation
title: Review of Validation software unit (self-validation test execution)
paths:
- "docs/reqstream/ots-requirements.yaml" # OTS requirements verified by self-validation
- "docs/reqstream/unit-validation.yaml" # requirements
- "docs/design/validation.md" # design
- "src/**/Validation.cs" # implementation
Comment thread
Malcolmnixon marked this conversation as resolved.
- "test/**/ValidationTests.cs" # tests

# Special review-sets
- id: ReviewMark-System
title: Review of ReviewMark system-level behavior, platform support, and integration
paths:
- "docs/reqstream/reviewmark-system.yaml" # system requirements
- "docs/reqstream/platform-requirements.yaml" # platform requirements
- "docs/design/introduction.md" # design introduction and architecture
- "docs/design/system.md" # system design
- "test/**/IntegrationTests.cs" # integration tests
- "test/**/Runner.cs" # test infrastructure
- "test/**/AssemblyInfo.cs" # test infrastructure

- id: ReviewMark-Design
title: Review of all ReviewMark design documentation
paths:
- "docs/reqstream/platform-requirements.yaml" # platform requirements
- "docs/design/introduction.md" # design introduction and architecture
- "docs/design/system.md" # system design
- "docs/design/context.md" # Context design
- "docs/design/glob-matcher.md" # GlobMatcher design
- "docs/design/review-index.md" # ReviewIndex design
- "docs/design/path-helpers.md" # PathHelpers design
- "docs/design/program.md" # Program design
- "docs/design/review-mark-configuration.md" # ReviewMarkConfiguration design
- "docs/design/validation.md" # Validation design

- id: ReviewMark-AllRequirements
title: Review of all ReviewMark requirements files
paths:
- "requirements.yaml" # root requirements file
- "docs/reqstream/reviewmark-system.yaml" # system-level requirements
- "docs/reqstream/subsystem-cli.yaml" # CLI subsystem requirements
- "docs/reqstream/subsystem-configuration.yaml" # Configuration subsystem requirements
- "docs/reqstream/unit-context.yaml" # Context unit requirements
- "docs/reqstream/unit-program.yaml" # Program unit requirements
- "docs/reqstream/unit-review-index.yaml" # ReviewIndex unit requirements
- "docs/reqstream/unit-glob-matcher.yaml" # GlobMatcher unit requirements
- "docs/reqstream/unit-path-helpers.yaml" # PathHelpers unit requirements
- "docs/reqstream/unit-validation.yaml" # Validation unit requirements
- "docs/reqstream/platform-requirements.yaml" # Platform support requirements
- "docs/reqstream/ots-mstest.yaml" # MSTest OTS requirements
- "docs/reqstream/ots-reqstream.yaml" # ReqStream OTS requirements
- "docs/reqstream/ots-buildmark.yaml" # BuildMark OTS requirements
- "docs/reqstream/ots-versionmark.yaml" # VersionMark OTS requirements
- "docs/reqstream/ots-sarifmark.yaml" # SarifMark OTS requirements
- "docs/reqstream/ots-sonarmark.yaml" # SonarMark OTS requirements
63 changes: 63 additions & 0 deletions docs/design/context.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Context

## Purpose

The `Context` software unit is responsible for parsing command-line arguments and
providing a unified interface for output and logging throughout the tool. It acts as
the primary configuration carrier, passing parsed options from the CLI entry point
to all processing subsystems.

## Properties

The following properties are populated by `Context.Create()` from the command-line
arguments:

| Property | Type | Description |
| -------- | ---- | ----------- |
| `Version` | bool | Requests version display |
| `Help` | bool | Requests help display |
| `Silent` | bool | Suppresses console output |
| `Validate` | bool | Requests self-validation run |
| `Lint` | bool | Requests configuration linting |
| `ResultsFile` | string? | Path for TRX/JUnit test results output |
| `DefinitionFile` | string | Path to the `.reviewmark.yaml` configuration |
| `PlanFile` | string? | Output path for the Review Plan document |
| `PlanDepth` | int | Heading depth for the Review Plan |
| `ReportFile` | string? | Output path for the Review Report document |
| `ReportDepth` | int | Heading depth for the Review Report |
| `IndexPaths` | string[]? | Paths to scan when building an evidence index |
| `WorkingDirectory` | string | Base directory for resolving relative paths |
| `Enforce` | bool | Fail if any review-set is not Current |
| `Elaborate` | bool | Expand file lists in generated documents |

## Argument Parsing

`Context.Create(string[] args)` is a factory method that processes the argument
array sequentially, recognizing both flag arguments (e.g., `--validate`) and
value arguments (e.g., `--plan <path>`). Unrecognized arguments are silently
ignored. The resulting `Context` instance holds the fully parsed state.
Comment thread
Malcolmnixon marked this conversation as resolved.
Outdated

## Output Methods

| Method | Description |
| ------ | ----------- |
| `WriteLine(string)` | Writes a line to the console (unless `Silent` is set) and to the log file |
| `WriteError(string)` | Writes an error line to the console and to the log file |

## Exit Code

`Context.ExitCode` reflects the current error status of the tool run. It is set to
a non-zero value when an error is detected. The value of `ExitCode` is returned from
`Program.Main()` as the process exit code.

## Logging

When a log file path is provided via the relevant CLI argument, `Context` opens and
holds the log file handle for the duration of the tool run. All output written through
`WriteLine` and `WriteError` is duplicated to the log file.

## Resource Cleanup

`Context` implements `IDisposable`. Disposal closes the log file handle if one is
open. `Program.Main()` constructs `Context` inside a `using` statement to guarantee
timely disposal regardless of how the tool exits.
18 changes: 18 additions & 0 deletions docs/design/definition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
resource-path:
- docs/design
- docs/template
input-files:
- docs/design/title.txt
- docs/design/introduction.md
- docs/design/system.md
- docs/design/context.md
- docs/design/glob-matcher.md
- docs/design/index.md
Comment thread
Malcolmnixon marked this conversation as resolved.
Outdated
- docs/design/path-helpers.md
- docs/design/program.md
- docs/design/review-mark-configuration.md
- docs/design/validation.md
template: template.html
table-of-contents: true
number-sections: true
42 changes: 42 additions & 0 deletions docs/design/glob-matcher.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# GlobMatcher

## Purpose

The `GlobMatcher` software unit resolves an ordered list of glob patterns into a
concrete, sorted list of file paths relative to a base directory. It provides the
file enumeration primitive used by the Configuration subsystem to expand the
`needs-review` and `review-set` file lists defined in `.reviewmark.yaml`.

## Algorithm

`GlobMatcher.GetMatchingFiles(baseDirectory, patterns)` processes patterns in the
order they are declared. Each pattern is evaluated as follows:

```mermaid
graph TD
A[For each pattern in order] --> B{Starts with '!'?}
B -->|yes| C[Remove '!' prefix → exclusion pattern]
B -->|no| D[Inclusion pattern]
C --> E[Remove matching paths from result set]
D --> F[Add matching paths to result set]
F --> A
E --> A
A --> G[Sort result set]
G --> H[Return as relative paths with forward slashes]
```

Patterns are evaluated against the base directory using standard glob semantics.
The `**` wildcard matches any number of path segments (recursive matching).

## Return Value

The method returns a sorted list of relative file paths. Path separators are
normalized to forward slashes regardless of the host operating system, ensuring
consistent fingerprint computation across platforms.

## Usage

`GlobMatcher.GetMatchingFiles()` is called by `ReviewMarkConfiguration` to resolve:

- The `needs-review` file list, which represents all files subject to review
- Each `review-set` file list, which represents the files covered by a specific review record
56 changes: 56 additions & 0 deletions docs/design/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Introduction

This document describes the software design for the ReviewMark project.

## Purpose

ReviewMark is a .NET command-line tool for automated file-review evidence management
in regulated environments. It computes cryptographic fingerprints of defined file-sets,
queries a review evidence store for corresponding review records, and produces compliance
documents on each CI/CD run.

This design document describes the internal architecture, subsystems, and software units
that together implement the ReviewMark tool. It is intended to support development,
review, and maintenance activities.

## Scope

This design document covers:

- The software system decomposition into subsystems and software units
- The responsibilities and interfaces of each software unit
- The algorithms and data flows used for fingerprinting, evidence lookup, and document generation
- The self-validation framework

This document does not cover:

- External CI/CD pipeline configuration
- Evidence store setup or administration
- Requirements traceability (see the Requirements Specification)

## Software Architecture

The following diagram shows the decomposition of the ReviewMark software system into
subsystems and software units.

```text
ReviewMark (Software System)
├── CLI Subsystem
│ ├── Program (Software Unit)
│ └── Context (Software Unit)
├── Configuration Subsystem
│ ├── ReviewMarkConfiguration (Software Unit)
│ └── GlobMatcher (Software Unit)
├── Index Subsystem
│ ├── ReviewIndex (Software Unit)
│ └── PathHelpers (Software Unit)
└── Validation (Software Unit)
```

## Audience

This document is intended for:

- Software developers working on ReviewMark
- Quality assurance teams performing design verification
- Project stakeholders reviewing architectural decisions
39 changes: 39 additions & 0 deletions docs/design/path-helpers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# PathHelpers

## Purpose

The `PathHelpers` software unit provides safe path construction utilities that
prevent path traversal attacks. It is used by the Index subsystem when constructing
file system paths to evidence PDF files referenced in the evidence index.

## SafePathCombine()

`PathHelpers.SafePathCombine(basePath, relativePath)` combines a trusted base path
with an untrusted relative path from the evidence index, validating that the result
does not escape the base directory.

The algorithm is:

```mermaid
graph TD
A[Receive basePath and relativePath] --> B{relativePath contains '..' segments?}
B -->|yes| C[Throw exception: path traversal rejected]
B -->|no| D{relativePath is rooted?}
D -->|yes| E[Throw exception: absolute path rejected]
D -->|no| F[Combine basePath and relativePath]
F --> G{Combined path starts with basePath?}
G -->|no| H[Throw exception: traversal detected after combination]
G -->|yes| I[Return combined path]
```

The double-check strategy (pre-validation of segments plus post-combination
verification) defends against edge cases such as URL-encoded separators or
platform-specific path normalization that might otherwise bypass a single check.

## Security Rationale

Evidence index files may be loaded from external sources (file shares or URLs).
The `file` field in each index record is supplied by the evidence store and must
be treated as untrusted input. Without path validation, a maliciously crafted
index could direct the tool to read or reference files outside the intended
evidence directory. `SafePathCombine` eliminates this attack surface.
Loading
Loading