resuxjs 0.3.11 → 0.4.0-beta.3
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 +23 -1
- package/dist/bin.d.ts +1 -2
- package/dist/bin.js +5 -0
- package/dist/bin.js.map +1 -1
- package/dist/build/index.d.ts +29 -0
- package/dist/build/index.js +51 -0
- package/dist/build/index.js.map +1 -0
- package/dist/cli.d.ts +19 -8
- package/dist/cli.js +2653 -3688
- package/dist/cli.js.map +1 -1
- package/dist/compiler/adapter.d.ts +19 -15
- package/dist/compiler/adapter.js +69 -93
- package/dist/compiler/adapter.js.map +1 -1
- package/dist/compiler/dev-warnings.d.ts +14 -10
- package/dist/compiler/dev-warnings.js +247 -319
- package/dist/compiler/dev-warnings.js.map +1 -1
- package/dist/compiler/directives.d.ts +7 -3
- package/dist/compiler/directives.js +125 -150
- package/dist/compiler/directives.js.map +1 -1
- package/dist/compiler/implementation.d.ts +117 -112
- package/dist/compiler/implementation.js +2954 -3426
- package/dist/compiler/index.d.ts +19 -15
- package/dist/compiler/index.js +69 -93
- package/dist/compiler/index.js.map +1 -1
- package/dist/core/config.d.ts +19 -10
- package/dist/core/config.js +42 -25
- package/dist/core/config.js.map +1 -1
- package/dist/core/hooks.d.ts +133 -131
- package/dist/core/hooks.js +45 -55
- package/dist/core/hooks.js.map +1 -1
- package/dist/core/index.d.ts +5 -4
- package/dist/core/index.js +6 -5
- package/dist/core/module-container.d.ts +97 -93
- package/dist/core/module-container.js +180 -185
- package/dist/core/module-container.js.map +1 -1
- package/dist/core/resux.d.ts +20 -15
- package/dist/core/resux.js +18 -13
- package/dist/core/resux.js.map +1 -1
- package/dist/create-bin.d.ts +1 -2
- package/dist/create-bin.js +5 -0
- package/dist/create-bin.js.map +1 -1
- package/dist/create.d.ts +6 -2
- package/dist/create.js +496 -638
- package/dist/create.js.map +1 -1
- package/dist/deploy/cloudflare.d.ts +7 -2
- package/dist/deploy/cloudflare.js +31 -34
- package/dist/deploy/cloudflare.js.map +1 -1
- package/dist/deploy/common.d.ts +19 -15
- package/dist/deploy/common.js +119 -188
- package/dist/deploy/common.js.map +1 -1
- package/dist/deploy/framework-runtime.d.ts +5 -1
- package/dist/deploy/framework-runtime.js +44 -48
- package/dist/deploy/framework-runtime.js.map +1 -1
- package/dist/deploy/index.d.ts +8 -3
- package/dist/deploy/index.js +56 -80
- package/dist/deploy/index.js.map +1 -1
- package/dist/deploy/netlify.d.ts +7 -2
- package/dist/deploy/netlify.js +41 -41
- package/dist/deploy/netlify.js.map +1 -1
- package/dist/deploy/node.d.ts +7 -2
- package/dist/deploy/node.js +24 -19
- package/dist/deploy/node.js.map +1 -1
- package/dist/deploy/production-report.d.ts +5 -1
- package/dist/deploy/production-report.js +15 -14
- package/dist/deploy/production-report.js.map +1 -1
- package/dist/deploy/runtime-dependencies.d.ts +8 -4
- package/dist/deploy/runtime-dependencies.js +158 -220
- package/dist/deploy/runtime-dependencies.js.map +1 -1
- package/dist/deploy/static.d.ts +7 -2
- package/dist/deploy/static.js +17 -14
- package/dist/deploy/static.js.map +1 -1
- package/dist/deploy/types.d.ts +33 -29
- package/dist/deploy/types.js +1 -2
- package/dist/deploy/vercel.d.ts +8 -3
- package/dist/deploy/vercel.js +138 -188
- package/dist/deploy/vercel.js.map +1 -1
- package/dist/fonts/index.d.ts +19 -14
- package/dist/fonts/index.js +115 -134
- package/dist/fonts/index.js.map +1 -1
- package/dist/globals.d.ts +79 -78
- package/dist/globals.js +1 -2
- package/dist/halal-core/ai/classifyProject.d.ts +9 -4
- package/dist/halal-core/ai/classifyProject.js +82 -95
- package/dist/halal-core/ai/classifyProject.js.map +1 -1
- package/dist/halal-core/ai/classifyRuntimeContent.d.ts +8 -3
- package/dist/halal-core/ai/classifyRuntimeContent.js +78 -95
- package/dist/halal-core/ai/classifyRuntimeContent.js.map +1 -1
- package/dist/halal-core/ai/createProjectSummary.d.ts +40 -36
- package/dist/halal-core/ai/createProjectSummary.js +39 -39
- package/dist/halal-core/ai/createProjectSummary.js.map +1 -1
- package/dist/halal-core/ai/halalClassifierPrompt.d.ts +5 -1
- package/dist/halal-core/ai/halalClassifierPrompt.js +5 -1
- package/dist/halal-core/ai/halalClassifierPrompt.js.map +1 -1
- package/dist/halal-core/ai/redactSensitiveData.d.ts +5 -1
- package/dist/halal-core/ai/redactSensitiveData.js +82 -110
- package/dist/halal-core/ai/redactSensitiveData.js.map +1 -1
- package/dist/halal-core/ai/validateAiResponse.d.ts +7 -2
- package/dist/halal-core/ai/validateAiResponse.js +56 -83
- package/dist/halal-core/ai/validateAiResponse.js.map +1 -1
- package/dist/halal-core/cli/check.d.ts +5 -1
- package/dist/halal-core/cli/check.js +28 -30
- package/dist/halal-core/cli/check.js.map +1 -1
- package/dist/halal-core/cli/explain.d.ts +5 -1
- package/dist/halal-core/cli/explain.js +27 -31
- package/dist/halal-core/cli/explain.js.map +1 -1
- package/dist/halal-core/cli/report.d.ts +5 -1
- package/dist/halal-core/cli/report.js +14 -10
- package/dist/halal-core/cli/report.js.map +1 -1
- package/dist/halal-core/cli/submitReview.d.ts +5 -1
- package/dist/halal-core/cli/submitReview.js +13 -9
- package/dist/halal-core/cli/submitReview.js.map +1 -1
- package/dist/halal-core/cli/verifyReview.d.ts +5 -1
- package/dist/halal-core/cli/verifyReview.js +17 -15
- package/dist/halal-core/cli/verifyReview.js.map +1 -1
- package/dist/halal-core/config.d.ts +39 -35
- package/dist/halal-core/config.js +77 -118
- package/dist/halal-core/config.js.map +1 -1
- package/dist/halal-core/crypto/integrity.d.ts +12 -8
- package/dist/halal-core/crypto/integrity.js +65 -87
- package/dist/halal-core/crypto/integrity.js.map +1 -1
- package/dist/halal-core/enforce.d.ts +9 -5
- package/dist/halal-core/enforce.js +90 -105
- package/dist/halal-core/enforce.js.map +1 -1
- package/dist/halal-core/index.d.ts +20 -16
- package/dist/halal-core/index.js +19 -19
- package/dist/halal-core/lifecycle.d.ts +5 -1
- package/dist/halal-core/lifecycle.js +16 -13
- package/dist/halal-core/lifecycle.js.map +1 -1
- package/dist/halal-core/policy.d.ts +7 -2
- package/dist/halal-core/policy.js +7 -2
- package/dist/halal-core/policy.js.map +1 -1
- package/dist/halal-core/report/formatBrowserOverlay.d.ts +7 -2
- package/dist/halal-core/report/formatBrowserOverlay.js +10 -8
- package/dist/halal-core/report/formatBrowserOverlay.js.map +1 -1
- package/dist/halal-core/report/formatTerminalReport.d.ts +7 -2
- package/dist/halal-core/report/formatTerminalReport.js +27 -37
- package/dist/halal-core/report/formatTerminalReport.js.map +1 -1
- package/dist/halal-core/report/generateHalalReport.d.ts +11 -6
- package/dist/halal-core/report/generateHalalReport.js +25 -27
- package/dist/halal-core/report/generateHalalReport.js.map +1 -1
- package/dist/halal-core/report/signReport.d.ts +8 -3
- package/dist/halal-core/report/signReport.js +17 -12
- package/dist/halal-core/report/signReport.js.map +1 -1
- package/dist/halal-core/report/verifyReport.d.ts +14 -9
- package/dist/halal-core/report/verifyReport.js +52 -41
- package/dist/halal-core/report/verifyReport.js.map +1 -1
- package/dist/halal-core/review/createReviewRequest.d.ts +7 -2
- package/dist/halal-core/review/createReviewRequest.js +21 -17
- package/dist/halal-core/review/createReviewRequest.js.map +1 -1
- package/dist/halal-core/review/reviewPolicy.d.ts +7 -3
- package/dist/halal-core/review/reviewPolicy.js +19 -17
- package/dist/halal-core/review/reviewPolicy.js.map +1 -1
- package/dist/halal-core/review/signedReviewFile.d.ts +17 -12
- package/dist/halal-core/review/signedReviewFile.js +25 -22
- package/dist/halal-core/review/signedReviewFile.js.map +1 -1
- package/dist/halal-core/review/verifyReviewApproval.d.ts +12 -8
- package/dist/halal-core/review/verifyReviewApproval.js +69 -62
- package/dist/halal-core/review/verifyReviewApproval.js.map +1 -1
- package/dist/halal-core/rules/adultContentRules.d.ts +6 -2
- package/dist/halal-core/rules/adultContentRules.js +23 -23
- package/dist/halal-core/rules/adultContentRules.js.map +1 -1
- package/dist/halal-core/rules/alcoholDrugVapeRules.d.ts +6 -2
- package/dist/halal-core/rules/alcoholDrugVapeRules.js +22 -22
- package/dist/halal-core/rules/alcoholDrugVapeRules.js.map +1 -1
- package/dist/halal-core/rules/childSafetyRules.d.ts +6 -2
- package/dist/halal-core/rules/childSafetyRules.js +19 -19
- package/dist/halal-core/rules/childSafetyRules.js.map +1 -1
- package/dist/halal-core/rules/coreCategories.d.ts +10 -6
- package/dist/halal-core/rules/coreCategories.js +237 -110
- package/dist/halal-core/rules/coreCategories.js.map +1 -1
- package/dist/halal-core/rules/cyberAbuseRules.d.ts +6 -2
- package/dist/halal-core/rules/cyberAbuseRules.js +27 -27
- package/dist/halal-core/rules/cyberAbuseRules.js.map +1 -1
- package/dist/halal-core/rules/defaultBlockedRules.d.ts +24 -19
- package/dist/halal-core/rules/defaultBlockedRules.js +156 -199
- package/dist/halal-core/rules/defaultBlockedRules.js.map +1 -1
- package/dist/halal-core/rules/dependencyRules.d.ts +11 -7
- package/dist/halal-core/rules/dependencyRules.js +50 -56
- package/dist/halal-core/rules/dependencyRules.js.map +1 -1
- package/dist/halal-core/rules/endpointRules.d.ts +9 -5
- package/dist/halal-core/rules/endpointRules.js +21 -23
- package/dist/halal-core/rules/endpointRules.js.map +1 -1
- package/dist/halal-core/rules/environmentalHarmRules.d.ts +6 -2
- package/dist/halal-core/rules/environmentalHarmRules.js +17 -17
- package/dist/halal-core/rules/environmentalHarmRules.js.map +1 -1
- package/dist/halal-core/rules/financeRibaRules.d.ts +6 -2
- package/dist/halal-core/rules/financeRibaRules.js +20 -20
- package/dist/halal-core/rules/financeRibaRules.js.map +1 -1
- package/dist/halal-core/rules/gamblingRules.d.ts +6 -2
- package/dist/halal-core/rules/gamblingRules.js +22 -22
- package/dist/halal-core/rules/gamblingRules.js.map +1 -1
- package/dist/halal-core/rules/generalHarmRules.d.ts +6 -2
- package/dist/halal-core/rules/generalHarmRules.js +15 -15
- package/dist/halal-core/rules/generalHarmRules.js.map +1 -1
- package/dist/halal-core/rules/healthHarmRules.d.ts +6 -2
- package/dist/halal-core/rules/healthHarmRules.js +19 -19
- package/dist/halal-core/rules/healthHarmRules.js.map +1 -1
- package/dist/halal-core/rules/keywordRules.d.ts +13 -9
- package/dist/halal-core/rules/keywordRules.js +90 -39
- package/dist/halal-core/rules/keywordRules.js.map +1 -1
- package/dist/halal-core/rules/privacyAbuseRules.d.ts +6 -2
- package/dist/halal-core/rules/privacyAbuseRules.js +21 -21
- package/dist/halal-core/rules/privacyAbuseRules.js.map +1 -1
- package/dist/halal-core/rules/scamFraudRules.d.ts +6 -2
- package/dist/halal-core/rules/scamFraudRules.js +29 -29
- package/dist/halal-core/rules/scamFraudRules.js.map +1 -1
- package/dist/halal-core/rules/selfHarmRules.d.ts +6 -2
- package/dist/halal-core/rules/selfHarmRules.js +17 -17
- package/dist/halal-core/rules/selfHarmRules.js.map +1 -1
- package/dist/halal-core/rules/violenceExtremismRules.d.ts +6 -2
- package/dist/halal-core/rules/violenceExtremismRules.js +30 -30
- package/dist/halal-core/rules/violenceExtremismRules.js.map +1 -1
- package/dist/halal-core/runtime/guard.d.ts +22 -17
- package/dist/halal-core/runtime/guard.js +163 -183
- package/dist/halal-core/runtime/guard.js.map +1 -1
- package/dist/halal-core/runtime/index.d.ts +5 -4
- package/dist/halal-core/runtime/index.js +5 -5
- package/dist/halal-core/runtime/reviewedMemory.d.ts +10 -5
- package/dist/halal-core/runtime/reviewedMemory.js +75 -110
- package/dist/halal-core/runtime/reviewedMemory.js.map +1 -1
- package/dist/halal-core/runtime/serializeRuntimeContent.d.ts +17 -12
- package/dist/halal-core/runtime/serializeRuntimeContent.js +133 -156
- package/dist/halal-core/runtime/serializeRuntimeContent.js.map +1 -1
- package/dist/halal-core/runtime/types.d.ts +55 -50
- package/dist/halal-core/runtime/types.js +1 -2
- package/dist/halal-core/scanner/scanApiRoutes.d.ts +5 -1
- package/dist/halal-core/scanner/scanApiRoutes.js +33 -36
- package/dist/halal-core/scanner/scanApiRoutes.js.map +1 -1
- package/dist/halal-core/scanner/scanComponents.d.ts +5 -1
- package/dist/halal-core/scanner/scanComponents.js +13 -13
- package/dist/halal-core/scanner/scanComponents.js.map +1 -1
- package/dist/halal-core/scanner/scanContent.d.ts +8 -4
- package/dist/halal-core/scanner/scanContent.js +192 -261
- package/dist/halal-core/scanner/scanContent.js.map +1 -1
- package/dist/halal-core/scanner/scanDependencies.d.ts +5 -1
- package/dist/halal-core/scanner/scanDependencies.js +17 -15
- package/dist/halal-core/scanner/scanDependencies.js.map +1 -1
- package/dist/halal-core/scanner/scanDomains.d.ts +7 -3
- package/dist/halal-core/scanner/scanDomains.js +12 -12
- package/dist/halal-core/scanner/scanDomains.js.map +1 -1
- package/dist/halal-core/scanner/scanEnvNames.d.ts +5 -1
- package/dist/halal-core/scanner/scanEnvNames.js +24 -26
- package/dist/halal-core/scanner/scanEnvNames.js.map +1 -1
- package/dist/halal-core/scanner/scanMetadata.d.ts +9 -5
- package/dist/halal-core/scanner/scanMetadata.js +21 -29
- package/dist/halal-core/scanner/scanMetadata.js.map +1 -1
- package/dist/halal-core/scanner/scanPages.d.ts +5 -1
- package/dist/halal-core/scanner/scanPages.js +13 -15
- package/dist/halal-core/scanner/scanPages.js.map +1 -1
- package/dist/halal-core/scanner/scanProject.d.ts +19 -12
- package/dist/halal-core/scanner/scanProject.js +44 -49
- package/dist/halal-core/scanner/scanProject.js.map +1 -1
- package/dist/halal-core/scanner/scanRoutes.d.ts +5 -1
- package/dist/halal-core/scanner/scanRoutes.js +33 -39
- package/dist/halal-core/scanner/scanRoutes.js.map +1 -1
- package/dist/halal-core/scanner/scanTranslations.d.ts +5 -1
- package/dist/halal-core/scanner/scanTranslations.js +22 -29
- package/dist/halal-core/scanner/scanTranslations.js.map +1 -1
- package/dist/halal-core/status.d.ts +17 -13
- package/dist/halal-core/status.js +1 -2
- package/dist/halal-core/tamper/verifyCoreIntegrity.d.ts +5 -1
- package/dist/halal-core/tamper/verifyCoreIntegrity.js +27 -24
- package/dist/halal-core/tamper/verifyCoreIntegrity.js.map +1 -1
- package/dist/halal-core/tamper/verifyLifecycleHooks.d.ts +5 -1
- package/dist/halal-core/tamper/verifyLifecycleHooks.js +13 -12
- package/dist/halal-core/tamper/verifyLifecycleHooks.js.map +1 -1
- package/dist/halal-core/tamper/verifyReportSignature.d.ts +9 -4
- package/dist/halal-core/tamper/verifyReportSignature.js +20 -14
- package/dist/halal-core/tamper/verifyReportSignature.js.map +1 -1
- package/dist/halal.d.ts +20 -1
- package/dist/halal.js +19 -2
- package/dist/i18n/index.d.ts +44 -40
- package/dist/i18n/index.js +218 -288
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/shared.d.ts +33 -29
- package/dist/i18n/shared.js +204 -266
- package/dist/i18n/shared.js.map +1 -1
- package/dist/icons/index.d.ts +160 -154
- package/dist/icons/index.js +323 -273
- package/dist/icons/index.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +8 -2
- package/dist/kit/index.d.ts +32 -27
- package/dist/kit/index.js +46 -43
- package/dist/kit/index.js.map +1 -1
- package/dist/nitro-server/index.d.ts +10 -6
- package/dist/nitro-server/index.js +6 -2
- package/dist/nitro-server/index.js.map +1 -1
- package/dist/node.d.ts +9 -4
- package/dist/node.js +89 -116
- package/dist/node.js.map +1 -1
- package/dist/reactivity/computed.d.ts +11 -6
- package/dist/reactivity/computed.js +46 -53
- package/dist/reactivity/computed.js.map +1 -1
- package/dist/reactivity/effect.d.ts +23 -18
- package/dist/reactivity/effect.js +105 -147
- package/dist/reactivity/effect.js.map +1 -1
- package/dist/reactivity/index.d.ts +8 -8
- package/dist/reactivity/index.js +8 -8
- package/dist/reactivity/reactive.d.ts +9 -5
- package/dist/reactivity/reactive.js +95 -134
- package/dist/reactivity/reactive.js.map +1 -1
- package/dist/reactivity/readonly.d.ts +2 -1
- package/dist/reactivity/readonly.js +3 -2
- package/dist/reactivity/ref.d.ts +23 -21
- package/dist/reactivity/ref.js +71 -81
- package/dist/reactivity/ref.js.map +1 -1
- package/dist/reactivity/scheduler.d.ts +8 -5
- package/dist/reactivity/scheduler.js +67 -69
- package/dist/reactivity/scheduler.js.map +1 -1
- package/dist/reactivity/types.d.ts +29 -25
- package/dist/reactivity/types.js +1 -2
- package/dist/reactivity/utils.d.ts +17 -13
- package/dist/reactivity/utils.js +25 -24
- package/dist/reactivity/utils.js.map +1 -1
- package/dist/reactivity/watch.d.ts +8 -4
- package/dist/reactivity/watch.js +74 -103
- package/dist/reactivity/watch.js.map +1 -1
- package/dist/runtime/core.d.ts +32 -0
- package/dist/runtime/core.js +155 -0
- package/dist/runtime/core.js.map +1 -0
- package/dist/runtime/index.d.ts +649 -622
- package/dist/runtime/index.js +4105 -5243
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/reactivity.d.ts +7 -0
- package/dist/runtime/reactivity.js +7 -0
- package/dist/runtime/resume.d.ts +80 -0
- package/dist/runtime/resume.js +482 -0
- package/dist/runtime/resume.js.map +1 -0
- package/dist/runtime/router.d.ts +21 -0
- package/dist/runtime/router.js +60 -0
- package/dist/runtime/router.js.map +1 -0
- package/dist/runtime/streaming.d.ts +25 -0
- package/dist/runtime/streaming.js +200 -0
- package/dist/runtime/streaming.js.map +1 -0
- package/dist/security/media-fetch.d.ts +33 -0
- package/dist/security/media-fetch.js +302 -0
- package/dist/security/media-fetch.js.map +1 -0
- package/dist/security/path-boundary.d.ts +8 -0
- package/dist/security/path-boundary.js +71 -0
- package/dist/security/path-boundary.js.map +1 -0
- package/dist/ui/index.d.ts +1774 -1768
- package/dist/ui/index.js +974 -674
- package/dist/ui/index.js.map +1 -1
- package/dist/vite-builder/index.d.ts +9 -5
- package/dist/vite-builder/index.js +6 -2
- package/dist/vite-builder/index.js.map +1 -1
- package/package.json +46 -86
- package/dist/compiler/implementation.js.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/deploy/types.js.map +0 -1
- package/dist/globals.js.map +0 -1
- package/dist/halal-core/index.js.map +0 -1
- package/dist/halal-core/runtime/index.js.map +0 -1
- package/dist/halal-core/runtime/types.js.map +0 -1
- package/dist/halal-core/status.js.map +0 -1
- package/dist/halal.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/reactivity/index.js.map +0 -1
- package/dist/reactivity/readonly.js.map +0 -1
- package/dist/reactivity/types.js.map +0 -1
|
@@ -1,28 +1,24 @@
|
|
|
1
|
-
import { existsSync, writeFileSync, mkdirSync } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
1
|
import { evaluateRules } from "../rules/defaultBlockedRules.js";
|
|
4
|
-
import { generateReportChecksum, generateReportSignature
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const mdPath = path.join(outDir, "halal-report.md");
|
|
25
|
-
const mdContent = `
|
|
2
|
+
import { generateReportChecksum, generateReportSignature } from "./signReport.js";
|
|
3
|
+
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
6
|
+
//#region src/halal-core/report/generateHalalReport.ts
|
|
7
|
+
function generateHalalReport(scannedData, policy, outDir, options = {}) {
|
|
8
|
+
const baseReport = evaluateRules(scannedData, policy);
|
|
9
|
+
const createdDate = (/* @__PURE__ */ new Date()).toISOString();
|
|
10
|
+
const reportToSign = {
|
|
11
|
+
...baseReport,
|
|
12
|
+
createdDate
|
|
13
|
+
};
|
|
14
|
+
const signature = options.requireAuthenticated === true ? generateReportSignature(reportToSign, options.signingSecret) : generateReportChecksum(reportToSign);
|
|
15
|
+
const finalReport = {
|
|
16
|
+
...reportToSign,
|
|
17
|
+
signature
|
|
18
|
+
};
|
|
19
|
+
if (!existsSync(outDir)) mkdirSync(outDir, { recursive: true });
|
|
20
|
+
writeFileSync(path.join(outDir, "halal-report.json"), JSON.stringify(finalReport, null, 2), "utf8");
|
|
21
|
+
writeFileSync(path.join(outDir, "halal-report.md"), `
|
|
26
22
|
# ResuxJS Halal Core Security Report
|
|
27
23
|
|
|
28
24
|
- **Generated At**: ${createdDate}
|
|
@@ -39,8 +35,10 @@ ${finalReport.reasons.map((reason) => `- ${reason}`).join("\n") || "No warning e
|
|
|
39
35
|
|
|
40
36
|
## Action Required
|
|
41
37
|
${finalReport.recommendedAction}
|
|
42
|
-
`.trim();
|
|
43
|
-
|
|
44
|
-
return finalReport;
|
|
38
|
+
`.trim(), "utf8");
|
|
39
|
+
return finalReport;
|
|
45
40
|
}
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
export { generateHalalReport };
|
|
46
44
|
//# sourceMappingURL=generateHalalReport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateHalalReport.js","
|
|
1
|
+
{"version":3,"file":"generateHalalReport.js","names":[],"sources":["../../../src/halal-core/report/generateHalalReport.ts"],"sourcesContent":["import { existsSync, writeFileSync, mkdirSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { evaluateRules } from \"../rules/defaultBlockedRules.js\";\nimport {\n generateReportChecksum,\n generateReportSignature,\n} from \"./signReport.js\";\nimport type { HalalCheckResult } from \"../status.js\";\nimport type { ResuxHalalPolicy } from \"../config.js\";\n\nexport interface GenerateHalalReportOptions {\n requireAuthenticated?: boolean;\n signingSecret?: string;\n}\n\nexport function generateHalalReport(\n scannedData: any,\n policy: ResuxHalalPolicy,\n outDir: string,\n options: GenerateHalalReportOptions = {},\n): HalalCheckResult {\n const baseReport = evaluateRules(scannedData, policy);\n\n const createdDate = new Date().toISOString();\n const reportToSign: Omit<HalalCheckResult, \"signature\"> = {\n ...baseReport,\n createdDate,\n };\n\n const signature = options.requireAuthenticated === true\n ? generateReportSignature(reportToSign, options.signingSecret)\n : generateReportChecksum(reportToSign);\n const finalReport: HalalCheckResult = {\n ...reportToSign,\n signature,\n };\n\n if (!existsSync(outDir)) {\n mkdirSync(outDir, { recursive: true });\n }\n\n const reportPath = path.join(outDir, \"halal-report.json\");\n writeFileSync(reportPath, JSON.stringify(finalReport, null, 2), \"utf8\");\n\n const mdPath = path.join(outDir, \"halal-report.md\");\n const mdContent = `\n# ResuxJS Halal Core Security Report\n\n- **Generated At**: ${createdDate}\n- **Framework Status**: **${finalReport.status.toUpperCase()}**\n- **Risk Level**: **${finalReport.riskLevel.toUpperCase()}**\n- **Confidence**: ${(finalReport.confidence * 100).toFixed(0)}%\n- **Signature**: \\`${signature}\\`\n\n## Categories Detected\n${finalReport.categories.map((category) => `- ${category}`).join(\"\\n\") || \"No policy categories violated.\"}\n\n## Reasons\n${finalReport.reasons.map((reason) => `- ${reason}`).join(\"\\n\") || \"No warning elements flagged.\"}\n\n## Action Required\n${finalReport.recommendedAction}\n `.trim();\n\n writeFileSync(mdPath, mdContent, \"utf8\");\n\n return finalReport;\n}\n"],"mappings":";;;;;;AAeA,SAAgB,oBACd,aACA,QACA,QACA,UAAsC,EAAE,EACtB;CAClB,MAAM,aAAa,cAAc,aAAa,OAAO;CAErD,MAAM,+BAAc,IAAI,MAAM,EAAC,aAAa;CAC5C,MAAM,eAAoD;EACxD,GAAG;EACH;EACD;CAED,MAAM,YAAY,QAAQ,yBAAyB,OAC/C,wBAAwB,cAAc,QAAQ,cAAc,GAC5D,uBAAuB,aAAa;CACxC,MAAM,cAAgC;EACpC,GAAG;EACH;EACD;AAED,KAAI,CAAC,WAAW,OAAO,CACrB,WAAU,QAAQ,EAAE,WAAW,MAAM,CAAC;AAIxC,eADmB,KAAK,KAAK,QAAQ,oBAAoB,EAC/B,KAAK,UAAU,aAAa,MAAM,EAAE,EAAE,OAAO;AAsBvE,eApBe,KAAK,KAAK,QAAQ,kBAAkB,EACjC;;;sBAGE,YAAY;4BACN,YAAY,OAAO,aAAa,CAAC;sBACvC,YAAY,UAAU,aAAa,CAAC;qBACrC,YAAY,aAAa,KAAK,QAAQ,EAAE,CAAC;qBACzC,UAAU;;;EAG7B,YAAY,WAAW,KAAK,aAAa,KAAK,WAAW,CAAC,KAAK,KAAK,IAAI,iCAAiC;;;EAGzG,YAAY,QAAQ,KAAK,WAAW,KAAK,SAAS,CAAC,KAAK,KAAK,IAAI,+BAA+B;;;EAGhG,YAAY,kBAAkB;IAC5B,MAAM,EAEyB,OAAO;AAExC,QAAO"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { HalalCheckResult } from "../status.js";
|
|
2
|
+
|
|
3
|
+
//#region src/halal-core/report/signReport.d.ts
|
|
4
|
+
declare function generateReportSignature(report: Omit<HalalCheckResult, "signature">, secret?: string): string;
|
|
5
|
+
declare function generateReportChecksum(report: Omit<HalalCheckResult, "signature">): string;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { generateReportChecksum, generateReportSignature };
|
|
8
|
+
//# sourceMappingURL=signReport.d.ts.map
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { createIntegritySignature } from "../crypto/integrity.js";
|
|
2
|
+
|
|
3
|
+
//#region src/halal-core/report/signReport.ts
|
|
2
4
|
const REPORT_SIGNING_ENV = "RESUX_HALAL_REPORT_SIGNING_SECRET";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
function generateReportSignature(report, secret) {
|
|
6
|
+
return createIntegritySignature(report, {
|
|
7
|
+
envName: REPORT_SIGNING_ENV,
|
|
8
|
+
secret,
|
|
9
|
+
requireSecret: true
|
|
10
|
+
});
|
|
9
11
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
function generateReportChecksum(report) {
|
|
13
|
+
return createIntegritySignature(report, {
|
|
14
|
+
envName: REPORT_SIGNING_ENV,
|
|
15
|
+
secret: "",
|
|
16
|
+
requireSecret: false
|
|
17
|
+
});
|
|
16
18
|
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { generateReportChecksum, generateReportSignature };
|
|
17
22
|
//# sourceMappingURL=signReport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signReport.js","
|
|
1
|
+
{"version":3,"file":"signReport.js","names":[],"sources":["../../../src/halal-core/report/signReport.ts"],"sourcesContent":["import type { HalalCheckResult } from \"../status.js\";\nimport { createIntegritySignature } from \"../crypto/integrity.js\";\n\nconst REPORT_SIGNING_ENV = \"RESUX_HALAL_REPORT_SIGNING_SECRET\";\n\nexport function generateReportSignature(\n report: Omit<HalalCheckResult, \"signature\">,\n secret?: string,\n): string {\n return createIntegritySignature(report, {\n envName: REPORT_SIGNING_ENV,\n secret,\n requireSecret: true,\n });\n}\n\nexport function generateReportChecksum(\n report: Omit<HalalCheckResult, \"signature\">,\n): string {\n return createIntegritySignature(report, {\n envName: REPORT_SIGNING_ENV,\n secret: \"\",\n requireSecret: false,\n });\n}\n"],"mappings":";;;AAGA,MAAM,qBAAqB;AAE3B,SAAgB,wBACd,QACA,QACQ;AACR,QAAO,yBAAyB,QAAQ;EACtC,SAAS;EACT;EACA,eAAe;EAChB,CAAC;;AAGJ,SAAgB,uBACd,QACQ;AACR,QAAO,yBAAyB,QAAQ;EACtC,SAAS;EACT,QAAQ;EACR,eAAe;EAChB,CAAC"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { HalalCheckResult } from "../status.js";
|
|
2
|
+
|
|
3
|
+
//#region src/halal-core/report/verifyReport.d.ts
|
|
4
|
+
interface ReportVerificationOptions {
|
|
5
|
+
secret?: string;
|
|
6
|
+
requireAuthenticated?: boolean;
|
|
7
|
+
now?: number;
|
|
6
8
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
declare function verifyReportSignature(report: HalalCheckResult, options?: ReportVerificationOptions): boolean;
|
|
10
|
+
declare function isReportValid(report: HalalCheckResult, options?: ReportVerificationOptions): {
|
|
11
|
+
valid: boolean;
|
|
12
|
+
reason?: string;
|
|
11
13
|
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { ReportVerificationOptions, isReportValid, verifyReportSignature };
|
|
16
|
+
//# sourceMappingURL=verifyReport.d.ts.map
|
|
@@ -1,45 +1,56 @@
|
|
|
1
|
-
import { isAuthenticatedIntegritySignature, verifyIntegritySignature
|
|
1
|
+
import { isAuthenticatedIntegritySignature, verifyIntegritySignature } from "../crypto/integrity.js";
|
|
2
|
+
|
|
3
|
+
//#region src/halal-core/report/verifyReport.ts
|
|
2
4
|
const REPORT_SIGNING_ENV = "RESUX_HALAL_REPORT_SIGNING_SECRET";
|
|
3
|
-
const REPORT_MAX_AGE_MS =
|
|
4
|
-
const MAX_CLOCK_SKEW_MS =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
requireSecret: options.requireAuthenticated === true,
|
|
14
|
-
});
|
|
5
|
+
const REPORT_MAX_AGE_MS = 720 * 60 * 60 * 1e3;
|
|
6
|
+
const MAX_CLOCK_SKEW_MS = 300 * 1e3;
|
|
7
|
+
function verifyReportSignature(report, options = {}) {
|
|
8
|
+
if (!report || typeof report !== "object" || !report.signature) return false;
|
|
9
|
+
const { signature, ...rest } = report;
|
|
10
|
+
return verifyIntegritySignature(rest, signature, {
|
|
11
|
+
envName: REPORT_SIGNING_ENV,
|
|
12
|
+
secret: options.secret,
|
|
13
|
+
requireSecret: options.requireAuthenticated === true
|
|
14
|
+
});
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
16
|
+
function isReportValid(report, options = {}) {
|
|
17
|
+
if (!report || typeof report !== "object") return {
|
|
18
|
+
valid: false,
|
|
19
|
+
reason: "No report provided."
|
|
20
|
+
};
|
|
21
|
+
if (!verifyReportSignature(report, options)) return {
|
|
22
|
+
valid: false,
|
|
23
|
+
reason: "Report integrity check is invalid or the report has been modified."
|
|
24
|
+
};
|
|
25
|
+
if (options.requireAuthenticated === true && !isAuthenticatedIntegritySignature(report.signature)) return {
|
|
26
|
+
valid: false,
|
|
27
|
+
reason: "Report requires an authenticated HMAC signature."
|
|
28
|
+
};
|
|
29
|
+
if (report.status === "blocked") return {
|
|
30
|
+
valid: false,
|
|
31
|
+
reason: `Project is blocked: ${report.reasons.join(", ")}`
|
|
32
|
+
};
|
|
33
|
+
if (typeof report.createdDate !== "string" || !report.createdDate.trim()) return {
|
|
34
|
+
valid: false,
|
|
35
|
+
reason: "Report creation date is missing."
|
|
36
|
+
};
|
|
37
|
+
const createdAt = Date.parse(report.createdDate);
|
|
38
|
+
if (!Number.isFinite(createdAt)) return {
|
|
39
|
+
valid: false,
|
|
40
|
+
reason: "Report creation date is invalid."
|
|
41
|
+
};
|
|
42
|
+
const now = options.now ?? Date.now();
|
|
43
|
+
if (createdAt > now + MAX_CLOCK_SKEW_MS) return {
|
|
44
|
+
valid: false,
|
|
45
|
+
reason: "Report creation date is unexpectedly in the future."
|
|
46
|
+
};
|
|
47
|
+
if (now - createdAt > REPORT_MAX_AGE_MS) return {
|
|
48
|
+
valid: false,
|
|
49
|
+
reason: "Report has expired (must be re-generated within 30 days)."
|
|
50
|
+
};
|
|
51
|
+
return { valid: true };
|
|
44
52
|
}
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
export { isReportValid, verifyReportSignature };
|
|
45
56
|
//# sourceMappingURL=verifyReport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyReport.js","
|
|
1
|
+
{"version":3,"file":"verifyReport.js","names":[],"sources":["../../../src/halal-core/report/verifyReport.ts"],"sourcesContent":["import type { HalalCheckResult } from \"../status.js\";\nimport {\n isAuthenticatedIntegritySignature,\n verifyIntegritySignature,\n} from \"../crypto/integrity.js\";\n\nconst REPORT_SIGNING_ENV = \"RESUX_HALAL_REPORT_SIGNING_SECRET\";\nconst REPORT_MAX_AGE_MS = 30 * 24 * 60 * 60 * 1000;\nconst MAX_CLOCK_SKEW_MS = 5 * 60 * 1000;\n\nexport interface ReportVerificationOptions {\n secret?: string;\n requireAuthenticated?: boolean;\n now?: number;\n}\n\nexport function verifyReportSignature(\n report: HalalCheckResult,\n options: ReportVerificationOptions = {},\n): boolean {\n if (!report || typeof report !== \"object\" || !report.signature) {\n return false;\n }\n\n const { signature, ...rest } = report;\n return verifyIntegritySignature(rest, signature, {\n envName: REPORT_SIGNING_ENV,\n secret: options.secret,\n requireSecret: options.requireAuthenticated === true,\n });\n}\n\nexport function isReportValid(\n report: HalalCheckResult,\n options: ReportVerificationOptions = {},\n): { valid: boolean; reason?: string } {\n if (!report || typeof report !== \"object\") {\n return { valid: false, reason: \"No report provided.\" };\n }\n\n if (!verifyReportSignature(report, options)) {\n return { valid: false, reason: \"Report integrity check is invalid or the report has been modified.\" };\n }\n\n if (options.requireAuthenticated === true && !isAuthenticatedIntegritySignature(report.signature)) {\n return { valid: false, reason: \"Report requires an authenticated HMAC signature.\" };\n }\n\n if (report.status === \"blocked\") {\n return { valid: false, reason: `Project is blocked: ${report.reasons.join(\", \")}` };\n }\n\n if (typeof report.createdDate !== \"string\" || !report.createdDate.trim()) {\n return { valid: false, reason: \"Report creation date is missing.\" };\n }\n\n const createdAt = Date.parse(report.createdDate);\n if (!Number.isFinite(createdAt)) {\n return { valid: false, reason: \"Report creation date is invalid.\" };\n }\n\n const now = options.now ?? Date.now();\n if (createdAt > now + MAX_CLOCK_SKEW_MS) {\n return { valid: false, reason: \"Report creation date is unexpectedly in the future.\" };\n }\n if (now - createdAt > REPORT_MAX_AGE_MS) {\n return { valid: false, reason: \"Report has expired (must be re-generated within 30 days).\" };\n }\n\n return { valid: true };\n}\n"],"mappings":";;;AAMA,MAAM,qBAAqB;AAC3B,MAAM,oBAAoB,MAAU,KAAK,KAAK;AAC9C,MAAM,oBAAoB,MAAS;AAQnC,SAAgB,sBACd,QACA,UAAqC,EAAE,EAC9B;AACT,KAAI,CAAC,UAAU,OAAO,WAAW,YAAY,CAAC,OAAO,UACnD,QAAO;CAGT,MAAM,EAAE,WAAW,GAAG,SAAS;AAC/B,QAAO,yBAAyB,MAAM,WAAW;EAC/C,SAAS;EACT,QAAQ,QAAQ;EAChB,eAAe,QAAQ,yBAAyB;EACjD,CAAC;;AAGJ,SAAgB,cACd,QACA,UAAqC,EAAE,EACF;AACrC,KAAI,CAAC,UAAU,OAAO,WAAW,SAC/B,QAAO;EAAE,OAAO;EAAO,QAAQ;EAAuB;AAGxD,KAAI,CAAC,sBAAsB,QAAQ,QAAQ,CACzC,QAAO;EAAE,OAAO;EAAO,QAAQ;EAAsE;AAGvG,KAAI,QAAQ,yBAAyB,QAAQ,CAAC,kCAAkC,OAAO,UAAU,CAC/F,QAAO;EAAE,OAAO;EAAO,QAAQ;EAAoD;AAGrF,KAAI,OAAO,WAAW,UACpB,QAAO;EAAE,OAAO;EAAO,QAAQ,uBAAuB,OAAO,QAAQ,KAAK,KAAK;EAAI;AAGrF,KAAI,OAAO,OAAO,gBAAgB,YAAY,CAAC,OAAO,YAAY,MAAM,CACtE,QAAO;EAAE,OAAO;EAAO,QAAQ;EAAoC;CAGrE,MAAM,YAAY,KAAK,MAAM,OAAO,YAAY;AAChD,KAAI,CAAC,OAAO,SAAS,UAAU,CAC7B,QAAO;EAAE,OAAO;EAAO,QAAQ;EAAoC;CAGrE,MAAM,MAAM,QAAQ,OAAO,KAAK,KAAK;AACrC,KAAI,YAAY,MAAM,kBACpB,QAAO;EAAE,OAAO;EAAO,QAAQ;EAAuD;AAExF,KAAI,MAAM,YAAY,kBACpB,QAAO;EAAE,OAAO;EAAO,QAAQ;EAA6D;AAG9F,QAAO,EAAE,OAAO,MAAM"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { ResuxHalalPolicy } from "../config.js";
|
|
2
|
+
|
|
3
|
+
//#region src/halal-core/review/createReviewRequest.d.ts
|
|
4
|
+
declare function createReviewRequest(appRoot: string, policy: ResuxHalalPolicy, outDir: string): string;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { createReviewRequest };
|
|
7
|
+
//# sourceMappingURL=createReviewRequest.d.ts.map
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import { writeFileSync } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
1
|
import { scanProject } from "../scanner/scanProject.js";
|
|
4
2
|
import { createProjectSummary } from "../ai/createProjectSummary.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
import { writeFileSync } from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
6
|
+
//#region src/halal-core/review/createReviewRequest.ts
|
|
7
|
+
function createReviewRequest(appRoot, policy, outDir) {
|
|
8
|
+
const summary = createProjectSummary(scanProject(appRoot));
|
|
9
|
+
const requestPayload = {
|
|
10
|
+
projectName: policy.projectName || summary.projectName,
|
|
11
|
+
projectType: policy.projectType || "unknown",
|
|
12
|
+
description: policy.description || summary.projectDescription,
|
|
13
|
+
reviewContact: policy.reviewContact || {},
|
|
14
|
+
evidence: policy.evidence || [],
|
|
15
|
+
projectSummary: summary,
|
|
16
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
17
|
+
};
|
|
18
|
+
const targetPath = path.join(outDir, "halal-review-request.json");
|
|
19
|
+
writeFileSync(targetPath, JSON.stringify(requestPayload, null, 2), "utf8");
|
|
20
|
+
return targetPath;
|
|
20
21
|
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { createReviewRequest };
|
|
21
25
|
//# sourceMappingURL=createReviewRequest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createReviewRequest.js","
|
|
1
|
+
{"version":3,"file":"createReviewRequest.js","names":[],"sources":["../../../src/halal-core/review/createReviewRequest.ts"],"sourcesContent":["import { writeFileSync, existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { scanProject } from \"../scanner/scanProject.js\";\nimport { createProjectSummary } from \"../ai/createProjectSummary.js\";\nimport type { ResuxHalalPolicy } from \"../config.js\";\n\nexport function createReviewRequest(\n appRoot: string,\n policy: ResuxHalalPolicy,\n outDir: string\n): string {\n const scanned = scanProject(appRoot);\n const summary = createProjectSummary(scanned);\n\n const requestPayload = {\n projectName: policy.projectName || summary.projectName,\n projectType: policy.projectType || \"unknown\",\n description: policy.description || summary.projectDescription,\n reviewContact: policy.reviewContact || {},\n evidence: policy.evidence || [],\n projectSummary: summary,\n timestamp: new Date().toISOString()\n };\n\n const targetPath = path.join(outDir, \"halal-review-request.json\");\n writeFileSync(targetPath, JSON.stringify(requestPayload, null, 2), \"utf8\");\n\n return targetPath;\n}\n"],"mappings":";;;;;;AAMA,SAAgB,oBACd,SACA,QACA,QACQ;CAER,MAAM,UAAU,qBADA,YAAY,QAAQ,CACS;CAE7C,MAAM,iBAAiB;EACrB,aAAa,OAAO,eAAe,QAAQ;EAC3C,aAAa,OAAO,eAAe;EACnC,aAAa,OAAO,eAAe,QAAQ;EAC3C,eAAe,OAAO,iBAAiB,EAAE;EACzC,UAAU,OAAO,YAAY,EAAE;EAC/B,gBAAgB;EAChB,4BAAW,IAAI,MAAM,EAAC,aAAa;EACpC;CAED,MAAM,aAAa,KAAK,KAAK,QAAQ,4BAA4B;AACjE,eAAc,YAAY,KAAK,UAAU,gBAAgB,MAAM,EAAE,EAAE,OAAO;AAE1E,QAAO"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region src/halal-core/review/reviewPolicy.d.ts
|
|
2
|
+
declare const REVIEWABLE_CATEGORIES: string[];
|
|
3
|
+
declare const NON_REVIEWABLE_CATEGORIES: string[];
|
|
4
|
+
declare function isCategoryReviewable(category: string): boolean;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { NON_REVIEWABLE_CATEGORIES, REVIEWABLE_CATEGORIES, isCategoryReviewable };
|
|
7
|
+
//# sourceMappingURL=reviewPolicy.d.ts.map
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
//#region src/halal-core/review/reviewPolicy.ts
|
|
2
|
+
const REVIEWABLE_CATEGORIES = [
|
|
3
|
+
"haram_business",
|
|
4
|
+
"privacy_abuse",
|
|
5
|
+
"financial_harm",
|
|
6
|
+
"health_safety_harm",
|
|
7
|
+
"environmental_harm",
|
|
8
|
+
"general_harm"
|
|
8
9
|
];
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const NON_REVIEWABLE_CATEGORIES = [
|
|
11
|
+
"illegal_criminal",
|
|
12
|
+
"cyber_abuse",
|
|
13
|
+
"sexual_harm",
|
|
14
|
+
"violence_harm"
|
|
14
15
|
];
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
return REVIEWABLE_CATEGORIES.includes(category);
|
|
16
|
+
function isCategoryReviewable(category) {
|
|
17
|
+
if (NON_REVIEWABLE_CATEGORIES.includes(category)) return false;
|
|
18
|
+
return REVIEWABLE_CATEGORIES.includes(category);
|
|
20
19
|
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { NON_REVIEWABLE_CATEGORIES, REVIEWABLE_CATEGORIES, isCategoryReviewable };
|
|
21
23
|
//# sourceMappingURL=reviewPolicy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reviewPolicy.js","
|
|
1
|
+
{"version":3,"file":"reviewPolicy.js","names":[],"sources":["../../../src/halal-core/review/reviewPolicy.ts"],"sourcesContent":["export const REVIEWABLE_CATEGORIES = [\n \"haram_business\",\n \"privacy_abuse\",\n \"financial_harm\",\n \"health_safety_harm\",\n \"environmental_harm\",\n \"general_harm\"\n];\n\nexport const NON_REVIEWABLE_CATEGORIES = [\n \"illegal_criminal\",\n \"cyber_abuse\",\n \"sexual_harm\",\n \"violence_harm\"\n];\n\nexport function isCategoryReviewable(category: string): boolean {\n if (NON_REVIEWABLE_CATEGORIES.includes(category)) {\n return false;\n }\n return REVIEWABLE_CATEGORIES.includes(category);\n}\n"],"mappings":";AAAA,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,4BAA4B;CACvC;CACA;CACA;CACA;CACD;AAED,SAAgB,qBAAqB,UAA2B;AAC9D,KAAI,0BAA0B,SAAS,SAAS,CAC9C,QAAO;AAET,QAAO,sBAAsB,SAAS,SAAS"}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { HalalCheckResult } from "../status.js";
|
|
2
|
+
|
|
3
|
+
//#region src/halal-core/review/signedReviewFile.d.ts
|
|
4
|
+
interface SignedReviewApproval {
|
|
5
|
+
projectName: string;
|
|
6
|
+
status: "allowed" | "review_required";
|
|
7
|
+
reasons: string;
|
|
8
|
+
reviewerId: string;
|
|
9
|
+
signature: string;
|
|
10
|
+
expires: string;
|
|
11
|
+
evidenceHash: string;
|
|
10
12
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
declare function generateReviewSignature(approval: Omit<SignedReviewApproval, "signature">, secret?: string): string;
|
|
14
|
+
declare function verifyReviewSignature(approval: SignedReviewApproval, secret?: string): boolean;
|
|
15
|
+
declare function createReviewEvidenceHash(report: HalalCheckResult | Omit<HalalCheckResult, "signature">): string;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { SignedReviewApproval, createReviewEvidenceHash, generateReviewSignature, verifyReviewSignature };
|
|
18
|
+
//# sourceMappingURL=signedReviewFile.d.ts.map
|
|
@@ -1,28 +1,31 @@
|
|
|
1
|
+
import { createIntegritySignature, stableSerialize, verifyIntegritySignature } from "../crypto/integrity.js";
|
|
1
2
|
import { createHash } from "node:crypto";
|
|
2
|
-
|
|
3
|
+
|
|
4
|
+
//#region src/halal-core/review/signedReviewFile.ts
|
|
3
5
|
const REVIEW_SIGNING_ENV = "RESUX_HALAL_REVIEW_SIGNING_SECRET";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
function generateReviewSignature(approval, secret) {
|
|
7
|
+
return createIntegritySignature(approval, {
|
|
8
|
+
envName: REVIEW_SIGNING_ENV,
|
|
9
|
+
secret,
|
|
10
|
+
requireSecret: true
|
|
11
|
+
});
|
|
10
12
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
requireSecret: true,
|
|
20
|
-
});
|
|
13
|
+
function verifyReviewSignature(approval, secret) {
|
|
14
|
+
if (!approval || typeof approval !== "object" || !approval.signature) return false;
|
|
15
|
+
const { signature, ...rest } = approval;
|
|
16
|
+
return verifyIntegritySignature(rest, signature, {
|
|
17
|
+
envName: REVIEW_SIGNING_ENV,
|
|
18
|
+
secret,
|
|
19
|
+
requireSecret: true
|
|
20
|
+
});
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
function createReviewEvidenceHash(report) {
|
|
23
|
+
const evidence = { ...report };
|
|
24
|
+
delete evidence.signature;
|
|
25
|
+
delete evidence.createdDate;
|
|
26
|
+
return `sha256:${createHash("sha256").update(stableSerialize(evidence)).digest("hex")}`;
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { createReviewEvidenceHash, generateReviewSignature, verifyReviewSignature };
|
|
28
31
|
//# sourceMappingURL=signedReviewFile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signedReviewFile.js","
|
|
1
|
+
{"version":3,"file":"signedReviewFile.js","names":[],"sources":["../../../src/halal-core/review/signedReviewFile.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport type { HalalCheckResult } from \"../status.js\";\nimport {\n createIntegritySignature,\n stableSerialize,\n verifyIntegritySignature,\n} from \"../crypto/integrity.js\";\n\nexport interface SignedReviewApproval {\n projectName: string;\n status: \"allowed\" | \"review_required\";\n reasons: string;\n reviewerId: string;\n signature: string;\n expires: string;\n evidenceHash: string;\n}\n\nconst REVIEW_SIGNING_ENV = \"RESUX_HALAL_REVIEW_SIGNING_SECRET\";\n\nexport function generateReviewSignature(\n approval: Omit<SignedReviewApproval, \"signature\">,\n secret?: string,\n): string {\n return createIntegritySignature(approval, {\n envName: REVIEW_SIGNING_ENV,\n secret,\n requireSecret: true,\n });\n}\n\nexport function verifyReviewSignature(\n approval: SignedReviewApproval,\n secret?: string,\n): boolean {\n if (!approval || typeof approval !== \"object\" || !approval.signature) {\n return false;\n }\n const { signature, ...rest } = approval;\n return verifyIntegritySignature(rest, signature, {\n envName: REVIEW_SIGNING_ENV,\n secret,\n requireSecret: true,\n });\n}\n\nexport function createReviewEvidenceHash(\n report: HalalCheckResult | Omit<HalalCheckResult, \"signature\">,\n): string {\n const evidence = { ...report } as Record<string, unknown>;\n delete evidence.signature;\n delete evidence.createdDate;\n return `sha256:${createHash(\"sha256\").update(stableSerialize(evidence)).digest(\"hex\")}`;\n}\n"],"mappings":";;;;AAkBA,MAAM,qBAAqB;AAE3B,SAAgB,wBACd,UACA,QACQ;AACR,QAAO,yBAAyB,UAAU;EACxC,SAAS;EACT;EACA,eAAe;EAChB,CAAC;;AAGJ,SAAgB,sBACd,UACA,QACS;AACT,KAAI,CAAC,YAAY,OAAO,aAAa,YAAY,CAAC,SAAS,UACzD,QAAO;CAET,MAAM,EAAE,WAAW,GAAG,SAAS;AAC/B,QAAO,yBAAyB,MAAM,WAAW;EAC/C,SAAS;EACT;EACA,eAAe;EAChB,CAAC;;AAGJ,SAAgB,yBACd,QACQ;CACR,MAAM,WAAW,EAAE,GAAG,QAAQ;AAC9B,QAAO,SAAS;AAChB,QAAO,SAAS;AAChB,QAAO,UAAU,WAAW,SAAS,CAAC,OAAO,gBAAgB,SAAS,CAAC,CAAC,OAAO,MAAM"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/halal-core/review/verifyReviewApproval.d.ts
|
|
2
|
+
interface ReviewApprovalVerificationOptions {
|
|
3
|
+
secret?: string;
|
|
4
|
+
projectName?: string;
|
|
5
|
+
evidenceHash?: string;
|
|
6
|
+
now?: number;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
declare function verifyReviewApproval(appRoot: string, currentStatus: string, options?: ReviewApprovalVerificationOptions): {
|
|
9
|
+
approved: boolean;
|
|
10
|
+
reason?: string;
|
|
10
11
|
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ReviewApprovalVerificationOptions, verifyReviewApproval };
|
|
14
|
+
//# sourceMappingURL=verifyReviewApproval.d.ts.map
|