@intentius/chant-lexicon-cedar 0.44.8
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/README.md +190 -0
- package/dist/avp/ambient.d.ts +54 -0
- package/dist/avp/ambient.d.ts.map +1 -0
- package/dist/avp/client.d.ts +127 -0
- package/dist/avp/client.d.ts.map +1 -0
- package/dist/avp/describe-resources.d.ts +42 -0
- package/dist/avp/describe-resources.d.ts.map +1 -0
- package/dist/avp/embed.d.ts +120 -0
- package/dist/avp/embed.d.ts.map +1 -0
- package/dist/avp/live-export.d.ts +94 -0
- package/dist/avp/live-export.d.ts.map +1 -0
- package/dist/avp/ownership.d.ts +97 -0
- package/dist/avp/ownership.d.ts.map +1 -0
- package/dist/avp/statement.d.ts +22 -0
- package/dist/avp/statement.d.ts.map +1 -0
- package/dist/avp/store.d.ts +82 -0
- package/dist/avp/store.d.ts.map +1 -0
- package/dist/avp/testdata/mock-transport.d.ts +55 -0
- package/dist/avp/testdata/mock-transport.d.ts.map +1 -0
- package/dist/codegen/docs-cli.d.ts +3 -0
- package/dist/codegen/docs-cli.d.ts.map +1 -0
- package/dist/codegen/docs.d.ts +26 -0
- package/dist/codegen/docs.d.ts.map +1 -0
- package/dist/codegen/emit.d.ts +85 -0
- package/dist/codegen/emit.d.ts.map +1 -0
- package/dist/codegen/generate-cli.d.ts +3 -0
- package/dist/codegen/generate-cli.d.ts.map +1 -0
- package/dist/codegen/generate.d.ts +37 -0
- package/dist/codegen/generate.d.ts.map +1 -0
- package/dist/codegen/naming.d.ts +48 -0
- package/dist/codegen/naming.d.ts.map +1 -0
- package/dist/codegen/package.d.ts +10 -0
- package/dist/codegen/package.d.ts.map +1 -0
- package/dist/composites/deny-by-default-set.d.ts +58 -0
- package/dist/composites/deny-by-default-set.d.ts.map +1 -0
- package/dist/composites/index.d.ts +12 -0
- package/dist/composites/index.d.ts.map +1 -0
- package/dist/composites/owner-can-manage.d.ts +48 -0
- package/dist/composites/owner-can-manage.d.ts.map +1 -0
- package/dist/config.d.ts +102 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/coverage.d.ts +59 -0
- package/dist/coverage.d.ts.map +1 -0
- package/dist/detect.d.ts +18 -0
- package/dist/detect.d.ts.map +1 -0
- package/dist/generated/index.d.ts +251 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/runtime.d.ts +2 -0
- package/dist/generated/runtime.d.ts.map +1 -0
- package/dist/import/adapter.d.ts +21 -0
- package/dist/import/adapter.d.ts.map +1 -0
- package/dist/import/clause-text.d.ts +38 -0
- package/dist/import/clause-text.d.ts.map +1 -0
- package/dist/import/generator.d.ts +53 -0
- package/dist/import/generator.d.ts.map +1 -0
- package/dist/import/parser.d.ts +57 -0
- package/dist/import/parser.d.ts.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/init-templates.d.ts +32 -0
- package/dist/init-templates.d.ts.map +1 -0
- package/dist/integrity.json +22 -0
- package/dist/lint/audit-catalog.d.ts +29 -0
- package/dist/lint/audit-catalog.d.ts.map +1 -0
- package/dist/lint/post-synth/cedar-helpers.d.ts +97 -0
- package/dist/lint/post-synth/cedar-helpers.d.ts.map +1 -0
- package/dist/lint/post-synth/cedc010.d.ts +17 -0
- package/dist/lint/post-synth/cedc010.d.ts.map +1 -0
- package/dist/lint/post-synth/cedc011.d.ts +17 -0
- package/dist/lint/post-synth/cedc011.d.ts.map +1 -0
- package/dist/lint/post-synth/cedc012.d.ts +21 -0
- package/dist/lint/post-synth/cedc012.d.ts.map +1 -0
- package/dist/lint/post-synth/cedc013.d.ts +20 -0
- package/dist/lint/post-synth/cedc013.d.ts.map +1 -0
- package/dist/lint/post-synth/cedc014.d.ts +19 -0
- package/dist/lint/post-synth/cedc014.d.ts.map +1 -0
- package/dist/lint/post-synth/cede010.d.ts +34 -0
- package/dist/lint/post-synth/cede010.d.ts.map +1 -0
- package/dist/lint/post-synth/cede011.d.ts +22 -0
- package/dist/lint/post-synth/cede011.d.ts.map +1 -0
- package/dist/lint/post-synth/ceds010.d.ts +24 -0
- package/dist/lint/post-synth/ceds010.d.ts.map +1 -0
- package/dist/lint/post-synth/ceds011.d.ts +19 -0
- package/dist/lint/post-synth/ceds011.d.ts.map +1 -0
- package/dist/lint/post-synth/ceds012.d.ts +17 -0
- package/dist/lint/post-synth/ceds012.d.ts.map +1 -0
- package/dist/lint/post-synth/index.d.ts +3 -0
- package/dist/lint/post-synth/index.d.ts.map +1 -0
- package/dist/lint/post-synth/wasm-helpers.d.ts +108 -0
- package/dist/lint/post-synth/wasm-helpers.d.ts.map +1 -0
- package/dist/lint/rules/index.d.ts +10 -0
- package/dist/lint/rules/index.d.ts.map +1 -0
- package/dist/lint/rules/policy-shape.d.ts +31 -0
- package/dist/lint/rules/policy-shape.d.ts.map +1 -0
- package/dist/lsp/completions.d.ts +24 -0
- package/dist/lsp/completions.d.ts.map +1 -0
- package/dist/lsp/hover.d.ts +11 -0
- package/dist/lsp/hover.d.ts.map +1 -0
- package/dist/lsp/registry.d.ts +45 -0
- package/dist/lsp/registry.d.ts.map +1 -0
- package/dist/manifest.json +8 -0
- package/dist/mcp/index.d.ts +34 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/policy-coverage.d.ts +81 -0
- package/dist/mcp/policy-coverage.d.ts.map +1 -0
- package/dist/meta.json +699 -0
- package/dist/okf/index.md +37 -0
- package/dist/okf/rules/CEDC001.md +11 -0
- package/dist/okf/rules/CEDC010.md +11 -0
- package/dist/okf/rules/CEDC011.md +15 -0
- package/dist/okf/rules/CEDC012.md +11 -0
- package/dist/okf/rules/CEDC013.md +15 -0
- package/dist/okf/rules/CEDC014.md +15 -0
- package/dist/okf/rules/CEDE010.md +15 -0
- package/dist/okf/rules/CEDE011.md +15 -0
- package/dist/okf/rules/CEDS010.md +15 -0
- package/dist/okf/rules/CEDS011.md +11 -0
- package/dist/okf/rules/CEDS012.md +15 -0
- package/dist/okf/types/AdminAction.md +14 -0
- package/dist/okf/types/Application.md +14 -0
- package/dist/okf/types/ApproveAction.md +13 -0
- package/dist/okf/types/CommentAction.md +14 -0
- package/dist/okf/types/CreateAction.md +14 -0
- package/dist/okf/types/DeleteAction.md +14 -0
- package/dist/okf/types/Document.md +18 -0
- package/dist/okf/types/Folder.md +15 -0
- package/dist/okf/types/Group.md +14 -0
- package/dist/okf/types/ListAction.md +14 -0
- package/dist/okf/types/Policy.md +29 -0
- package/dist/okf/types/ReadAction.md +14 -0
- package/dist/okf/types/ServiceAccount.md +15 -0
- package/dist/okf/types/ShareAction.md +14 -0
- package/dist/okf/types/Team.md +14 -0
- package/dist/okf/types/User.md +18 -0
- package/dist/okf/types/WriteAction.md +14 -0
- package/dist/package-cli.d.ts +3 -0
- package/dist/package-cli.d.ts.map +1 -0
- package/dist/plugin.d.ts +8 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/rules/cedar-helpers.ts +209 -0
- package/dist/rules/cedc010.ts +80 -0
- package/dist/rules/cedc011.ts +47 -0
- package/dist/rules/cedc012.ts +64 -0
- package/dist/rules/cedc013.ts +68 -0
- package/dist/rules/cedc014.ts +73 -0
- package/dist/rules/cede010.ts +89 -0
- package/dist/rules/cede011.ts +58 -0
- package/dist/rules/ceds010.ts +57 -0
- package/dist/rules/ceds011.ts +42 -0
- package/dist/rules/ceds012.ts +50 -0
- package/dist/rules/policy-shape.ts +148 -0
- package/dist/rules/wasm-helpers.ts +315 -0
- package/dist/serializer.d.ts +138 -0
- package/dist/serializer.d.ts.map +1 -0
- package/dist/spec/fetch.d.ts +71 -0
- package/dist/spec/fetch.d.ts.map +1 -0
- package/dist/spec/parse.d.ts +113 -0
- package/dist/spec/parse.d.ts.map +1 -0
- package/dist/spec/pin.d.ts +116 -0
- package/dist/spec/pin.d.ts.map +1 -0
- package/dist/spec/pinned-names.json +18 -0
- package/dist/spec/wasm.d.ts +143 -0
- package/dist/spec/wasm.d.ts.map +1 -0
- package/dist/types/index.d.ts +219 -0
- package/dist/validate-cli.d.ts +3 -0
- package/dist/validate-cli.d.ts.map +1 -0
- package/dist/validate.d.ts +25 -0
- package/dist/validate.d.ts.map +1 -0
- package/package.json +75 -0
- package/src/avp/OWNERSHIP.md +125 -0
- package/src/avp/ambient.test.ts +113 -0
- package/src/avp/ambient.ts +124 -0
- package/src/avp/client.ts +310 -0
- package/src/avp/describe-resources.test.ts +316 -0
- package/src/avp/describe-resources.ts +215 -0
- package/src/avp/embed.test.ts +114 -0
- package/src/avp/embed.ts +190 -0
- package/src/avp/live-export.test.ts +232 -0
- package/src/avp/live-export.ts +185 -0
- package/src/avp/ownership.test.ts +101 -0
- package/src/avp/ownership.ts +170 -0
- package/src/avp/statement.ts +50 -0
- package/src/avp/store.ts +152 -0
- package/src/avp/testdata/mock-transport.ts +147 -0
- package/src/codegen/docs-cli.ts +7 -0
- package/src/codegen/docs.ts +873 -0
- package/src/codegen/emit.ts +496 -0
- package/src/codegen/generate-cli.ts +18 -0
- package/src/codegen/generate.test.ts +128 -0
- package/src/codegen/generate.ts +123 -0
- package/src/codegen/naming.ts +101 -0
- package/src/codegen/package.ts +52 -0
- package/src/composites/composites.test.ts +206 -0
- package/src/composites/deny-by-default-set.ts +98 -0
- package/src/composites/index.ts +13 -0
- package/src/composites/owner-can-manage.ts +80 -0
- package/src/config-namespace.test.ts +44 -0
- package/src/config.test.ts +82 -0
- package/src/config.ts +119 -0
- package/src/coverage.test.ts +61 -0
- package/src/coverage.ts +166 -0
- package/src/detect.test.ts +64 -0
- package/src/detect.ts +59 -0
- package/src/generated/index.d.ts +219 -0
- package/src/generated/index.ts +279 -0
- package/src/generated/lexicon-cedar.json +699 -0
- package/src/generated/runtime.ts +2 -0
- package/src/import/adapter.ts +63 -0
- package/src/import/clause-text.ts +178 -0
- package/src/import/generator.test.ts +133 -0
- package/src/import/generator.ts +219 -0
- package/src/import/parser.test.ts +265 -0
- package/src/import/parser.ts +352 -0
- package/src/import/roundtrip.test.ts +127 -0
- package/src/import/testdata/full.cedar +36 -0
- package/src/import/testdata/full.cedar.json +238 -0
- package/src/import/testdata/realistic.cedar +35 -0
- package/src/import/testdata/simple.cedar +6 -0
- package/src/index.ts +94 -0
- package/src/init-templates.test.ts +158 -0
- package/src/init-templates.ts +358 -0
- package/src/lint/audit-catalog.ts +130 -0
- package/src/lint/post-synth/cedar-helpers.ts +209 -0
- package/src/lint/post-synth/cedc010.ts +80 -0
- package/src/lint/post-synth/cedc011.ts +47 -0
- package/src/lint/post-synth/cedc012.ts +64 -0
- package/src/lint/post-synth/cedc013.ts +68 -0
- package/src/lint/post-synth/cedc014.ts +73 -0
- package/src/lint/post-synth/cede010.ts +89 -0
- package/src/lint/post-synth/cede011.ts +58 -0
- package/src/lint/post-synth/ceds010.ts +57 -0
- package/src/lint/post-synth/ceds011.ts +42 -0
- package/src/lint/post-synth/ceds012.ts +50 -0
- package/src/lint/post-synth/index.ts +25 -0
- package/src/lint/post-synth/post-synth.test.ts +474 -0
- package/src/lint/post-synth/wasm-helpers.ts +315 -0
- package/src/lint/rules/index.ts +12 -0
- package/src/lint/rules/policy-shape.test.ts +90 -0
- package/src/lint/rules/policy-shape.ts +148 -0
- package/src/lsp/completions.test.ts +111 -0
- package/src/lsp/completions.ts +55 -0
- package/src/lsp/hover.test.ts +82 -0
- package/src/lsp/hover.ts +75 -0
- package/src/lsp/registry.ts +74 -0
- package/src/mcp/index.ts +103 -0
- package/src/mcp/policy-coverage.test.ts +176 -0
- package/src/mcp/policy-coverage.ts +205 -0
- package/src/package-cli.ts +22 -0
- package/src/plugin.test.ts +115 -0
- package/src/plugin.ts +312 -0
- package/src/serializer.test.ts +502 -0
- package/src/serializer.ts +335 -0
- package/src/skills/chant-cedar-authoring.md +180 -0
- package/src/skills/chant-cedar-avp-embedding.md +125 -0
- package/src/skills/chant-cedar-meta-policy.md +119 -0
- package/src/spec/default-schema.cedarschema +108 -0
- package/src/spec/fetch.ts +107 -0
- package/src/spec/parse.test.ts +123 -0
- package/src/spec/parse.ts +253 -0
- package/src/spec/pin.test.ts +88 -0
- package/src/spec/pin.ts +243 -0
- package/src/spec/pinned-names.json +18 -0
- package/src/spec/wasm.ts +283 -0
- package/src/validate-cli.ts +8 -0
- package/src/validate.ts +85 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cedar policy parser for `chant import`.
|
|
3
|
+
*
|
|
4
|
+
* Two surfaces come in and one IR goes out:
|
|
5
|
+
*
|
|
6
|
+
* - **`.cedar` policy text** — split by `policySetTextToParts`, then each
|
|
7
|
+
* policy handed to `policyToJson` (or `templateToJson`, for one carrying a
|
|
8
|
+
* slot). The Cedar grammar is never touched here; the module owns it.
|
|
9
|
+
* - **the JSON policy-set envelope** the serializer writes beside the text —
|
|
10
|
+
* `{ staticPolicies, templates, templateLinks }`, whose values are already
|
|
11
|
+
* in Cedar's JSON policy format.
|
|
12
|
+
*
|
|
13
|
+
* The IR is lossless with respect to the authoring model: effect, all three
|
|
14
|
+
* scopes, every `when`/`unless` clause in order, and every annotation. What is
|
|
15
|
+
* *not* in the model is not invented — Cedar comments are dropped by the
|
|
16
|
+
* module before this file sees them, and template links have no authoring
|
|
17
|
+
* shape yet, so they are reported as a warning rather than silently discarded.
|
|
18
|
+
*
|
|
19
|
+
* Unconstrained scopes are the one thing left out of `props`, because `{}` and
|
|
20
|
+
* absent are the same value to the serializer (`principal` with no constraint).
|
|
21
|
+
* Writing `principal: {}` into every imported policy would be noise, not
|
|
22
|
+
* fidelity.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Whether Cedar read this as a static policy or as a template.
|
|
26
|
+
*
|
|
27
|
+
* The discriminant is not chant's: a policy is a template exactly when it
|
|
28
|
+
* carries a `?principal`/`?resource` slot, and `policyToJson` refuses one.
|
|
29
|
+
*/
|
|
30
|
+
export type CedarEntityKind = "policy" | "template";
|
|
31
|
+
/** One imported Cedar policy, in the lossless intermediate shape. */
|
|
32
|
+
export interface CedarPolicyIR {
|
|
33
|
+
kind: CedarEntityKind;
|
|
34
|
+
/** The Cedar policy id — its `@id`, or the envelope key it was filed under. */
|
|
35
|
+
name: string;
|
|
36
|
+
/** The `Cedar::Policy` props, ready to hand to the authoring class. */
|
|
37
|
+
props: Record<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
export interface CedarParseResult {
|
|
40
|
+
entities: CedarPolicyIR[];
|
|
41
|
+
warnings: string[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Is this the JSON policy-set envelope?
|
|
45
|
+
*
|
|
46
|
+
* Deliberately strict about foreign keys: a CloudFormation template or a
|
|
47
|
+
* Kubernetes manifest must not walk in through a permissive shape test, and
|
|
48
|
+
* `detect.ts` leans on the same rule.
|
|
49
|
+
*/
|
|
50
|
+
export declare function isPolicySetEnvelope(data: unknown): data is Record<string, unknown>;
|
|
51
|
+
export declare class CedarParser {
|
|
52
|
+
parse(content: string): CedarParseResult;
|
|
53
|
+
private parseText;
|
|
54
|
+
private parseEnvelope;
|
|
55
|
+
private toIR;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/import/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAcH;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEpD,qEAAqE;AACrE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,eAAe,CAAC;IACtB,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAuKD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMlF;AAWD,qBAAa,WAAW;IACtB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAWxC,OAAO,CAAC,SAAS;IA+BjB,OAAO,CAAC,aAAa;IAyCrB,OAAO,CAAC,IAAI;CAYb"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export { cedarPlugin } from "./plugin.js";
|
|
2
|
+
export { cedarSerializer, policyIdFromLogicalName, resolvePolicyId, cedarPolicyRecords } from "./serializer.js";
|
|
3
|
+
export { CEDAR_POLICY_TYPE, CEDAR_JSON_FILENAME } from "./serializer.js";
|
|
4
|
+
export type { CedarEffect, CedarScope, CedarPolicyProps, CedarPolicyRecord } from "./serializer.js";
|
|
5
|
+
export { avpStatement, avpStatementJSON, avpPolicyDefinition, avpPolicyResource, avpPolicySet, } from "./avp/embed.js";
|
|
6
|
+
export type { AvpEmbedOptions, AvpPolicyDefinition, AvpPolicyResource, AvpStaticDefinition, } from "./avp/embed.js";
|
|
7
|
+
export { AVP_OWNERSHIP_KEYS, AVP_POLICY_ID_KEY, AVP_DESCRIPTION_MAX, encodeOwnershipDescription, decodeOwnershipDescription, ownershipFromDescription, ownershipFromStoreTags, descriptionIsOwned, storeOwnershipTags, } from "./avp/ownership.js";
|
|
8
|
+
export type { DecodedDescription } from "./avp/ownership.js";
|
|
9
|
+
export { describeAvpResources } from "./avp/describe-resources.js";
|
|
10
|
+
export { observeAvpAmbient, AVP_AMBIENT_KINDS } from "./avp/ambient.js";
|
|
11
|
+
export { exportAvpResources, policyToResourceIR } from "./avp/live-export.js";
|
|
12
|
+
export { resolvePolicyStoreId, AVP_POLICY_STORE_ENV } from "./avp/store.js";
|
|
13
|
+
export { policySetJSON, escapeCedarString } from "./serializer.js";
|
|
14
|
+
export type { CedarPolicySetJSON } from "./serializer.js";
|
|
15
|
+
export { CedarParser, isPolicySetEnvelope } from "./import/parser.js";
|
|
16
|
+
export type { CedarParseResult, CedarPolicyIR, CedarEntityKind } from "./import/parser.js";
|
|
17
|
+
export { CedarGenerator, loadActionConstants, sanitizeName, CEDAR_PACKAGE } from "./import/generator.js";
|
|
18
|
+
export type { CedarGenerateOptions, CedarGenerateResult } from "./import/generator.js";
|
|
19
|
+
export { CedarTemplateParser, CedarTemplateGenerator } from "./import/adapter.js";
|
|
20
|
+
export { detectTemplate } from "./detect.js";
|
|
21
|
+
export { rules as cedarLintRules } from "./lint/rules/index.js";
|
|
22
|
+
export { packageLexicon } from "./codegen/package.js";
|
|
23
|
+
export type { PackageOptions, PackageResult } from "./codegen/package.js";
|
|
24
|
+
export { cedarConfigSchema, loadCedarConfig, CEDAR_DEFAULT_SCHEMA_PATH } from "./config.js";
|
|
25
|
+
export type { CedarConfig } from "./config.js";
|
|
26
|
+
export { CEDAR_WASM_VERSION, CEDAR_LANG_VERSION } from "./spec/pin.js";
|
|
27
|
+
export { computeCedarCoverage, formatCedarCoverage, analyzeCedarCoverage } from "./coverage.js";
|
|
28
|
+
export type { CedarCoverageReport, CedarCoverageItem } from "./coverage.js";
|
|
29
|
+
export { computePolicyCoverage, formatPolicyCoverage } from "./mcp/policy-coverage.js";
|
|
30
|
+
export type { CedarPolicyCoverageReport, CedarPolicyCoverageItem, CedarPolicyCoverageOptions, } from "./mcp/policy-coverage.js";
|
|
31
|
+
export * from "./composites/index.js";
|
|
32
|
+
export { cedarInitTemplates, CEDAR_INIT_TEMPLATES } from "./init-templates.js";
|
|
33
|
+
export * from "./generated/index.js";
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,eAAe,E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,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,OAAO,EAAE,KAAK,IAAI,cAAc,EAAE,MAAM,cAAc,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIvE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AACzF,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI5C,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIpE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC7F,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAIzE,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACpF,YAAY,EACV,yBAAyB,EACzB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,uBAAuB,CAAC;AAG/B,cAAc,oBAAoB,CAAC;AAGnC,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG5E,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant init --lexicon cedar --template <name>` scaffolds.
|
|
3
|
+
*
|
|
4
|
+
* Every template ships a `schema.cedarschema` at the project root. That is not
|
|
5
|
+
* decoration: cedar's codegen input is the project's own schema (epic #1645),
|
|
6
|
+
* and a scaffold without one generates against the bundled default — a project
|
|
7
|
+
* whose typed classes describe somebody else's entity model.
|
|
8
|
+
*
|
|
9
|
+
* The filename is fixed rather than configured because `schema.cedarschema` in
|
|
10
|
+
* the project root is step 2 of the resolution order in `spec/fetch.ts`, so a
|
|
11
|
+
* scaffolded project needs no `cedar.schema` key at all. It also has to be
|
|
12
|
+
* fixed: core writes `chant.config.ts` before a plugin's root files and
|
|
13
|
+
* `writeIfNotExists` keeps the first one, so a template that shipped its own
|
|
14
|
+
* config would be silently discarded. The README each template ships is where
|
|
15
|
+
* `requireProjectSchema` gets recommended, which is the honest place for advice
|
|
16
|
+
* a scaffold cannot enforce.
|
|
17
|
+
*
|
|
18
|
+
* The policy files use `entityType`-string scopes (`{ is: "App::Document" }`)
|
|
19
|
+
* and generated action constants, so a scaffolded project compiles the moment
|
|
20
|
+
* `chant generate` has run against its own schema.
|
|
21
|
+
*/
|
|
22
|
+
import type { InitTemplateSet } from "@intentius/chant/lexicon";
|
|
23
|
+
/**
|
|
24
|
+
* Scaffolds for `chant init`.
|
|
25
|
+
*
|
|
26
|
+
* An unrecognized name falls through to the default rather than throwing —
|
|
27
|
+
* the same behaviour every other lexicon's `initTemplates` has.
|
|
28
|
+
*/
|
|
29
|
+
export declare function cedarInitTemplates(template?: string): InitTemplateSet;
|
|
30
|
+
/** Every template name this lexicon scaffolds, for docs and tests. */
|
|
31
|
+
export declare const CEDAR_INIT_TEMPLATES: readonly ["default", "avp-embedding", "gateway-policy-set"];
|
|
32
|
+
//# sourceMappingURL=init-templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-templates.d.ts","sourceRoot":"","sources":["../src/init-templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AA8QhE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,eAAe,CAwDrE;AAED,sEAAsE;AACtE,eAAO,MAAM,oBAAoB,6DAA8D,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"algorithm": "sha256",
|
|
3
|
+
"artifacts": {
|
|
4
|
+
"manifest.json": "a3b6314f19c537ad8c8bcc2953e4a944540fb2cbf364b7bacb00e9725a2363f0",
|
|
5
|
+
"meta.json": "b218779260169a193882aeee76e5ac559588f1682657a001fb0982cffb5843fc",
|
|
6
|
+
"types/index.d.ts": "9e53a1cb3c9ee38f9de2f3c0db9cc28a0b67c3649be410c341e2451b9b0076cd",
|
|
7
|
+
"rules/policy-shape.ts": "1654730d188b7163dbad3051c75a562198a96eda6d36ce35701f2b729bf45194",
|
|
8
|
+
"rules/cedar-helpers.ts": "5a6e414c4726686d1220e532ed0e384c6b57ee07f8774e40f4eac62fdc2202e6",
|
|
9
|
+
"rules/cedc010.ts": "471f25026ff52682b09fb73818874dbe5ade58ab33bf55855d23745c2d4a9f06",
|
|
10
|
+
"rules/cedc011.ts": "ea3d6ba2987348caf9585e07a95a096b0b28df8b0000a281a2abcc5a639f821e",
|
|
11
|
+
"rules/cedc012.ts": "0b69e938c9d7a5f4605e9985e9c7dace35718d9280c1bce63edfec87a8e77c21",
|
|
12
|
+
"rules/cedc013.ts": "cc91a3036aefb467827d35c61119d6d48377169a2ca08e4dd6decd088371a294",
|
|
13
|
+
"rules/cedc014.ts": "6d35587d13e3c686c8447bf3b069a60b2ee1700a8d48a3de75e36e49701c115f",
|
|
14
|
+
"rules/cede010.ts": "17311a6bcb44187d57f7c3363d1b3a9a055378b8d7963d785b7b713f7ef9a078",
|
|
15
|
+
"rules/cede011.ts": "4ada79ed88ce09a66ff08abd5bc236691014a2d5954afdb6e0f19364e8ed3931",
|
|
16
|
+
"rules/ceds010.ts": "215e14de2b84d935ad9551d37c3c06374e5452a5b3f1d7408dc59cd8c2ef1b33",
|
|
17
|
+
"rules/ceds011.ts": "07984e364b431203a34b42de481fad4fc16d2b838f3fa358726759f4a3ebbfe5",
|
|
18
|
+
"rules/ceds012.ts": "a447c6114d36abf2eca6f90143b06c4b20ede111c777cb04c70024fc4ad93172",
|
|
19
|
+
"rules/wasm-helpers.ts": "c4c3def1669a1818d19ff1864e78bdcbf956da31ca1a6adde7751830765dad6a"
|
|
20
|
+
},
|
|
21
|
+
"composite": "050414f43e9bfd30e46d4249e5493401c0dcbb7de270eb28980dbf7ec83ea9b7"
|
|
22
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The cedar lexicon's `chant audit` catalog — metadata for every CED check,
|
|
3
|
+
* contributed via `cedarPlugin.auditCatalog()` (#687, #1346).
|
|
4
|
+
*
|
|
5
|
+
* A check's own definition says what it looks for. It does not say how severe
|
|
6
|
+
* the finding is, whether the fix is mechanical, what backs the rule, or what
|
|
7
|
+
* to title it in a report. `resolveAuditCatalog` merges this map over core's
|
|
8
|
+
* static catalog to answer all four — and it skips a lexicon that omits the
|
|
9
|
+
* method *silently*, which is how fly's and temporal's checks reached the
|
|
10
|
+
* report with no metadata at all. A repo-level test fails on a gap in either
|
|
11
|
+
* direction, so this map and the shipped checks move together.
|
|
12
|
+
*
|
|
13
|
+
* Every entry here is `yamlBased: true`: each check reads `ctx.outputs` — the
|
|
14
|
+
* emitted policy set — and nothing reads `ctx.entities`, so all of them fire
|
|
15
|
+
* on an audit of a standalone `policies.cedar.json` exactly as they do on a
|
|
16
|
+
* `chant build`. `auditRule()` hardcodes that, so it is used throughout rather
|
|
17
|
+
* than constructing `RuleMeta` by hand the way fly and fountain must.
|
|
18
|
+
*
|
|
19
|
+
* `authority` is left off deliberately. The catalog test treats a citation as
|
|
20
|
+
* proof that a finding is `security`, and Cedar's own docs are a language
|
|
21
|
+
* reference rather than a benchmark like CIS or OSSF Scorecard; citing them
|
|
22
|
+
* would be dressing up chant's own opinion. The one place a citation would be
|
|
23
|
+
* honest — the bare-permit wall — is chant's convention, not upstream's, and
|
|
24
|
+
* the verification report is explicit that Cedar's validator says nothing
|
|
25
|
+
* about it.
|
|
26
|
+
*/
|
|
27
|
+
import { type RuleMeta } from "@intentius/chant/audit/catalog";
|
|
28
|
+
export declare const cedarAuditCatalog: Record<string, RuleMeta>;
|
|
29
|
+
//# sourceMappingURL=audit-catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-catalog.d.ts","sourceRoot":"","sources":["../../src/lint/audit-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1E,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAoGtD,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared reading helpers for the cedar post-synth checks.
|
|
3
|
+
*
|
|
4
|
+
* Every check in this directory judges the same artifact: the JSON policy-set
|
|
5
|
+
* envelope the serializer writes beside the `.cedar` text
|
|
6
|
+
* (`policies.cedar.json` — see `../../serializer.ts`). The text and the JSON
|
|
7
|
+
* are rendered from one in-memory model, so a finding against the JSON is a
|
|
8
|
+
* finding against both; the JSON is the one with structure worth walking.
|
|
9
|
+
*
|
|
10
|
+
* Excluded from check auto-discovery by the "helper" filename filter
|
|
11
|
+
* (`listRuleFiles` in core's `lint/discover.ts`).
|
|
12
|
+
*/
|
|
13
|
+
import type { PostSynthContext } from "@intentius/chant/lint/post-synth";
|
|
14
|
+
/** Files carrying a Cedar JSON policy set end with this. */
|
|
15
|
+
export declare const CEDAR_JSON_SUFFIX = ".cedar.json";
|
|
16
|
+
/** The lexicon name stamped on every diagnostic from this directory. */
|
|
17
|
+
export declare const CEDAR_LEXICON = "cedar";
|
|
18
|
+
/** One scope position of a policy in Cedar's JSON policy format. */
|
|
19
|
+
export interface CedarScopeJson {
|
|
20
|
+
op?: unknown;
|
|
21
|
+
entity?: unknown;
|
|
22
|
+
entities?: unknown;
|
|
23
|
+
entity_type?: unknown;
|
|
24
|
+
in?: unknown;
|
|
25
|
+
}
|
|
26
|
+
/** One `when`/`unless` clause. */
|
|
27
|
+
export interface CedarConditionJson {
|
|
28
|
+
kind?: unknown;
|
|
29
|
+
body?: unknown;
|
|
30
|
+
}
|
|
31
|
+
/** A single policy in Cedar's JSON policy format. */
|
|
32
|
+
export interface CedarPolicyJson {
|
|
33
|
+
effect?: unknown;
|
|
34
|
+
principal?: unknown;
|
|
35
|
+
action?: unknown;
|
|
36
|
+
resource?: unknown;
|
|
37
|
+
conditions?: unknown;
|
|
38
|
+
annotations?: unknown;
|
|
39
|
+
}
|
|
40
|
+
/** The policy-set envelope: what `policies.cedar.json` holds. */
|
|
41
|
+
export interface CedarPolicySetDoc {
|
|
42
|
+
staticPolicies?: unknown;
|
|
43
|
+
templates?: unknown;
|
|
44
|
+
templateLinks?: unknown;
|
|
45
|
+
}
|
|
46
|
+
/** One `[key, policy]` pair out of a policy set, with its origin. */
|
|
47
|
+
export interface CedarPolicyEntry {
|
|
48
|
+
/** The key under `staticPolicies` — the id Cedar will report diagnostics against. */
|
|
49
|
+
key: string;
|
|
50
|
+
policy: CedarPolicyJson;
|
|
51
|
+
/** True when the entry came from `templates` rather than `staticPolicies`. */
|
|
52
|
+
template: boolean;
|
|
53
|
+
}
|
|
54
|
+
/** A policy set found in the build output, with everything needed to name it. */
|
|
55
|
+
export interface CedarPolicySet {
|
|
56
|
+
/** The lexicon output it came from. */
|
|
57
|
+
lexicon: string;
|
|
58
|
+
/** A human-readable origin: the filename, or the lexicon name for a bare string output. */
|
|
59
|
+
source: string;
|
|
60
|
+
/** The raw JSON text, for handing straight to the wasm. */
|
|
61
|
+
raw: string;
|
|
62
|
+
/** Parsed envelope, or undefined when `raw` is not JSON at all. */
|
|
63
|
+
doc?: CedarPolicySetDoc;
|
|
64
|
+
/** The JSON parse error, when there is one. */
|
|
65
|
+
parseError?: string;
|
|
66
|
+
/** Static policies and templates, flattened in document order. */
|
|
67
|
+
entries: CedarPolicyEntry[];
|
|
68
|
+
}
|
|
69
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
70
|
+
/** `permit` / `forbid` / whatever else the document claims. */
|
|
71
|
+
export declare function effectOf(policy: CedarPolicyJson): string | undefined;
|
|
72
|
+
/** The three scope positions, in Cedar's own order. */
|
|
73
|
+
export declare function scopesOf(policy: CedarPolicyJson): Array<{
|
|
74
|
+
variable: string;
|
|
75
|
+
scope: CedarScopeJson;
|
|
76
|
+
}>;
|
|
77
|
+
/** True when a scope position is Cedar's unconstrained "any" (`op: "All"`). */
|
|
78
|
+
export declare function scopeIsAll(scope: unknown): boolean;
|
|
79
|
+
/** Every `when`/`unless` clause, or `[]` when the policy is unconditioned. */
|
|
80
|
+
export declare function conditionsOf(policy: CedarPolicyJson): CedarConditionJson[];
|
|
81
|
+
/** The policy's annotation map, narrowed to the string-valued entries Cedar allows. */
|
|
82
|
+
export declare function annotationsOf(policy: CedarPolicyJson): Record<string, unknown>;
|
|
83
|
+
/** The `@id` annotation, when it is a string. */
|
|
84
|
+
export declare function annotatedId(policy: CedarPolicyJson): string | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Whether a build's `env` (from `--env` or the project's `ownership.env`, see
|
|
87
|
+
* `PostSynthContext#env`) is production-like, for the checks whose severity is
|
|
88
|
+
* env-gated. Same seam and same vocabulary as the aws lexicon's
|
|
89
|
+
* `isFullTierEnv`: an unset or unrecognized env is treated as non-production,
|
|
90
|
+
* so a project that never passes `--env` is never unexpectedly hard-failed.
|
|
91
|
+
*/
|
|
92
|
+
export declare function isProdLikeEnv(env: string | undefined): boolean;
|
|
93
|
+
/** Every candidate policy-set document in the build, parsed or not. */
|
|
94
|
+
export declare function policySets(ctx: PostSynthContext): CedarPolicySet[];
|
|
95
|
+
/** The subset of {@link policySets} that parsed as JSON. */
|
|
96
|
+
export declare function parsedPolicySets(ctx: PostSynthContext): CedarPolicySet[];
|
|
97
|
+
//# sourceMappingURL=cedar-helpers.d.ts.map
|
|
@@ -0,0 +1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A4D;AAC5D,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,gBAAgB,GAAG,cAAc,EAAE,CAExE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CEDC010: the emitted policy set must parse as Cedar
|
|
3
|
+
*
|
|
4
|
+
* The floor every other check stands on. `policies.cedar.json` is Cedar's own
|
|
5
|
+
* JSON policy format inside the `PolicySet` envelope the wasm accepts, which
|
|
6
|
+
* means Cedar's own deserializer is the authority on whether it is well formed
|
|
7
|
+
* — not a hand-written shape test. A set that does not parse cannot be loaded
|
|
8
|
+
* by any evaluator (AVP, cedar-agent, an embedded `cedar-wasm`), so this is an
|
|
9
|
+
* error everywhere, in every environment.
|
|
10
|
+
*
|
|
11
|
+
* Two failure modes reach here: the file is not JSON at all, and the JSON is
|
|
12
|
+
* not a Cedar policy set. Both are reported against the file, since neither
|
|
13
|
+
* has a single implicated policy.
|
|
14
|
+
*/
|
|
15
|
+
import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
|
|
16
|
+
export declare const cedc010: PostSynthCheck;
|
|
17
|
+
//# sourceMappingURL=cedc010.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cedc010.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/cedc010.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAI9G,eAAO,MAAM,OAAO,EAAE,cA6DrB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CEDC011: every `when`/`unless` condition expression must parse
|
|
3
|
+
*
|
|
4
|
+
* A policy's guard is the part that does the work — `when { context.mfa }`,
|
|
5
|
+
* `unless { resource.public }` — and until schema-driven codegen (#1650) makes
|
|
6
|
+
* those typed trees, the authored model carries them as Cedar expression
|
|
7
|
+
* *source*. Source that does not parse turns into a policy no evaluator will
|
|
8
|
+
* load, and the failure surfaces a long way from the typo: the whole policy set
|
|
9
|
+
* is rejected, naming a byte offset in a generated file.
|
|
10
|
+
*
|
|
11
|
+
* So the clause is parsed on its own and reported on its own, with the
|
|
12
|
+
* expression text and Cedar's own message (which carries a "did you mean"
|
|
13
|
+
* suggestion often enough to be worth passing through).
|
|
14
|
+
*/
|
|
15
|
+
import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
|
|
16
|
+
export declare const cedc011: PostSynthCheck;
|
|
17
|
+
//# sourceMappingURL=cedc011.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cedc011.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/cedc011.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAI9G,eAAO,MAAM,OAAO,EAAE,cA4BrB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CEDC012: no two policies may claim the same id
|
|
3
|
+
*
|
|
4
|
+
* A Cedar policy id is the handle everything downstream uses: the validator
|
|
5
|
+
* reports against it, AVP's `CreatePolicy` stores it, a drift check diffs on
|
|
6
|
+
* it. chant derives one from the logical name (`allowAdminRead` →
|
|
7
|
+
* `allow-admin-read`) unless the author sets `annotations.id` explicitly, and
|
|
8
|
+
* two policies can land on the same string either way — a rename that
|
|
9
|
+
* kebab-cases to something already taken, or the same explicit `@id` pasted
|
|
10
|
+
* twice.
|
|
11
|
+
*
|
|
12
|
+
* The consequence is silent. The `.cedar` text gets two policies carrying
|
|
13
|
+
* `@id("same")`, while the JSON envelope is keyed by id and keeps only the last
|
|
14
|
+
* one — a policy that exists in the artifact a human reviews and not in the one
|
|
15
|
+
* a machine loads. Ids are collected from every policy set in the build, from
|
|
16
|
+
* both the envelope key and the `@id` annotation, so a collision is caught
|
|
17
|
+
* whichever of the two forms it takes.
|
|
18
|
+
*/
|
|
19
|
+
import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
|
|
20
|
+
export declare const cedc012: PostSynthCheck;
|
|
21
|
+
//# sourceMappingURL=cedc012.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cedc012.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/cedc012.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAU9G,eAAO,MAAM,OAAO,EAAE,cAmCrB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CEDC013: annotation hygiene on an emitted policy
|
|
3
|
+
*
|
|
4
|
+
* Annotations are Cedar's only metadata channel — no comments survive the JSON
|
|
5
|
+
* grammar, and `policyToText` drops them — so `@id`, `@doc`, and friends are
|
|
6
|
+
* the whole audit trail a policy carries into AVP or a review. Three things
|
|
7
|
+
* make that trail useless:
|
|
8
|
+
*
|
|
9
|
+
* - an `@id` annotation that disagrees with the key the policy is filed under,
|
|
10
|
+
* so the text artifact and the JSON artifact name the same policy differently;
|
|
11
|
+
* - an annotation whose value is empty, which reads as documented and is not;
|
|
12
|
+
* - an annotation whose value is not a string, which Cedar's `Annotations`
|
|
13
|
+
* (`Record<string, string>`) does not admit.
|
|
14
|
+
*
|
|
15
|
+
* A *missing* `@id` is not a finding: chant derives one from the logical name,
|
|
16
|
+
* which is the normal case and the one the serializer is built around.
|
|
17
|
+
*/
|
|
18
|
+
import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
|
|
19
|
+
export declare const cedc013: PostSynthCheck;
|
|
20
|
+
//# sourceMappingURL=cedc013.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cedc013.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/cedc013.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cA+CrB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CEDC014: a scope constraint's entity reference must be a real entity UID
|
|
3
|
+
*
|
|
4
|
+
* Cedar names an entity as `Namespace::Type::"id"` — a type path and a quoted
|
|
5
|
+
* id. chant's serializer splits an authored reference on that grammar, and a
|
|
6
|
+
* reference that does not match it degrades rather than fails: the whole string
|
|
7
|
+
* becomes the type and the id becomes empty. `principal: { eq: "alice" }`
|
|
8
|
+
* therefore emits `{"op":"==","entity":{"type":"alice","id":""}}` — a policy
|
|
9
|
+
* that parses, validates against a schema that happens to define no such type
|
|
10
|
+
* only as an "unrecognized entity type", and silently matches nothing at
|
|
11
|
+
* runtime if it ever does.
|
|
12
|
+
*
|
|
13
|
+
* An empty entity id is the fingerprint of that degradation, and there is no
|
|
14
|
+
* legitimate reason to author one, so it is flagged wherever it appears in a
|
|
15
|
+
* scope: `== E`, `in E`, `in [E, …]`, and the `in` of an `is T in E`.
|
|
16
|
+
*/
|
|
17
|
+
import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
|
|
18
|
+
export declare const cedc014: PostSynthCheck;
|
|
19
|
+
//# sourceMappingURL=cedc014.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cedc014.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/cedc014.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAiB9G,eAAO,MAAM,OAAO,EAAE,cAuCrB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CEDE010: every emitted policy set validates clean against its schema
|
|
3
|
+
*
|
|
4
|
+
* The epic's "native tool is the test" clause: not "the text is well formed"
|
|
5
|
+
* but "Cedar's own validator, run in-process against the project's schema, has
|
|
6
|
+
* nothing to say about it." This is what catches the second meta-policy wall —
|
|
7
|
+
* a policy naming an entity type or an action the schema does not define — and
|
|
8
|
+
* it catches it everywhere, in every environment, because such a policy can
|
|
9
|
+
* never grant anything.
|
|
10
|
+
*
|
|
11
|
+
* Two things about `validate()` decide how this is written, both measured
|
|
12
|
+
* against 4.12.0 (chant #1648):
|
|
13
|
+
*
|
|
14
|
+
* - `type: "success"` means validation *ran*, not that it passed. The findings
|
|
15
|
+
* are in `validationErrors`, and a check written as `if (answer.type ===
|
|
16
|
+
* "failure")` passes every type error in the corpus. `validatePolicySet`
|
|
17
|
+
* asserts `success && validationErrors.length === 0`.
|
|
18
|
+
* - `validationErrors` comes back in a different order almost every call — the
|
|
19
|
+
* validator parallelizes across policies and does not re-sort. Forty
|
|
20
|
+
* identical calls produced six orderings. `validatePolicySet` sorts by
|
|
21
|
+
* `policyId` then message, so this check's output is stable enough to assert
|
|
22
|
+
* on.
|
|
23
|
+
*
|
|
24
|
+
* When the build emits no schema there is nothing to validate against, and
|
|
25
|
+
* `validate()` cannot be called at all — it has no optional-schema mode, and an
|
|
26
|
+
* empty schema is legal Cedar that reports every policy as inapplicable, which
|
|
27
|
+
* would be worse than useless. Schema-driven codegen is #1650; until a schema
|
|
28
|
+
* is emitted beside the policies, this check says so once, as an advisory,
|
|
29
|
+
* rather than passing silently and claiming a guarantee it did not check.
|
|
30
|
+
* CEDC010's parse gate still applies in that state.
|
|
31
|
+
*/
|
|
32
|
+
import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
|
|
33
|
+
export declare const cede010: PostSynthCheck;
|
|
34
|
+
//# sourceMappingURL=cede010.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cede010.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/cede010.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAI9G,eAAO,MAAM,OAAO,EAAE,cAqDrB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CEDE011: surface the Cedar validator's warnings
|
|
3
|
+
*
|
|
4
|
+
* `validate()` returns two arrays, and the second one is the interesting one
|
|
5
|
+
* for a policy nobody has noticed is dead. The validator's warnings are the
|
|
6
|
+
* findings that do not make the set invalid but do mean it is not doing what it
|
|
7
|
+
* says: "policy is impossible: the policy expression evaluates to false for all
|
|
8
|
+
* valid requests" is the one that matters most — a guard whose attribute
|
|
9
|
+
* comparison can never hold, so the grant it wraps never fires and the access
|
|
10
|
+
* it was written to give quietly does not exist.
|
|
11
|
+
*
|
|
12
|
+
* Split from CEDE010 rather than folded into it because the two mean different
|
|
13
|
+
* things: an error is a policy no evaluator will accept, a warning is a policy
|
|
14
|
+
* that will be accepted and will not work. They deserve different severities
|
|
15
|
+
* and, in a report, different lines.
|
|
16
|
+
*
|
|
17
|
+
* Same two traps as CEDE010 — findings live under `type: "success"`, and their
|
|
18
|
+
* order is not stable, so `validatePolicySet` sorts before returning.
|
|
19
|
+
*/
|
|
20
|
+
import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
|
|
21
|
+
export declare const cede011: PostSynthCheck;
|
|
22
|
+
//# sourceMappingURL=cede011.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cede011.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/cede011.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAI9G,eAAO,MAAM,OAAO,EAAE,cAkCrB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CEDS010: a bare `permit(principal, action, resource);` is a standing grant
|
|
3
|
+
*
|
|
4
|
+
* The one policy that permits everything to everyone on everything. It is
|
|
5
|
+
* valid Cedar, it is what a scaffolded policy looks like before anyone has
|
|
6
|
+
* written the real one, and the Cedar validator says nothing about it — checked
|
|
7
|
+
* directly against 4.12.0 (chant #1648): a schema-clean run over exactly this
|
|
8
|
+
* policy returns zero errors, zero warnings, zero other warnings. There is no
|
|
9
|
+
* upstream tool that will catch it, which is why the epic names this wall as a
|
|
10
|
+
* definition-of-done item and why it lives here.
|
|
11
|
+
*
|
|
12
|
+
* The shape is unambiguous in the JSON: all three scopes unconstrained
|
|
13
|
+
* (`op: "All"`) and no `when`/`unless` clause to narrow it. Anything with even
|
|
14
|
+
* one constraint or one guard is somebody's deliberate decision and is not this
|
|
15
|
+
* check's business (an unconstrained *action* alone is CEDS012).
|
|
16
|
+
*
|
|
17
|
+
* Severity is env-gated on the same `ctx.env` seam the k8s org-policy example
|
|
18
|
+
* and the aws tier checks use: a production build fails, everything else warns,
|
|
19
|
+
* so the scaffold-and-iterate loop stays workable while the thing that ships
|
|
20
|
+
* cannot carry it.
|
|
21
|
+
*/
|
|
22
|
+
import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
|
|
23
|
+
export declare const ceds010: PostSynthCheck;
|
|
24
|
+
//# sourceMappingURL=ceds010.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ceds010.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/ceds010.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAgCrB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CEDS011: a policy set with no `forbid` has no floor
|
|
3
|
+
*
|
|
4
|
+
* Cedar's evaluation order is fixed and is the reason `forbid` exists: a
|
|
5
|
+
* `forbid` that matches beats every `permit`, no matter how the permits are
|
|
6
|
+
* written or in what order. That makes a `forbid` the only construct in the
|
|
7
|
+
* language that states an invariant — "never outside the corporate network",
|
|
8
|
+
* "never on a resource marked frozen" — which no later grant can widen.
|
|
9
|
+
*
|
|
10
|
+
* A set built only from permits has none. Every future policy is additive, and
|
|
11
|
+
* the blast radius of a careless one is bounded by nothing. This is a
|
|
12
|
+
* convention rather than a bug, so it warns; the fix is one `forbid` carrying
|
|
13
|
+
* whatever the set's real invariant is.
|
|
14
|
+
*
|
|
15
|
+
* Reported once per policy set, not once per permit.
|
|
16
|
+
*/
|
|
17
|
+
import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
|
|
18
|
+
export declare const ceds011: PostSynthCheck;
|
|
19
|
+
//# sourceMappingURL=ceds011.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ceds011.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/ceds011.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAsBrB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CEDS012: a `permit` over every action is IAM's `"Action": "*"`
|
|
3
|
+
*
|
|
4
|
+
* A permit that names a principal or a resource but leaves `action`
|
|
5
|
+
* unconstrained grants every action Cedar's schema defines on that target —
|
|
6
|
+
* including the ones added next quarter, which is what makes it different from
|
|
7
|
+
* a wide-but-enumerated grant. The author almost always meant a specific verb
|
|
8
|
+
* or a group (`action in [Action::"read", Action::"list"]`).
|
|
9
|
+
*
|
|
10
|
+
* Scoped deliberately narrow so it does not double-report: a policy with *no*
|
|
11
|
+
* constraint anywhere and no guard is a bare permit, which is CEDS010's
|
|
12
|
+
* finding and a more serious one. This check speaks only to a policy that
|
|
13
|
+
* constrained something and then left the verb open.
|
|
14
|
+
*/
|
|
15
|
+
import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
|
|
16
|
+
export declare const ceds012: PostSynthCheck;
|
|
17
|
+
//# sourceMappingURL=ceds012.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ceds012.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/ceds012.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,OAAO,EAAE,cAgCrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAYvE,eAAO,MAAM,eAAe,EAAE,cAAc,EAW3C,CAAC"}
|