cdk-real-drift 0.4.32 → 0.4.33

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/dist/cli.js CHANGED
@@ -797,20 +797,33 @@ function parseIgnoreRule(entry) {
797
797
  *
798
798
  * `wholeResource` marks an atomic, whole-resource target (an `added` finding — empty property
799
799
  * path, so the target is just `<parentLogicalId>/<CC-identifier>`). Such a target has NO
800
- * property subtree: the `.` / `[` inside it are DATA within the CC identifier
801
- * (`example.com`, an ARN, `a[0]`), never property separators. Trimming there would walk into
802
- * a DIFFERENT sibling resource whose identifier is this one extended by `.` / `[`
803
- * (`MyApi/a` wrongly swallowing `MyApi/a.b`, `MyApi/a[0]`) — a silent over-suppression of the
804
- * `added` out-of-band feature (issue #990). So in this mode the ancestor walk trims ONLY at
805
- * `/` boundaries, which alone mark a resource boundary: a bare PARENT-resource rule (`MyLb`)
806
- * still covers its added children across `/` (e.g. a listener child whose id is an ARN full
807
- * of `/`, issue #903), while a rule for one whole resource can no longer reach a sibling.
800
+ * property subtree: everything after the FIRST `/` is the OPAQUE CC identifier — and it may
801
+ * itself contain `.`, `[`, `|`, OR `/` (a Cognito ResourceServer URI identifier
802
+ * `https://api.example.com/v2`, an ARN, a log-group name). None of those are property or
803
+ * resource separators; they are DATA inside one atomic id, so the segment-bounded ancestor
804
+ * walk below MUST NOT run — an intermediate `.` / `[` / `/`-prefix is a truncation of the
805
+ * identifier that reaches a DIFFERENT sibling (`MyApi/a` swallowing `MyApi/a.b` or
806
+ * `MyApi/a[0]` — #990; a LITERAL rule `.../api.example.com` swallowing the extended sibling
807
+ * `.../api.example.com/v2` — #1061). Instead we test exactly two things, both with the
808
+ * identifier treated ATOMICALLY (the UNBOUNDED `matchesGlob`, whose `*` / `?` span `/`, since
809
+ * a `/` inside the identifier is data, not a boundary):
810
+ * 1. the FULL target — a LITERAL rule (what `ignoreRuleFor` writes, metachars escaped) then
811
+ * matches ONLY its own exact id, never a `/`-extended sibling; a user-authored parent
812
+ * glob (`MyLb/*`) still spans the whole atomic identifier of a child; and
813
+ * 2. the BARE PARENT logical id — the single segment BEFORE the first `/` — so a bare
814
+ * parent-RESOURCE rule (`MyLb`, issue #903) still covers a child whose id is an ARN full
815
+ * of `/`.
808
816
  */
809
817
  function pathMatches(pattern, target, wholeResource = false) {
810
818
  if (matchesPathGlob(pattern, target)) return true;
819
+ if (wholeResource) {
820
+ if (matchesGlob(pattern, target)) return true;
821
+ const firstSlash = target.indexOf("/");
822
+ return firstSlash > 0 && matchesGlob(pattern, target.slice(0, firstSlash));
823
+ }
811
824
  let t = target;
812
825
  while (true) {
813
- const cut = wholeResource ? t.lastIndexOf("/") : Math.max(t.lastIndexOf("."), t.lastIndexOf("["), t.lastIndexOf("/"));
826
+ const cut = Math.max(t.lastIndexOf("."), t.lastIndexOf("["), t.lastIndexOf("/"));
814
827
  if (cut <= 0) break;
815
828
  t = t.slice(0, cut);
816
829
  if (matchesPathGlob(pattern, t)) return true;