A Python implementation of the Ampla Security Analysis pipeline. It replaces the original XSLT orchestration with a Python command-line pipeline while retaining the XSLT stylesheets as behavioral references and parity-test fixtures.
The pipeline accepts a project XML file and an AuthStore XML file. It:
- Normalizes project XML.
- Extracts project security users and scopes.
- Normalizes AuthStore data and reconciles it with project security.
- Generates the Security HTML report.
- Generates the roles and assignments text reports.
Project normalization includes item paths and hashes, selective property handling, class definitions, translations, expressions, DecisionMatrix items, Favorites, SOAP payloads, EquipmentTypes, and subscriptions. AuthStore normalization includes operations, role links, scopes, member resolution, and well-known SID handling.
- Python 3.11 or later
lxml
Install the package and development dependencies:
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -e ".[dev]"On Windows, use py -3 in place of python3 and activate the environment
with .venv\Scripts\activate.
Run the complete pipeline:
python3 -m ampla_security.cli.analyze \
--project AmplaProject.xml \
--authstore AuthStore.xml \
--output-dir Output--project and --authstore are required. --output-dir is optional and
defaults to Output. Use --help to display the command options. Invalid or
unreadable inputs return a non-zero exit status and an error message.
The optional --analyze-findings flag scans the original project XML for
potentially exposed configuration data and writes findings.json to the output
directory. This heuristic analysis is separate from the legacy reports and
does not alter their content. Detected property values are not included in the
findings.
The output directory contains:
| File | Description |
|---|---|
project.xml |
Normalized project |
project.security.xml |
Extracted project security data |
authstore.xml |
Normalized Security document |
Project.Security.html |
Security report |
Project.Security.Roles.txt |
Roles report |
Project.Security.Assignments.txt |
Assignments report |
findings.json |
Optional configuration exposure findings (--analyze-findings) |
Transformations finish before the output artifacts are written.
from lxml import etree
from ampla_security.normalization.project_normalizer import ProjectNormalizer
project = etree.parse("AmplaProject.xml")
normalized = ProjectNormalizer(project).normalize()An optional language document can be passed as language_document. It accepts
a path, an lxml element tree, or a root element. Translation entries use the
original html/body/div[@id] format, where the id matches an item or class
name.
Run the full test suite, including coverage:
python3 -m pytest -qThe suite includes focused normalization tests, XSLT parity comparisons, golden-file checks, reporting tests, and CLI integration tests. Current coverage is 83% statement coverage; this is not a migration-parity percentage.
Run the XML parity validator against the committed synthetic corpus:
python3 -m ampla_security.testing.golden_validator \
--project ampla_security/testing/fixtures/parity/project.xml \
--authstore ampla_security/testing/fixtures/parity/authstore.xml \
--project-root . \
--working-dir working/parityThe validator compares project normalization, project security extraction, and AuthStore normalization with the checked-in XSLT pipeline. Dedicated tests compare the HTML and text reports with XSLT output and checked-in goldens. See Parity Validation for comparison rules and supported claim boundaries.
ampla_security/normalization/— project, security extraction, and AuthStore normalizationampla_security/reporting/— HTML and text reportsampla_security/cli/— pipeline commandampla_security/testing/— pytest suite, parity harness, fixtures, and golden outputssrc/StyleSheets/— original XSLT behavioral referencesdocs/— current usage, pipeline, and validation documentation
This project migrates the workflow of the MIT-licensed Ampla Security Analysis project. The Python implementation preserves behavioral compatibility with the original XSLT pipeline as its migration goal. The original stylesheets remain in this repository as references for tests and output comparisons.