@grubbylee/aiba 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GENERATED_OUTPUT_EXCEPTION.md +30 -0
- package/LICENSE +661 -0
- package/README.md +20 -0
- package/capabilities/audit/README.md +7 -0
- package/capabilities/audit/capability.yaml +54 -0
- package/capabilities/audit/recipes/typescript-reference.yaml +64 -0
- package/capabilities/authorization/README.md +7 -0
- package/capabilities/authorization/capability.yaml +66 -0
- package/capabilities/authorization/recipes/typescript-reference.yaml +73 -0
- package/capabilities/identity/README.md +8 -0
- package/capabilities/identity/capability.yaml +63 -0
- package/capabilities/identity/recipes/typescript-reference.yaml +75 -0
- package/capabilities/notification/README.md +7 -0
- package/capabilities/notification/capability.yaml +71 -0
- package/capabilities/notification/recipes/typescript-reference.yaml +73 -0
- package/capabilities/review-access/README.md +14 -0
- package/capabilities/review-access/capability.yaml +65 -0
- package/capabilities/review-access/recipes/typescript-reference.yaml +78 -0
- package/capabilities/review-access/recipes/wechat-native.yaml +73 -0
- package/capabilities/users/README.md +8 -0
- package/capabilities/users/capability.yaml +76 -0
- package/capabilities/users/recipes/typescript-reference.yaml +75 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +609 -0
- package/dist/render.d.ts +4 -0
- package/dist/render.js +54 -0
- package/package.json +41 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Audit Capability
|
|
2
|
+
|
|
3
|
+
`audit` defines attributable, append-only security events. Event identity,
|
|
4
|
+
actor, correlation, and time come from trusted context; reusable secrets are
|
|
5
|
+
not valid portable event fields.
|
|
6
|
+
|
|
7
|
+
The capability does not select an event database, log vendor, or admin UI.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
apiVersion: aiba.dev/v0alpha1
|
|
2
|
+
kind: Capability
|
|
3
|
+
metadata:
|
|
4
|
+
id: audit
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
title: Audit
|
|
7
|
+
description: >-
|
|
8
|
+
Attributable, append-only security events with trusted timestamps,
|
|
9
|
+
correlation, redaction, and explicit delivery outcomes.
|
|
10
|
+
spec:
|
|
11
|
+
interfaces:
|
|
12
|
+
- identity.principal
|
|
13
|
+
- audit.event
|
|
14
|
+
dependencies: []
|
|
15
|
+
invariants:
|
|
16
|
+
- id: actor-is-trusted-and-attributable
|
|
17
|
+
title: Actor is trusted and attributable
|
|
18
|
+
description: Event actors come from trusted execution context rather than event payload claims.
|
|
19
|
+
severity: critical
|
|
20
|
+
evidence: &sourceAndTest
|
|
21
|
+
acceptedTypes: [source, test, config, document]
|
|
22
|
+
requiredTypes: [source, test]
|
|
23
|
+
minimum: 2
|
|
24
|
+
requireHash: true
|
|
25
|
+
- id: event-identity-and-time-are-server-derived
|
|
26
|
+
title: Event identity and time are server derived
|
|
27
|
+
description: Unique event identifiers and occurrence timestamps are assigned inside the trusted audit boundary.
|
|
28
|
+
severity: critical
|
|
29
|
+
evidence: *sourceAndTest
|
|
30
|
+
- id: events-are-append-only
|
|
31
|
+
title: Events are append-only
|
|
32
|
+
description: The application-facing audit interface cannot update or delete previously accepted events.
|
|
33
|
+
severity: critical
|
|
34
|
+
evidence: *sourceAndTest
|
|
35
|
+
- id: outcomes-are-explicit
|
|
36
|
+
title: Outcomes are explicit
|
|
37
|
+
description: Allowed, denied, succeeded, and failed security outcomes are distinguishable.
|
|
38
|
+
severity: error
|
|
39
|
+
evidence: *sourceAndTest
|
|
40
|
+
- id: events-are-correlated
|
|
41
|
+
title: Events are correlated
|
|
42
|
+
description: Every event carries a trusted correlation identifier for request or workflow attribution.
|
|
43
|
+
severity: error
|
|
44
|
+
evidence: *sourceAndTest
|
|
45
|
+
- id: reusable-secrets-are-rejected
|
|
46
|
+
title: Reusable secrets are rejected
|
|
47
|
+
description: Passwords, credential material, session tokens, reset tokens, and transport secrets are not accepted event fields.
|
|
48
|
+
severity: critical
|
|
49
|
+
evidence: *sourceAndTest
|
|
50
|
+
- id: delivery-failure-is-visible
|
|
51
|
+
title: Delivery failure is visible
|
|
52
|
+
description: An event storage failure is returned to the caller and is never silently treated as recorded.
|
|
53
|
+
severity: critical
|
|
54
|
+
evidence: *sourceAndTest
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
apiVersion: aiba.dev/v0alpha1
|
|
2
|
+
kind: CapabilityRecipe
|
|
3
|
+
metadata:
|
|
4
|
+
id: typescript-reference
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
title: TypeScript Audit Boundary
|
|
7
|
+
description: Semantic guidance for a strict, append-only TypeScript audit recorder.
|
|
8
|
+
spec:
|
|
9
|
+
capability:
|
|
10
|
+
id: audit
|
|
11
|
+
version: 0.1.0
|
|
12
|
+
compatibility:
|
|
13
|
+
languages: [TypeScript]
|
|
14
|
+
frameworks: []
|
|
15
|
+
writeScope:
|
|
16
|
+
allowedPatterns:
|
|
17
|
+
- src/**
|
|
18
|
+
- server/**
|
|
19
|
+
- test/**
|
|
20
|
+
- tests/**
|
|
21
|
+
- cloudfunctions/**
|
|
22
|
+
operations:
|
|
23
|
+
- id: establish-audit-envelope
|
|
24
|
+
intent: Derive actor, event identity, timestamp, and correlation inside the trusted boundary.
|
|
25
|
+
requiredInterfaces: [identity.principal, audit.event]
|
|
26
|
+
invariants: [actor-is-trusted-and-attributable, event-identity-and-time-are-server-derived, events-are-correlated]
|
|
27
|
+
guidance:
|
|
28
|
+
- Accept the actor and correlation identifier only from authenticated server context.
|
|
29
|
+
- Reject payload fields that attempt to replace trusted envelope values.
|
|
30
|
+
- id: constrain-audit-content
|
|
31
|
+
intent: Record explicit outcomes and stable reason codes without reusable secret material.
|
|
32
|
+
requiredInterfaces: [audit.event]
|
|
33
|
+
invariants: [outcomes-are-explicit, reusable-secrets-are-rejected]
|
|
34
|
+
guidance:
|
|
35
|
+
- Use bounded action and reason-code vocabularies rather than arbitrary messages.
|
|
36
|
+
- Keep passwords, hashes, tokens, cookies, authorization headers, and provider credentials out of events.
|
|
37
|
+
- id: establish-audit-delivery
|
|
38
|
+
intent: Append each accepted event durably and expose failed delivery to the caller.
|
|
39
|
+
requiredInterfaces: [audit.event]
|
|
40
|
+
invariants: [events-are-append-only, delivery-failure-is-visible]
|
|
41
|
+
guidance:
|
|
42
|
+
- Expose append but no update or delete operation through the application recorder.
|
|
43
|
+
- Propagate or explicitly queue storage failures; never report an unpersisted event as recorded.
|
|
44
|
+
evidence:
|
|
45
|
+
- invariant: actor-is-trusted-and-attributable
|
|
46
|
+
suggestions: &auditEvidence
|
|
47
|
+
- type: source
|
|
48
|
+
pathPattern: src/**/*.ts
|
|
49
|
+
description: Trusted audit recorder implementation.
|
|
50
|
+
- type: test
|
|
51
|
+
pathPattern: src/**/*.test.ts
|
|
52
|
+
description: Audit envelope, redaction, and delivery tests.
|
|
53
|
+
- invariant: event-identity-and-time-are-server-derived
|
|
54
|
+
suggestions: *auditEvidence
|
|
55
|
+
- invariant: events-are-append-only
|
|
56
|
+
suggestions: *auditEvidence
|
|
57
|
+
- invariant: outcomes-are-explicit
|
|
58
|
+
suggestions: *auditEvidence
|
|
59
|
+
- invariant: events-are-correlated
|
|
60
|
+
suggestions: *auditEvidence
|
|
61
|
+
- invariant: reusable-secrets-are-rejected
|
|
62
|
+
suggestions: *auditEvidence
|
|
63
|
+
- invariant: delivery-failure-is-visible
|
|
64
|
+
suggestions: *auditEvidence
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Authorization Capability
|
|
2
|
+
|
|
3
|
+
`authorization` evaluates an explicit principal, action, and resource against
|
|
4
|
+
trusted policy. It defaults to denial, enforces tenant boundaries, emits a
|
|
5
|
+
portable decision, and records every outcome through audit.
|
|
6
|
+
|
|
7
|
+
It does not prescribe RBAC, ABAC, a policy engine, or an admin UI.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
apiVersion: aiba.dev/v0alpha1
|
|
2
|
+
kind: Capability
|
|
3
|
+
metadata:
|
|
4
|
+
id: authorization
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
title: Authorization
|
|
7
|
+
description: >-
|
|
8
|
+
Fail-closed policy decisions over trusted principals, explicit actions,
|
|
9
|
+
resources, and tenant boundaries with attributable audit outcomes.
|
|
10
|
+
spec:
|
|
11
|
+
interfaces:
|
|
12
|
+
- identity.principal
|
|
13
|
+
- authorization.decision
|
|
14
|
+
- audit.event
|
|
15
|
+
dependencies:
|
|
16
|
+
- id: identity
|
|
17
|
+
version: ^0.1.0
|
|
18
|
+
optional: false
|
|
19
|
+
- id: audit
|
|
20
|
+
version: ^0.1.0
|
|
21
|
+
optional: false
|
|
22
|
+
invariants:
|
|
23
|
+
- id: principal-comes-from-trusted-context
|
|
24
|
+
title: Principal comes from trusted context
|
|
25
|
+
description: Request payloads cannot choose principal type, subject, tenant, role, or permission.
|
|
26
|
+
severity: critical
|
|
27
|
+
evidence: &sourceAndTest
|
|
28
|
+
acceptedTypes: [source, test, config, document]
|
|
29
|
+
requiredTypes: [source, test]
|
|
30
|
+
minimum: 2
|
|
31
|
+
requireHash: true
|
|
32
|
+
- id: decisions-default-to-deny
|
|
33
|
+
title: Decisions default to deny
|
|
34
|
+
description: Missing grants, malformed requests, and policy evaluation failures never imply access.
|
|
35
|
+
severity: critical
|
|
36
|
+
evidence: *sourceAndTest
|
|
37
|
+
- id: action-and-resource-are-explicit
|
|
38
|
+
title: Action and resource are explicit
|
|
39
|
+
description: Each decision binds one bounded action and resource instead of inferring permission from identity.
|
|
40
|
+
severity: critical
|
|
41
|
+
evidence: *sourceAndTest
|
|
42
|
+
- id: deny-takes-precedence
|
|
43
|
+
title: Deny takes precedence
|
|
44
|
+
description: An applicable explicit denial cannot be overridden by a simultaneous allow grant.
|
|
45
|
+
severity: critical
|
|
46
|
+
evidence: *sourceAndTest
|
|
47
|
+
- id: tenant-boundaries-are-enforced
|
|
48
|
+
title: Tenant boundaries are enforced
|
|
49
|
+
description: A tenant principal cannot access a resource assigned to a different tenant.
|
|
50
|
+
severity: critical
|
|
51
|
+
evidence: *sourceAndTest
|
|
52
|
+
- id: policy-is-server-authoritative
|
|
53
|
+
title: Policy is server authoritative
|
|
54
|
+
description: Policy rules and versions come from trusted server state, never request claims.
|
|
55
|
+
severity: critical
|
|
56
|
+
evidence: *sourceAndTest
|
|
57
|
+
- id: decisions-are-attributable
|
|
58
|
+
title: Decisions are attributable
|
|
59
|
+
description: Decisions contain server-derived identity, reason, policy version, time, and decision identifier.
|
|
60
|
+
severity: error
|
|
61
|
+
evidence: *sourceAndTest
|
|
62
|
+
- id: decisions-are-audited
|
|
63
|
+
title: Decisions are audited
|
|
64
|
+
description: Allowed and denied evaluations are recorded, and audit failure cannot result in allowed access.
|
|
65
|
+
severity: critical
|
|
66
|
+
evidence: *sourceAndTest
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
apiVersion: aiba.dev/v0alpha1
|
|
2
|
+
kind: CapabilityRecipe
|
|
3
|
+
metadata:
|
|
4
|
+
id: typescript-reference
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
title: TypeScript Authorization Boundary
|
|
7
|
+
description: Semantic guidance for an explicit, fail-closed TypeScript policy evaluator.
|
|
8
|
+
spec:
|
|
9
|
+
capability:
|
|
10
|
+
id: authorization
|
|
11
|
+
version: 0.1.0
|
|
12
|
+
compatibility:
|
|
13
|
+
languages: [TypeScript]
|
|
14
|
+
frameworks: []
|
|
15
|
+
writeScope:
|
|
16
|
+
allowedPatterns:
|
|
17
|
+
- src/**
|
|
18
|
+
- server/**
|
|
19
|
+
- test/**
|
|
20
|
+
- tests/**
|
|
21
|
+
- cloudfunctions/**
|
|
22
|
+
operations:
|
|
23
|
+
- id: establish-decision-boundary
|
|
24
|
+
intent: Separate trusted principal context from a bounded action and resource request.
|
|
25
|
+
requiredInterfaces: [identity.principal, authorization.decision]
|
|
26
|
+
invariants: [principal-comes-from-trusted-context, action-and-resource-are-explicit, decisions-are-attributable]
|
|
27
|
+
guidance:
|
|
28
|
+
- Reject payload fields for principal, tenant context, role, permission, policy, or decision outcome.
|
|
29
|
+
- Return one explicit decision with a server-derived identifier, reason, policy version, and timestamp.
|
|
30
|
+
- id: evaluate-policy-fail-closed
|
|
31
|
+
intent: Evaluate trusted policy with default deny and explicit deny precedence.
|
|
32
|
+
requiredInterfaces: [authorization.decision]
|
|
33
|
+
invariants: [decisions-default-to-deny, deny-takes-precedence, policy-is-server-authoritative]
|
|
34
|
+
guidance:
|
|
35
|
+
- Treat missing, malformed, unavailable, or ambiguous policy as denial.
|
|
36
|
+
- Avoid implicit wildcard grants; make broad access explicit and independently reviewable.
|
|
37
|
+
- id: enforce-tenant-boundary
|
|
38
|
+
intent: Deny object access across tenant boundaries before evaluating allow grants.
|
|
39
|
+
requiredInterfaces: [authorization.decision]
|
|
40
|
+
invariants: [tenant-boundaries-are-enforced]
|
|
41
|
+
guidance:
|
|
42
|
+
- Compare trusted principal and resource tenant identifiers before policy grant matching.
|
|
43
|
+
- Add object-level authorization tests for attacker-selected resource identifiers.
|
|
44
|
+
- id: audit-policy-decisions
|
|
45
|
+
intent: Record every allow and deny outcome without permitting audit failure to become access.
|
|
46
|
+
requiredInterfaces: [audit.event]
|
|
47
|
+
invariants: [decisions-are-audited]
|
|
48
|
+
guidance:
|
|
49
|
+
- Record stable decision and reason identifiers without sensitive resource contents.
|
|
50
|
+
- Fail closed when required decision auditing cannot be completed.
|
|
51
|
+
evidence:
|
|
52
|
+
- invariant: principal-comes-from-trusted-context
|
|
53
|
+
suggestions: &authorizationEvidence
|
|
54
|
+
- type: source
|
|
55
|
+
pathPattern: src/**/*.ts
|
|
56
|
+
description: Server-side authorization implementation.
|
|
57
|
+
- type: test
|
|
58
|
+
pathPattern: src/**/*.test.ts
|
|
59
|
+
description: Policy, tenant-isolation, and fail-closed tests.
|
|
60
|
+
- invariant: decisions-default-to-deny
|
|
61
|
+
suggestions: *authorizationEvidence
|
|
62
|
+
- invariant: action-and-resource-are-explicit
|
|
63
|
+
suggestions: *authorizationEvidence
|
|
64
|
+
- invariant: deny-takes-precedence
|
|
65
|
+
suggestions: *authorizationEvidence
|
|
66
|
+
- invariant: tenant-boundaries-are-enforced
|
|
67
|
+
suggestions: *authorizationEvidence
|
|
68
|
+
- invariant: policy-is-server-authoritative
|
|
69
|
+
suggestions: *authorizationEvidence
|
|
70
|
+
- invariant: decisions-are-attributable
|
|
71
|
+
suggestions: *authorizationEvidence
|
|
72
|
+
- invariant: decisions-are-audited
|
|
73
|
+
suggestions: *authorizationEvidence
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Identity Capability
|
|
2
|
+
|
|
3
|
+
`identity` defines a server-authoritative authentication and session boundary.
|
|
4
|
+
It produces a stable principal without embedding roles or permissions, keeps
|
|
5
|
+
credentials one-way, and requires opaque, expiring, revocable sessions.
|
|
6
|
+
|
|
7
|
+
The pack is implementation guidance and evidence policy. It does not provide a
|
|
8
|
+
hosted identity service, choose a user database, or execute project commands.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
apiVersion: aiba.dev/v0alpha1
|
|
2
|
+
kind: Capability
|
|
3
|
+
metadata:
|
|
4
|
+
id: identity
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
title: Identity
|
|
7
|
+
description: >-
|
|
8
|
+
Server-authoritative credential verification and session management that
|
|
9
|
+
produces stable principals without granting permissions.
|
|
10
|
+
spec:
|
|
11
|
+
interfaces:
|
|
12
|
+
- identity.principal
|
|
13
|
+
- identity.session
|
|
14
|
+
- audit.event
|
|
15
|
+
dependencies:
|
|
16
|
+
- id: audit
|
|
17
|
+
version: ^0.1.0
|
|
18
|
+
optional: true
|
|
19
|
+
invariants:
|
|
20
|
+
- id: credentials-are-one-way
|
|
21
|
+
title: Credentials are one-way
|
|
22
|
+
description: Recoverable passwords and reusable raw credentials are never stored.
|
|
23
|
+
severity: critical
|
|
24
|
+
evidence: &sourceAndTest
|
|
25
|
+
acceptedTypes: [source, test, config, document]
|
|
26
|
+
requiredTypes: [source, test]
|
|
27
|
+
minimum: 2
|
|
28
|
+
requireHash: true
|
|
29
|
+
- id: principal-is-server-derived
|
|
30
|
+
title: Principal is server derived
|
|
31
|
+
description: Principal type, subject, and tenant are derived from trusted identity state, never client claims.
|
|
32
|
+
severity: critical
|
|
33
|
+
evidence: *sourceAndTest
|
|
34
|
+
- id: failures-do-not-enumerate-accounts
|
|
35
|
+
title: Failures do not enumerate accounts
|
|
36
|
+
description: Unknown, disabled, and invalid-credential accounts expose the same public authentication failure.
|
|
37
|
+
severity: critical
|
|
38
|
+
evidence: *sourceAndTest
|
|
39
|
+
- id: sessions-are-opaque-and-expiring
|
|
40
|
+
title: Sessions are opaque and expiring
|
|
41
|
+
description: Session credentials have strong entropy, are stored one-way, and expire in trusted server state.
|
|
42
|
+
severity: critical
|
|
43
|
+
evidence: *sourceAndTest
|
|
44
|
+
- id: sessions-are-revocable
|
|
45
|
+
title: Sessions are revocable
|
|
46
|
+
description: Trusted callers can invalidate a session before its normal expiration.
|
|
47
|
+
severity: critical
|
|
48
|
+
evidence: *sourceAndTest
|
|
49
|
+
- id: attempts-use-trusted-rate-limits
|
|
50
|
+
title: Attempts use trusted rate limits
|
|
51
|
+
description: Authentication attempts are limited by trusted transport context even when request fields change.
|
|
52
|
+
severity: critical
|
|
53
|
+
evidence: *sourceAndTest
|
|
54
|
+
- id: authentication-is-audited
|
|
55
|
+
title: Authentication is audited
|
|
56
|
+
description: Authentication, session validation, and revocation outcomes emit attributable audit events.
|
|
57
|
+
severity: error
|
|
58
|
+
evidence: *sourceAndTest
|
|
59
|
+
- id: audit-excludes-reusable-secrets
|
|
60
|
+
title: Audit excludes reusable secrets
|
|
61
|
+
description: Audit events never contain passwords, credential hashes, session tokens, or reset tokens.
|
|
62
|
+
severity: critical
|
|
63
|
+
evidence: *sourceAndTest
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
apiVersion: aiba.dev/v0alpha1
|
|
2
|
+
kind: CapabilityRecipe
|
|
3
|
+
metadata:
|
|
4
|
+
id: typescript-reference
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
title: TypeScript Identity Boundary
|
|
7
|
+
description: >-
|
|
8
|
+
Semantic guidance for adapting credential verification, principals,
|
|
9
|
+
sessions, abuse controls, and audit emission to a TypeScript server.
|
|
10
|
+
spec:
|
|
11
|
+
capability:
|
|
12
|
+
id: identity
|
|
13
|
+
version: 0.1.0
|
|
14
|
+
compatibility:
|
|
15
|
+
languages: [TypeScript]
|
|
16
|
+
frameworks: []
|
|
17
|
+
writeScope:
|
|
18
|
+
allowedPatterns:
|
|
19
|
+
- src/**
|
|
20
|
+
- server/**
|
|
21
|
+
- test/**
|
|
22
|
+
- tests/**
|
|
23
|
+
- cloudfunctions/**
|
|
24
|
+
operations:
|
|
25
|
+
- id: establish-credential-boundary
|
|
26
|
+
intent: Verify credentials with a memory-hard one-way function and a non-enumerating public failure.
|
|
27
|
+
requiredInterfaces: [identity.principal]
|
|
28
|
+
invariants: [credentials-are-one-way, failures-do-not-enumerate-accounts]
|
|
29
|
+
guidance:
|
|
30
|
+
- Use a maintained identity provider or a standard memory-hard primitive such as Argon2id or scrypt.
|
|
31
|
+
- Perform equivalent credential work for unknown and known accounts before returning one generic failure.
|
|
32
|
+
- id: derive-principal
|
|
33
|
+
intent: Produce principal identity only from trusted user and tenant records.
|
|
34
|
+
requiredInterfaces: [identity.principal]
|
|
35
|
+
invariants: [principal-is-server-derived]
|
|
36
|
+
guidance:
|
|
37
|
+
- Reject extra request fields that try to select subject, tenant, role, or permission.
|
|
38
|
+
- Keep roles and permissions outside the principal and evaluate them in authorization policy.
|
|
39
|
+
- id: establish-session-boundary
|
|
40
|
+
intent: Issue opaque, expiring, revocable sessions whose reusable tokens are never stored in raw form.
|
|
41
|
+
requiredInterfaces: [identity.session]
|
|
42
|
+
invariants: [sessions-are-opaque-and-expiring, sessions-are-revocable]
|
|
43
|
+
guidance:
|
|
44
|
+
- Generate at least 256 bits of cryptographic randomness and store only a token digest.
|
|
45
|
+
- Enforce expiry and revocation through shared trusted storage on every session validation.
|
|
46
|
+
- id: defend-authentication
|
|
47
|
+
intent: Apply trusted abuse controls and emit redacted security events for every boundary outcome.
|
|
48
|
+
requiredInterfaces: [audit.event]
|
|
49
|
+
invariants: [attempts-use-trusted-rate-limits, authentication-is-audited, audit-excludes-reusable-secrets]
|
|
50
|
+
guidance:
|
|
51
|
+
- Derive rate-limit keys from trusted transport context rather than request identifiers.
|
|
52
|
+
- Emit stable reason codes and correlation identifiers without credential or token material.
|
|
53
|
+
evidence:
|
|
54
|
+
- invariant: credentials-are-one-way
|
|
55
|
+
suggestions: &identityEvidence
|
|
56
|
+
- type: source
|
|
57
|
+
pathPattern: src/**/*.ts
|
|
58
|
+
description: Server-side identity implementation.
|
|
59
|
+
- type: test
|
|
60
|
+
pathPattern: src/**/*.test.ts
|
|
61
|
+
description: Identity boundary and attack tests.
|
|
62
|
+
- invariant: principal-is-server-derived
|
|
63
|
+
suggestions: *identityEvidence
|
|
64
|
+
- invariant: failures-do-not-enumerate-accounts
|
|
65
|
+
suggestions: *identityEvidence
|
|
66
|
+
- invariant: sessions-are-opaque-and-expiring
|
|
67
|
+
suggestions: *identityEvidence
|
|
68
|
+
- invariant: sessions-are-revocable
|
|
69
|
+
suggestions: *identityEvidence
|
|
70
|
+
- invariant: attempts-use-trusted-rate-limits
|
|
71
|
+
suggestions: *identityEvidence
|
|
72
|
+
- invariant: authentication-is-audited
|
|
73
|
+
suggestions: *identityEvidence
|
|
74
|
+
- invariant: audit-excludes-reusable-secrets
|
|
75
|
+
suggestions: *identityEvidence
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Notification Capability
|
|
2
|
+
|
|
3
|
+
`notification` sends authorized, tenant-scoped template commands to trusted
|
|
4
|
+
recipient references. It enforces consent, idempotency, bounded parameters,
|
|
5
|
+
minimized receipts, and redacted delivery audit events.
|
|
6
|
+
|
|
7
|
+
It does not expose provider credentials, choose a vendor, or prescribe a message UI.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
apiVersion: aiba.dev/v0alpha1
|
|
2
|
+
kind: Capability
|
|
3
|
+
metadata:
|
|
4
|
+
id: notification
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
title: Notification
|
|
7
|
+
description: >-
|
|
8
|
+
Authorized, tenant-scoped template delivery with trusted recipient
|
|
9
|
+
resolution, consent, durable idempotency, minimized receipts, and audit.
|
|
10
|
+
spec:
|
|
11
|
+
interfaces:
|
|
12
|
+
- identity.principal
|
|
13
|
+
- authorization.decision
|
|
14
|
+
- audit.event
|
|
15
|
+
- notification.command
|
|
16
|
+
- notification.receipt
|
|
17
|
+
dependencies:
|
|
18
|
+
- id: authorization
|
|
19
|
+
version: ^0.1.0
|
|
20
|
+
optional: false
|
|
21
|
+
- id: audit
|
|
22
|
+
version: ^0.1.0
|
|
23
|
+
optional: false
|
|
24
|
+
- id: users
|
|
25
|
+
version: ^0.1.0
|
|
26
|
+
optional: true
|
|
27
|
+
invariants:
|
|
28
|
+
- id: send-is-authorized
|
|
29
|
+
title: Send is authorized
|
|
30
|
+
description: Every notification command requires an explicit decision over its trusted recipient reference.
|
|
31
|
+
severity: critical
|
|
32
|
+
evidence: &sourceAndTest
|
|
33
|
+
acceptedTypes: [source, test, config, document]
|
|
34
|
+
requiredTypes: [source, test]
|
|
35
|
+
minimum: 2
|
|
36
|
+
requireHash: true
|
|
37
|
+
- id: tenant-comes-from-trusted-context
|
|
38
|
+
title: Tenant comes from trusted context
|
|
39
|
+
description: Requests cannot select the tenant used for templates, recipient resolution, or idempotency.
|
|
40
|
+
severity: critical
|
|
41
|
+
evidence: *sourceAndTest
|
|
42
|
+
- id: content-uses-trusted-templates
|
|
43
|
+
title: Content uses trusted templates
|
|
44
|
+
description: Commands select enabled server templates and bounded parameter keys instead of arbitrary message content.
|
|
45
|
+
severity: critical
|
|
46
|
+
evidence: *sourceAndTest
|
|
47
|
+
- id: recipient-destination-is-server-resolved
|
|
48
|
+
title: Recipient destination is server resolved
|
|
49
|
+
description: Provider destinations and credentials are resolved in trusted adapters, never command fields.
|
|
50
|
+
severity: critical
|
|
51
|
+
evidence: *sourceAndTest
|
|
52
|
+
- id: consent-is-enforced
|
|
53
|
+
title: Consent is enforced
|
|
54
|
+
description: A disabled channel or absent recipient consent suppresses provider delivery.
|
|
55
|
+
severity: critical
|
|
56
|
+
evidence: *sourceAndTest
|
|
57
|
+
- id: delivery-is-idempotent
|
|
58
|
+
title: Delivery is idempotent
|
|
59
|
+
description: A tenant-scoped key is durably bound to one command and propagated to an idempotent provider adapter.
|
|
60
|
+
severity: critical
|
|
61
|
+
evidence: *sourceAndTest
|
|
62
|
+
- id: delivery-failure-is-visible
|
|
63
|
+
title: Delivery failure is visible
|
|
64
|
+
description: Provider or required audit failure cannot produce a sent receipt.
|
|
65
|
+
severity: critical
|
|
66
|
+
evidence: *sourceAndTest
|
|
67
|
+
- id: receipts-and-audit-are-minimized
|
|
68
|
+
title: Receipts and audit are minimized
|
|
69
|
+
description: Results and audit events exclude destinations, parameters, provider secrets, and provider payloads.
|
|
70
|
+
severity: critical
|
|
71
|
+
evidence: *sourceAndTest
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
apiVersion: aiba.dev/v0alpha1
|
|
2
|
+
kind: CapabilityRecipe
|
|
3
|
+
metadata:
|
|
4
|
+
id: typescript-reference
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
title: TypeScript Notification Boundary
|
|
7
|
+
description: Semantic guidance for authorized, idempotent template delivery in TypeScript.
|
|
8
|
+
spec:
|
|
9
|
+
capability:
|
|
10
|
+
id: notification
|
|
11
|
+
version: 0.1.0
|
|
12
|
+
compatibility:
|
|
13
|
+
languages: [TypeScript]
|
|
14
|
+
frameworks: []
|
|
15
|
+
writeScope:
|
|
16
|
+
allowedPatterns:
|
|
17
|
+
- src/**
|
|
18
|
+
- server/**
|
|
19
|
+
- test/**
|
|
20
|
+
- tests/**
|
|
21
|
+
- cloudfunctions/**
|
|
22
|
+
operations:
|
|
23
|
+
- id: establish-notification-command
|
|
24
|
+
intent: Accept a bounded template command while deriving tenant and recipient destination from trusted state.
|
|
25
|
+
requiredInterfaces: [identity.principal, notification.command]
|
|
26
|
+
invariants: [tenant-comes-from-trusted-context, content-uses-trusted-templates, recipient-destination-is-server-resolved]
|
|
27
|
+
guidance:
|
|
28
|
+
- Reject tenant, address, body, provider, credential, and provider-options fields.
|
|
29
|
+
- Resolve an enabled server template and allow only its declared parameter keys.
|
|
30
|
+
- id: authorize-and-check-consent
|
|
31
|
+
intent: Authorize the recipient resource and enforce channel consent before provider invocation.
|
|
32
|
+
requiredInterfaces: [authorization.decision]
|
|
33
|
+
invariants: [send-is-authorized, consent-is-enforced]
|
|
34
|
+
guidance:
|
|
35
|
+
- Evaluate notification send permission over the trusted tenant and recipient reference.
|
|
36
|
+
- Suppress delivery without exposing raw destination or preference records.
|
|
37
|
+
- id: establish-idempotent-delivery
|
|
38
|
+
intent: Bind one command fingerprint to a durable tenant-scoped key and an idempotent provider call.
|
|
39
|
+
requiredInterfaces: [notification.receipt]
|
|
40
|
+
invariants: [delivery-is-idempotent, delivery-failure-is-visible]
|
|
41
|
+
guidance:
|
|
42
|
+
- Persist key, command fingerprint, and final receipt through a shared single-flight boundary.
|
|
43
|
+
- Propagate the same opaque idempotency key to a provider that guarantees duplicate suppression.
|
|
44
|
+
- id: minimize-notification-provenance
|
|
45
|
+
intent: Return and audit only delivery metadata that cannot be reused as a destination or secret.
|
|
46
|
+
requiredInterfaces: [audit.event, notification.receipt]
|
|
47
|
+
invariants: [receipts-and-audit-are-minimized]
|
|
48
|
+
guidance:
|
|
49
|
+
- Exclude destination, parameters, provider request/response, and credentials from receipts and events.
|
|
50
|
+
- Record sent, suppressed, and failed outcomes with template and recipient references only where policy permits.
|
|
51
|
+
evidence:
|
|
52
|
+
- invariant: send-is-authorized
|
|
53
|
+
suggestions: ¬ificationEvidence
|
|
54
|
+
- type: source
|
|
55
|
+
pathPattern: src/**/*.ts
|
|
56
|
+
description: Notification command and delivery implementation.
|
|
57
|
+
- type: test
|
|
58
|
+
pathPattern: src/**/*.test.ts
|
|
59
|
+
description: Authorization, consent, idempotency, and redaction tests.
|
|
60
|
+
- invariant: tenant-comes-from-trusted-context
|
|
61
|
+
suggestions: *notificationEvidence
|
|
62
|
+
- invariant: content-uses-trusted-templates
|
|
63
|
+
suggestions: *notificationEvidence
|
|
64
|
+
- invariant: recipient-destination-is-server-resolved
|
|
65
|
+
suggestions: *notificationEvidence
|
|
66
|
+
- invariant: consent-is-enforced
|
|
67
|
+
suggestions: *notificationEvidence
|
|
68
|
+
- invariant: delivery-is-idempotent
|
|
69
|
+
suggestions: *notificationEvidence
|
|
70
|
+
- invariant: delivery-failure-is-visible
|
|
71
|
+
suggestions: *notificationEvidence
|
|
72
|
+
- invariant: receipts-and-audit-are-minimized
|
|
73
|
+
suggestions: *notificationEvidence
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Review Access
|
|
2
|
+
|
|
3
|
+
This capability defines generic reviewer access. Platform adapters may bind it
|
|
4
|
+
to a WeChat Mini Program release, an App Store review account, a demo tenant, or
|
|
5
|
+
another external review workflow.
|
|
6
|
+
|
|
7
|
+
The capability does not prescribe routes, tables, authentication libraries, or
|
|
8
|
+
UI. A valid implementation must satisfy every invariant in `capability.yaml`.
|
|
9
|
+
|
|
10
|
+
M0 verifies receipt coverage and evidence integrity. The `typescript-reference`
|
|
11
|
+
recipe adds non-executable semantic operations, bounded write paths, and
|
|
12
|
+
evidence suggestions for Agent-assisted installation. The `wechat-native`
|
|
13
|
+
recipe and fixture exercise the same contract through a native Mini Program,
|
|
14
|
+
server-authoritative TypeScript boundary, and black-box HTTP attack tests.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
apiVersion: aiba.dev/v0alpha1
|
|
2
|
+
kind: Capability
|
|
3
|
+
metadata:
|
|
4
|
+
id: review-access
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
title: Review Access
|
|
7
|
+
description: >-
|
|
8
|
+
Time-bound, least-privilege access for application-store and external
|
|
9
|
+
reviewers who cannot use normal account onboarding.
|
|
10
|
+
spec:
|
|
11
|
+
interfaces:
|
|
12
|
+
- identity.principal
|
|
13
|
+
- authorization.decision
|
|
14
|
+
- audit.event
|
|
15
|
+
dependencies: []
|
|
16
|
+
invariants:
|
|
17
|
+
- id: reviewer-is-distinct-principal
|
|
18
|
+
title: Reviewer is a distinct principal
|
|
19
|
+
description: Reviewer sessions never impersonate an internal user or administrator.
|
|
20
|
+
severity: critical
|
|
21
|
+
evidence: &sourceAndTest
|
|
22
|
+
acceptedTypes: [source, test, document]
|
|
23
|
+
requiredTypes: [source, test]
|
|
24
|
+
minimum: 2
|
|
25
|
+
requireHash: true
|
|
26
|
+
- id: server-authoritative-enable
|
|
27
|
+
title: Enablement is server authoritative
|
|
28
|
+
description: Trusted server-side state decides whether review access is enabled.
|
|
29
|
+
severity: critical
|
|
30
|
+
evidence: *sourceAndTest
|
|
31
|
+
- id: scope-is-least-privilege
|
|
32
|
+
title: Scope follows least privilege
|
|
33
|
+
description: Reviewer permissions are explicitly constrained to review-only actions and data.
|
|
34
|
+
severity: critical
|
|
35
|
+
evidence: *sourceAndTest
|
|
36
|
+
- id: access-expires
|
|
37
|
+
title: Access expires automatically
|
|
38
|
+
description: Reviewer credentials and sessions have a server-enforced expiration time.
|
|
39
|
+
severity: critical
|
|
40
|
+
evidence: *sourceAndTest
|
|
41
|
+
- id: access-is-revocable
|
|
42
|
+
title: Access can be revoked
|
|
43
|
+
description: Authorized operators can invalidate reviewer access before its normal expiration.
|
|
44
|
+
severity: error
|
|
45
|
+
evidence: *sourceAndTest
|
|
46
|
+
- id: production-data-is-isolated
|
|
47
|
+
title: Production data is isolated
|
|
48
|
+
description: Reviewer flows expose isolated or explicitly sanitized data, never unrestricted production data.
|
|
49
|
+
severity: critical
|
|
50
|
+
evidence: *sourceAndTest
|
|
51
|
+
- id: attempts-are-rate-limited
|
|
52
|
+
title: Attempts are rate limited
|
|
53
|
+
description: Repeated failed reviewer authentication attempts are limited by trusted server state.
|
|
54
|
+
severity: critical
|
|
55
|
+
evidence: *sourceAndTest
|
|
56
|
+
- id: actions-are-audited
|
|
57
|
+
title: Actions are audited
|
|
58
|
+
description: Authentication, denial, session creation, revocation, and reviewer actions are attributable.
|
|
59
|
+
severity: error
|
|
60
|
+
evidence: *sourceAndTest
|
|
61
|
+
- id: client-cannot-self-assert-reviewer
|
|
62
|
+
title: Client cannot self-assert reviewer identity
|
|
63
|
+
description: Client input cannot select reviewer identity, permissions, data scope, or enablement.
|
|
64
|
+
severity: critical
|
|
65
|
+
evidence: *sourceAndTest
|