@blamejs/core 0.18.39 → 0.18.40
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/CHANGELOG.md +100 -0
- package/NOTICE +2 -2
- package/README.md +1 -1
- package/lib/app.js +14 -5
- package/lib/file-upload.js +17 -3
- package/lib/gate-contract.js +159 -5
- package/lib/guard-filename.js +93 -18
- package/lib/guard-yaml.js +64 -0
- package/lib/mail-auth.js +473 -73
- package/lib/network-dns-resolver.js +23 -23
- package/lib/network-dns.js +205 -43
- package/lib/public-suffix.js +110 -24
- package/lib/vendor/MANIFEST.json +14 -14
- package/lib/vendor/blamejs-pki.cjs +1385 -402
- package/lib/vendor/public-suffix-list.dat +4 -3
- package/lib/vendor/public-suffix-list.data.js +2201 -2201
- package/package.json +1 -1
- package/sbom.cdx.json +6 -6
package/lib/guard-yaml.js
CHANGED
|
@@ -735,6 +735,69 @@ function _sanitizeTransform(input, opts) {
|
|
|
735
735
|
return codepointClass.scrubCharThreats(input, opts, _err, "yaml");
|
|
736
736
|
}
|
|
737
737
|
|
|
738
|
+
/**
|
|
739
|
+
* @primitive b.guardYaml.gate
|
|
740
|
+
* @signature b.guardYaml.gate(opts?)
|
|
741
|
+
* @since 0.7.14
|
|
742
|
+
* @status stable
|
|
743
|
+
* @compliance hipaa, pci-dss, gdpr, soc2
|
|
744
|
+
* @related b.guardYaml.validate, b.guardYaml.parse, b.staticServe.create, b.fileUpload.create
|
|
745
|
+
*
|
|
746
|
+
* Build a `b.gateContract` gate for plugging into
|
|
747
|
+
* `b.staticServe({ contentSafety: { ".yaml": gate } })`,
|
|
748
|
+
* `b.fileUpload({ contentSafety: { "application/yaml": gate } })`,
|
|
749
|
+
* or any host primitive that consumes the gate-contract shape.
|
|
750
|
+
*
|
|
751
|
+
* The action comes from the POLICY the active profile declares for each
|
|
752
|
+
* finding, not from the finding's severity: a character class set to `strip`
|
|
753
|
+
* is repaired and returned as `sanitize`, one set to `audit` reports
|
|
754
|
+
* `audit-only`, and one set to `reject` refuses. Findings that carry no policy
|
|
755
|
+
* and admit no repair — an alias explosion, a blown anchor cap, an oversized
|
|
756
|
+
* document, one that does not parse — fall back to the conservative severity
|
|
757
|
+
* answer and refuse.
|
|
758
|
+
*
|
|
759
|
+
* Only character-level repair is offered. Stripping an invisible or control
|
|
760
|
+
* character is a text edit needing no re-emit; the tag, alias and
|
|
761
|
+
* multi-document shapes have no faithful round-trip, so they refuse through
|
|
762
|
+
* their own policies rather than being rewritten.
|
|
763
|
+
*
|
|
764
|
+
* @opts
|
|
765
|
+
* profile: "strict"|"balanced"|"permissive",
|
|
766
|
+
* compliancePosture: "hipaa"|"pci-dss"|"gdpr"|"soc2",
|
|
767
|
+
* name: string, // gate identity for audit / observability
|
|
768
|
+
*
|
|
769
|
+
* @example
|
|
770
|
+
* var yamlGate = b.guardYaml.gate({ profile: "balanced" });
|
|
771
|
+
* var d = await yamlGate.check({ bytes: Buffer.from("key: value\n") });
|
|
772
|
+
* d.action; // → "serve"
|
|
773
|
+
*/
|
|
774
|
+
// The gate every other content guard builds explicitly. Without it `defineGuard`
|
|
775
|
+
// falls back to the default gate, which ends in `severityDisposition` and never
|
|
776
|
+
// consults this guard's disposition map — so a class the profile sets to `strip`
|
|
777
|
+
// or `audit` was refused anyway, because its finding happens to carry a high
|
|
778
|
+
// severity. Seven of the twelve character-policy cells resolved that way.
|
|
779
|
+
function gate(opts) {
|
|
780
|
+
// Resolve the profile FIRST. `buildContentGate` hands these opts straight to
|
|
781
|
+
// the disposition map, and an unresolved bag carries no `zeroWidthPolicy` /
|
|
782
|
+
// `bidiPolicy` / `controlPolicy` / `nullBytePolicy` at all — so every char
|
|
783
|
+
// finding falls through to the severity answer and refuses, which is the
|
|
784
|
+
// same wrong outcome by a different route.
|
|
785
|
+
opts = gateContract.resolveProfileAndPosture(opts, {
|
|
786
|
+
profiles: PROFILES,
|
|
787
|
+
compliancePostures: COMPLIANCE_POSTURES,
|
|
788
|
+
defaults: DEFAULTS,
|
|
789
|
+
errorClass: GuardYamlError,
|
|
790
|
+
errCodePrefix: "yaml",
|
|
791
|
+
});
|
|
792
|
+
return gateContract.buildContentGate({
|
|
793
|
+
name: opts.name || "guardYaml:" + (opts.profile || "default"),
|
|
794
|
+
opts: opts,
|
|
795
|
+
validate: module.exports.validate,
|
|
796
|
+
dispositionFor: _gateDispositionFor,
|
|
797
|
+
produceSanitized: _sanitizeTransform,
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
|
|
738
801
|
module.exports = gateContract.defineGuard({
|
|
739
802
|
name: "yaml",
|
|
740
803
|
kind: "content",
|
|
@@ -748,6 +811,7 @@ module.exports = gateContract.defineGuard({
|
|
|
748
811
|
detect: _detectIssues,
|
|
749
812
|
intOpts: ["maxBytes", "maxDepth", "maxAnchors", "maxAliasDepth",
|
|
750
813
|
"maxDocuments", "maxNodes", "maxScalarLength"],
|
|
814
|
+
gate: gate,
|
|
751
815
|
dispositionFor: _gateDispositionFor,
|
|
752
816
|
sanitizeTransform: _sanitizeTransform,
|
|
753
817
|
extra: {
|