Repository-wide instructions for coding agents working on this AWS AI/ML security assessment framework. It deploys assessment Lambdas with SAM and Step Functions, writes findings CSVs, and renders single- and multi-account HTML reports. The current check inventory, counts, and check IDs are in docs/SECURITY_CHECKS.md.
docs/SECURITY_CHECKS_*.md catalog define each check’s claim, evidence, severity, and
remediation. docs/SECURITY_CHECKS_AISF.md defines the
derived AISF view and its coverage semantics.Use the repository .venv/bin/ executables for Python, pip, pytest, Ruff, and cfn-lint. Do not
install Python packages globally or rely on a shell activation. Use git and the
system-installed sam normally. Setup, environment variables, SAM commands, and the full test
commands are in the developer guide’s
Running Checks Locally section.
Run everything under tests/ in one pytest session. Test modules load each assessment package’s
app.py under a distinct name with importlib.util.spec_from_file_location; a bare
import app can resolve to a different package’s module. Run responsible_ai_grc_tests/ in a
separate session and generate_consolidated_report/test_generate_report.py from its own directory.
Keep assessment_history/ at 100% line and branch coverage.
Use the guide’s whole-repository .venv/bin/ruff check . and .venv/bin/ruff format --check .
commands before delivery. Run the relevant pytest sessions, cfn-lint for changed templates, and
SAM validation/build when deployment wiring changes. Generate and inspect both report modes when
a check, lens, standard, or report UI changes.
aiml-security-assessment/template.yaml and
template-multi-account.yaml, deploy the assessment runtime. The top-level
deployment/*.yaml templates and buildspec.yml deploy and orchestrate it in single- and
multi-account modes. Keep runtime assessment API permissions on the calling Lambda in
both SAM templates; the top-level roles hold deployment, execution polling, and report
retrieval permissions.Enable*Assessment switches (Bedrock, SageMaker, AgentCore,
AgentRegistry) flow through both deployment modes, CodeBuild, the
Configure Service Assessments Step Functions state, CSV requirements, OWASP source reads,
and report scope.
Deselected services appear as Not selected, never clean or N/A. Optional Responsible AI
GRC and OWASP remain independent. See the guide’s Service
Selection section.OriginalInput, Execution,
Region, RegionIndex, and selection flags through success, skipped, and caught-error paths.
Set ResultPath explicitly on result-producing Task and Pass states as well as on
Catch; a catch-path ResultPath does not protect successful transitions. Test through the
following Choice and report state.region= to each
create_finding() call, and writes a region-suffixed CSV keyed on Execution.Name.
Responsible AI GRC runs once at RegionIndex == 0 when GRC or OWASP is enabled and writes an
unsuffixed CSV. OWASP reads the selected Bedrock, SageMaker, and AgentCore regional CSVs and
the first-region GRC CSV; it does not ingest Agent Registry rows. Preserve these producer,
consumer, and selected-artifact contracts when adding an area.Check_ID, Finding, Finding_Details, Resolution, Reference, Severity, Status, Region.Compliance_Frameworks; the four direct services use it for AISF traceability tags. Each SAM
Lambda packages its own schema.py; update the relevant copies together and keep report
parsing compatible with extra columns. Keep Compliance_Frameworks off the OWASP,
IAM-caching, and report-generation copies of schema.py; those three do not produce
AISF-tagged findings CSVs. Check ID prefixes (BR-, SM-, AC-, AR-, AG-,
FS-, OW-, AISF-) route findings into report sections and history.Check_ID prefix, then defaults to service = "bedrock" if no name
matches. Register a new prefix before emitting it so its rows are not silently misfiled.AG- rows are mapped from direct findings, with native AgentCore gateway checks. OWASP maps
BR-/SM-/AC-/FS- sources plus native checks; its mapping values are lists, and an N/A source
produces an OW- row with Informational severity. Verify mapped source IDs, allocated AG
IDs, and catalog entries whenever these mappings change.AG-24 through AG-27 and AG-39 are native gateway checks. AISF is a derived report view:
derive_aisf_findings() emits AISF- rows from existing checks in both consolidators, without
a Lambda, CSV, Step Functions branch, or extra S3 prefix. Keep the report registry entry
"derived": True, and exclude derived rows from the 277-check catalog total. The changes
report derives AISF rows from each run’s compared findings through assessment_history/derived.py;
keep successful controls when another mapping fails and name skipped controls in report notes.s3:PutObject to the
writer, and s3:ListBucket and s3:GetObject to each consumer where it lists or reads, in
both SAM templates. Missing, unreadable, or header-only selected artifacts must be reported
as incomplete, including in the multi-account consolidator.sam deploy path in buildspec.yml.
EnableSageMakerArtifactObjectReads controls the broad s3:GetObject grant used for SM-43’s
HeadObject evidence and defaults to false. EnableAgentCoreArtifactObjectReads
controls s3:GetObject, s3:GetObjectVersion, ecr:BatchGetImage, and
ecr:GetDownloadUrlForLayer for AC-34 and AC-35 content reads and also defaults to false.Passed; keep the predicate, Check_ID, finding
text, resolution, and catalog description aligned.Passed means checked and compliant; Failed means checked and non-compliant; N/A means no
applicable resource or no conclusive assessment. Access denied and regional API or feature
unavailability use N/A, not Failed. An unsupported region or feature must produce an
N/A/Informational availability row. Keep denied, unavailable, empty, and incomplete
inventories distinguishable; an inconclusive probe cannot claim that no resources exist. Use
each package’s existing error helpers.N/A/Informational, not Failed. Do not
emit Failed with “No action required” or call an optional hardening gap Passed; advisory
gaps use N/A/Informational. Passed rows must not include remediation instructions.Region. A complete
empty inventory emits an explicit N/A row for each affected check. On a safety cap or
deadline, retain collected resource findings and add an incomplete notice.{"statusCode": 500} without raising can leave an invisible missing
artifact.Check_ID and visible partial results.123456789012, 111122223333, 444455556666, and 777788889999. Anonymized sample reports
additionally use the repeated-digit placeholders from ANONYMIZED_ACCOUNT_IDS in
sample-reports/scripts/capture_screenshots.py; keep that list’s order stable, since an ID’s
position decides which discovered ID maps to it.AGENTS.md, README.md, docs/DEVELOPER_GUIDE.md,
docs/SECURITY_CHECKS.md, the applicable check catalogs, docs/TROUBLESHOOTING.md,
CHANGELOG.md, and affected scope, severity, sample-report, and diagram documentation.
Update check counts, headings, table-of-contents links, deep links, remediation, and report
examples where they drift.buildspec.yml, consolidator, assessment runtime, or
deployment-template changes, add one user-facing CHANGELOG.md Unreleased entry. When
deployable files change, include Deployment impact with the exact single-account,
CodeBuild, member-role StackSet, and/or central infrastructure actions in the required order.
Follow docs/UPGRADING.md.responsible_ai_grc_assessments/app.py or its check catalog changes, run
.venv/bin/python generate_provenance.py --check; if stale, regenerate provenance.json
with generate_provenance.py and commit it. When assessment-history matching changes, run
its coverage gate. Anonymize new sample reports, including the changes sample, with
sample-reports/scripts/capture_screenshots.py --anonymize-only as described in
docs/DEVELOPER_GUIDE.md.