Skip to content

Commit 80bf1f8

Browse files
krokokobgagent
andauthored
fix(security): fix gh issue (#234)
* chore(docs): update roadmap * chore(docs): update roadmap inconsistencies * fix(security): upgrade gh version * fix(docs): fix inconsistencies * fix(scripts): fix failing precommit * fix(docs): fix build --------- Co-authored-by: bgagent <bgagent@noreply.github.com>
1 parent 125e205 commit 80bf1f8

44 files changed

Lines changed: 728 additions & 1364 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/security.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ jobs:
9797
9898
gh issue create \
9999
--title "Security suite failed (${GITHUB_REF_NAME} @ ${short})" \
100+
--label bug \
100101
--body-file "${body_file}"
101102
102103
- name: Fail job if security suite failed

agent/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARG TARGETPLATFORM=linux/arm64
2-
ARG GH_VERSION=2.92.0
2+
ARG GH_VERSION=2.93.0
33

44
FROM --platform=$TARGETPLATFORM jdxcode/mise:latest AS mise
55

docs/decisions/ADR-002-least-privilege-bootstrap-policies.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
**Status:** accepted
44
**Date:** 2026-05-19
5-
**Implementation:** Tracked in RFC #120; artifacts referenced below land progressively across the 8-PR stack and are not yet present on `main`.
5+
**Implementation:** Core shipped (#158, #162). The typed policies (`cdk/src/bootstrap/policies/`), triple-layer versioning (`cdk/src/bootstrap/version.ts``BOOTSTRAP_VERSION = '1.1.0'`, `computeBootstrapHash()`), the generated bootstrap template (`cdk/bootstrap/bootstrap-template.yaml`), and the `mise //cdk:bootstrap` + `mise //cdk:bootstrap:generate` tasks are all present on `main`. Two sub-mechanisms remain pending: the synth-time CDK Aspect (#125, depends on the resource-action-map #124) and the deploy-time `mise //cdk:preflight` validator (#126). See RFC #120 for the original stack.
66

77
## Context
88

@@ -19,7 +19,7 @@ The ABCA project documented three scoped policies in `docs/design/DEPLOYMENT_ROL
1919

2020
## Decision
2121

22-
### Policies as typed TypeScript code in `cdk/src/bootstrap/` *(lands in #122)*
22+
### Policies as typed TypeScript code in `cdk/src/bootstrap/` *(shipped)*
2323

2424
Rationale for location:
2525
- **Agent routing**`AGENTS.md` routes CDK/IAM changes to `cdk/`. An agent modifying a construct that adds a DynamoDB table naturally looks here for the policy it must update.
@@ -35,16 +35,16 @@ Rationale for location:
3535
| **SHA256 hash** | Detects console drift — manual IAM edits that diverge from code. |
3636
| **Action-set comparison** | Precise gap reporting: exactly which actions are missing. |
3737

38-
Semver and hash are emitted as CloudFormation outputs on the CDKToolkit stack, enabling automated preflight checks.
38+
Semver and hash are computed by `cdk/src/bootstrap/version.ts` (`BOOTSTRAP_VERSION`, `computeBootstrapHash()`) and emitted into the generated template / `cdk/bootstrap/{BOOTSTRAP_VERSION,BOOTSTRAP_HASH}` files, enabling automated preflight checks.
3939

4040
### Two-layer preflight validation
4141

42-
1. **CDK Aspect (synth-time)** *(lands in #125)* — will run during `mise //cdk:synth`, visiting every `CfnResource`, looking up required actions in a resource-action-map (#124), and comparing against declared policy. Catches issues at dev time.
43-
2. **Live-account validator (deploy-time)** *(lands in #126)*`mise //cdk:preflight` will read CDKToolkit stack outputs, compare version/hash against requirements, and fail fast with an actionable "re-bootstrap required" message before CloudFormation starts.
42+
1. **CDK Aspect (synth-time)** *(pending — #125)* — will run during `mise //cdk:synth`, visiting every `CfnResource`, looking up required actions in a resource-action-map (#124), and comparing against declared policy. Catches issues at dev time. **Not yet implemented:** `cdk/src/main.ts` currently registers only `AwsSolutionsChecks` (cdk-nag) — there is no bootstrap-policy aspect.
43+
2. **Live-account validator (deploy-time)** *(pending — #126)*`mise //cdk:preflight` will read CDKToolkit stack outputs, compare version/hash against requirements, and fail fast with an actionable "re-bootstrap required" message before CloudFormation starts. **Not yet implemented:** no `preflight` task exists in `cdk/mise.toml`.
4444

4545
### Custom bootstrap template
4646

47-
*(Lands in #123)*will be generated from the policy source code (not hand-maintained). Operators will run `mise //cdk:bootstrap` to provision least-privilege roles in a single command. The template replaces `AdministratorAccess` with the three managed policies while retaining all other default bootstrap resources.
47+
*(shipped)* — generated from the policy source code (not hand-maintained) at `cdk/bootstrap/bootstrap-template.yaml`. Operators run `mise //cdk:bootstrap` (which depends on `mise //cdk:bootstrap:generate` to regenerate the policy JSON, template YAML, and version/hash files) to provision least-privilege roles in a single command. The template replaces `AdministratorAccess` with the three managed policies while retaining all other default bootstrap resources.
4848

4949
### Delivery via stacked PRs (ADR-001)
5050

docs/decisions/ADR-013-tiered-validation-pyramid.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The root cause: there is no **Tier 2** — a local, fast, high-fidelity validati
3131
| Tier | Time | What it catches | Gap |
3232
|------|------|-----------------|-----|
3333
| Pre-commit (Tier 0) | < 5s | Formatting, secrets, trailing whitespace | None — works well |
34-
| mise build (Tier 1) | 30–90s | Compile, unit tests, CDK synth, docs sync, linting | Partial — available but not gated on push |
34+
| mise build (Tier 1) | 30–90s | Compile, unit tests, CDK synth, docs sync, linting | Wired as a pre-push gate (prek `pre-push` hooks run tests + security); the `mise run build` superset is available on demand |
3535
| Remote CI (Tier 3) | 5–20 min | Full matrix, security, E2E, deploy | Authoritative but slow |
3636
| **Local integration (Tier 2)** || **Does not exist** | Integration-level validation without remote round-trip |
3737

@@ -92,9 +92,9 @@ Status: **Implemented** (prek hooks)
9292
- Type sync drift (CDK ↔ CLI types in sync)
9393
- Constants drift (cross-language contract check)
9494

95-
Status: **Partially implemented** — available as `mise run build` but not enforced as a push gate. Agents can invoke this but often skip it.
95+
Status: **Implemented as a pre-push gate.** `.pre-commit-config.yaml` sets `default_install_hook_types: [pre-commit, pre-push]`, and the `monorepo-tests-pre-push` and `monorepo-security-pre-push` hooks (both `stages: [pre-push]`) run `mise run hooks:pre-push:tests` (→ `mise //cdk:test`, `mise //cli:test`, and the agent test suite) and `mise run hooks:pre-push:security` (→ `mise run security`) on every push. Note the shipped gate runs tests + security rather than the full `mise run build` superset (which additionally covers CDK synth, docs sync, and type/constants drift); those remain available on demand and are enforced authoritatively in Tier 3.
9696

97-
Requirement: Make `mise run build` (or a subset) the pre-push gate. Consider splitting into `mise run check:fast` (compile + lint, 30s) and `mise run check:full` (compile + test + synth, 90s).
97+
Remaining refinement: consider splitting into `mise run check:fast` (compile + lint, 30s) and `mise run check:full` (compile + test + synth, 90s), and folding synth/docs-sync/drift checks into the push gate for full Tier 1 coverage.
9898

9999
**Tier 2 — Local sandbox (1–5 min, on-demand before PR)**
100100

@@ -162,7 +162,7 @@ The gap analysis dictates priority:
162162

163163
| Priority | Investment | Impact |
164164
|----------|-----------|--------|
165-
| P0 | Enforce Tier 1 as pre-push gate | Eliminates "pushed without building" class of CI failures |
165+
| P0 | ~~Enforce Tier 1 as pre-push gate~~ **(largely done)** — test + security push gate is wired (prek `pre-push` hooks); remaining work is folding synth/docs-sync/drift into the gate | Eliminates "pushed without building" class of CI failures |
166166
| P1 | `mise run test:integration` (Tier 2a — LocalStack) | Eliminates 60%+ of CI-only failures (AWS API contract mismatches) |
167167
| P2 | Agent smoke test (Tier 2b) | Catches agent runtime regressions before PR |
168168
| P3 | Ephemeral stack deploy (Tier 2c) | Catches IAM/wiring issues that only surface in real deployment |
@@ -207,7 +207,7 @@ Escape hatches must be explicit (noted in PR description, not silent).
207207
- ADR-002 — bootstrap policies (Tier 2c validates IAM preflight locally)
208208
- ADR-008 — definition of done (tier requirements per DoD level)
209209
- ADR-012 (prerequisite) — operational knowledge stack; this ADR depends on 012's skill model for agent interaction with validation tiers
210-
- Current hooks: `.pre-commit-config.yaml` (Tier 0 implementation)
210+
- Current hooks: `.pre-commit-config.yaml` — the config file keeps the `pre-commit` name, but the runner is **prek** (pinned in `mise.toml` `[tools]`; `prek install --prepare-hooks` wires both `pre-commit` and `pre-push` stages). Implements Tier 0 (`pre-commit` stage) and the Tier 1 push gate (`pre-push` stage).
211211
- Current build: `mise.toml` root + package-level configs (Tier 1 implementation)
212212
- LocalStack: https://localstack.cloud (candidate for Tier 2a)
213213
- Firecracker MicroVMs: https://firecracker-microvm.github.io (candidate for Tier 2d)

0 commit comments

Comments
 (0)