Architecture¶
shaar is a command-line tool and a Python library with the same core. Reading exports and CSV files, writing packets and reports, and reading packets need one runtime dependency beyond the Python standard library: faithful-core, the shared foundation library of the Faithful Oversight tools, pinned to an exact version. The collectors and secret providers use optional dependencies, installed as extras.
domain-joined computer
Export-ShaarAccess.ps1 --> shaar export header, records, trailer with SHA-256
WinRM --> shaar collect ad -----+ |
Microsoft Graph --> shaar collect entra ------------------+
CSV files, with a column map or preset --------------------+
v
inputs detect each input's kind from its content, read it into a Snapshot, merge
|
v
assign one reviewer per entry: manager, owner, or reviewer map
campaign rows, row checks, packet digests, campaign digest --> campaign.json
formats one packet workbook per reviewer --> packet-NN-*.xlsx
|
reviewers fill in the packets and return them
v
formats read each returned workbook with the hardened reader
decide check each row against the campaign --> decisions.json
|
administrators remove access
v
verify compare a later Snapshot with the accepted removals
reports fill a report document for each command
outputs render JSON, Markdown, HTML, CSV, and a manifest, and write them safely
cli arguments, files, exit codes
Data flow¶
inputs.read_inputsfingerprints each input (size and SHA-256), detects its kind, and reads it withinputs.exportorinputs.csvread. Each becomes aSnapshotwith its principals, resources, grants, the resources whose membership was read in full, and the problems found.inputs.mergecombines them and keeps the earliest collection time.campaign.buildasksassignfor a reviewer for every grant. It sorts the rows, gives each a row id and a row check, gives each reviewer a packet digest, and digests the whole campaign.campaign.dumpwritescampaign.json.reports.packetsturns each reviewer’s rows into aformats.xlsxpacket.reports.campaign_documentfills the campaign report.decide.read_decisionsreads returned workbooks withformats.xlsx.read_packetand checks each against the campaign. It yields aDecisionRecord, whichdecide.dumpwrites asdecisions.json.verify.verifychecks a laterSnapshotagainst the accepted removals.outputs.renderrenders each report document and writes the files with a manifest. The renderers read only the document.
Modules¶
Module |
Responsibility |
|---|---|
|
Arguments and the commands |
|
|
|
The plain data every reader produces: |
|
The keys that identify principals, resources, and grants across inputs. |
|
|
|
The reviewer rules and the reviewer map. |
|
Rows, digests, |
|
Reads returned packets into a decision record. |
|
Checks a later snapshot against the accepted removals. |
|
|
|
Builds the report documents and the packet files from a campaign, a decision record, or a verification. |
|
|
|
|
|
The synthetic review for |
|
The PowerShell exporter |
|
The published JSON Schemas. |
The model¶
A grant is one principal’s entitlement on one resource: the unit that is reviewed. A key identifies each of the three across inputs, and matching uses keys only. Every record keeps a Source, so every finding can cite a file and a place. Every snapshot keeps its list of Problem records, and the set of resources whose membership was read in full. Only for those resources is the absence of a grant evidence.
Rules the design follows¶
Read-only. The tool never changes the systems it examines. Collectors only read, and the Entra client can send only
GET.Unknown is a result. Anything that could not be read, matched, or verified is reported as unknown or as a problem, never as passed, removed, or clean.
Every finding cites its source. A filename and a detail: a line, a row, or a sheet row.
Hash-bound packets. Row checks, packet digests, and a campaign digest tie returned work to what was sent. They are not signatures. See decision record 6.
No prompts. The tool never asks questions interactively.
Structured exit codes.
0OK,1findings,2usage,3input,4internal.Safe output. Files are owner-only and never replaced without
--force. Reports escape every value.SOURCE_DATE_EPOCHmakes everything reproducible.Separation. Readers handle input,
assign,decide, andverifyare logic on plain data, and renderers handle output.
Packaging¶
Python package on PyPI:
faithful-shaar, with the commandshaar. It needs Python 3.11 or newer. Its one runtime dependency isfaithful-core, pinned to an exact version.Extras:
ad,entra,keyring,vault,aws, andazure. See the README.A standalone executable or a container image is added only when a decision record justifies it.
Decisions¶
See the architecture decision records.