@hublo/sentinel 1.7.0-alpha.35 → 1.7.0-alpha.36

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/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  registerAdapters,
7
7
  resolve,
8
8
  setDefaultRunner
9
- } from "./chunk-IXXRITO5.js";
9
+ } from "./chunk-OCTWLMUW.js";
10
10
  import "./chunk-ZZMYV576.js";
11
11
  import {
12
12
  BaseAdapter
@@ -18,7 +18,7 @@ import "./chunk-QXFCZON7.js";
18
18
  import "./chunk-YUZB4LRJ.js";
19
19
  import "./chunk-APBEGLRI.js";
20
20
  import "./chunk-TMVKYXZ3.js";
21
- import "./chunk-NGLEGAEN.js";
21
+ import "./chunk-5KNSTZ7F.js";
22
22
  import "./chunk-XYOIXC6A.js";
23
23
  import "./chunk-PXTU5MPW.js";
24
24
  import "./chunk-4EIY7TTR.js";
@@ -13,6 +13,16 @@ interface SqlDefaults {
13
13
  include: string[];
14
14
  /** Migrations a module chooses not to read. Empty by default. */
15
15
  exclude: string[];
16
+ /**
17
+ * Other migrations directories, relative to the module, whose INDEXES this module's queries
18
+ * use: never checked, only read for the trigram indexes `leading-wildcard-like` asks about.
19
+ *
20
+ * For a module that queries a database another module migrates. On the monorepo every trigram
21
+ * index is in `libs/nest/db-main` (main 190dc8e3595), and `mission`, `network` or `institution`
22
+ * query its tables: without this, the rule would say of their searches that no index serves
23
+ * them. Empty by default: the module's own migrations only, and the message says so.
24
+ */
25
+ indexesFrom: string[];
16
26
  };
17
27
  /** What the `Unsafe` rule reads. */
18
28
  unsafe: {
@@ -64,5 +74,15 @@ interface ResolvedSqlConfig extends SqlDefaults {
64
74
  }
65
75
  /** Resolve a module's declaration against this role's defaults. */
66
76
  declare function defineSql(input?: SqlInput): ResolvedSqlConfig;
77
+ /**
78
+ * A config another version of `defineSql` resolved, with this version's defaults under it.
79
+ *
80
+ * ⛔ A module's `sql.config.mjs` imports `defineSql` from the sentinel its own `node_modules` holds,
81
+ * which may be older than the one running: a setting added since (`migrations.indexesFrom`,
82
+ * 1.7.0-alpha.34) is then missing, and the rule reading it threw, its findings dropped with nothing
83
+ * said (found on the alpha.34 replay). Every value the module resolved is kept; only a missing
84
+ * setting takes the default.
85
+ */
86
+ declare function withDefaults(resolved: ResolvedSqlConfig): ResolvedSqlConfig;
67
87
 
68
- export { type ResolvedSqlConfig, type SqlInput, defineSql };
88
+ export { type ResolvedSqlConfig, type SqlInput, defineSql, withDefaults };
@@ -1,8 +1,10 @@
1
1
  import {
2
- defineSql
3
- } from "../../chunk-NGLEGAEN.js";
2
+ defineSql,
3
+ withDefaults
4
+ } from "../../chunk-5KNSTZ7F.js";
4
5
  import "../../chunk-PXTU5MPW.js";
5
6
  export {
6
- defineSql
7
+ defineSql,
8
+ withDefaults
7
9
  };
8
10
  //# sourceMappingURL=config.js.map
@@ -14,42 +14,15 @@ npx --yes @hublo/sentinel@<version> --run --env
14
14
  It writes no config, so there is no `--init`. With no `env.config.mjs` it runs on sentinel's
15
15
  defaults, and says so in its header.
16
16
 
17
- ## A pull request answers for what it adds
18
-
19
- The repository is checked twice: on the branch, and at its merge base with `origin/main` (`NX_BASE`
20
- in CI), read from git without a checkout. Only what the branch ADDS is listed, annotated, and can
21
- fail the run; what main already had is a count, and every finding stays in `--json` and in
22
- `env-report/env.json`. A dependency upgrade that touches the root `package.json` used to get the
23
- whole repository's findings (48 on hublo/monorepo#24914); it now gets a one-line ✅.
24
-
25
- | A finding is the same one at the base when it has the same | so |
26
- | ---------------------------------------------------------- | ------------------------------------------------------------ |
27
- | rule and variable (rule 1) | reading an undeclared variable in one more file adds nothing |
28
- | rule, variable and app (rule 3) | the same variable missing from another app's contract is new |
29
- | rule and file (rule 2), rule, subject and file (the rest) | a finding pushed down by an edit above it is not new |
30
-
31
- The line is never part of it. A file the branch moved (`git mv`, as git detects it) keeps its
32
- findings. The branch's `env.config.mjs` is used on both sides: a pull request that changes it
33
- changes what is checked, and that change is its own.
34
-
35
- ⚠️ The run FAILS when git cannot say where the branch left main: no `origin/main` in the clone, or
36
- a shallow clone. Check out with its history (`fetch-depth: 0`). Comparing with nothing would report
37
- every finding as the pull request's.
38
-
39
- ⚠️ Rule 8 at the base asks the branch's nx graph (computing it at a commit would need that commit
40
- installed): a Dockerfile reference to a target the branch removed reads as known when the
41
- Dockerfile itself did not change. The report says so in a note when rule 8 found anything.
42
-
43
17
  ## The level: `SENTINEL_ENV_LEVEL`
44
18
 
45
- The same findings are reported at every level. The level decides what they DO, to the findings
46
- the branch adds.
19
+ The same findings are reported at every level. The level decides what they DO.
47
20
 
48
- | `SENTINEL_ENV_LEVEL` | reports | in GitHub Actions (`GITHUB_ACTIONS=true`) | exit |
49
- | -------------------- | ------- | ----------------------------------------------------------- | ------------------------------------------- |
50
- | `info` | yes | nothing more | 0 |
51
- | `warning` (default) | yes | one `::warning file=…,line=…::` annotation per finding | 0 |
52
- | `error` | yes | `::error` on a blocking finding, `::warning` on an advisory | **1** on a blocking finding the branch adds |
21
+ | `SENTINEL_ENV_LEVEL` | reports | in GitHub Actions (`GITHUB_ACTIONS=true`) | exit |
22
+ | -------------------- | ------- | ----------------------------------------------------------- | --------------------------- |
23
+ | `info` | yes | nothing more | 0 |
24
+ | `warning` (default) | yes | one `::warning file=…,line=…::` annotation per finding | 0 |
25
+ | `error` | yes | `::error` on a blocking finding, `::warning` on an advisory | **1** on a blocking finding |
53
26
 
54
27
  An unknown value is refused with exit 1 rather than read as the default: a typo of `error` that ran
55
28
  as `warning` would turn a gate into a report, and nobody would see it stop gating.
@@ -206,8 +179,6 @@ permissions:
206
179
  pull-requests: write
207
180
  steps:
208
181
  - uses: actions/checkout@v4
209
- with:
210
- fetch-depth: 0 # the merge base with origin/main
211
182
  - uses: actions/setup-node@v4
212
183
  with:
213
184
  node-version: 24.15.0
@@ -145,11 +145,14 @@ which a module may turn off) and the 2 timeouts the key calls for.
145
145
  | sentinel, `applied-migration-changed` | 1 | **yes**, at `warn` |
146
146
  | sentinel, `enum-value-used-before-commit` | 1 | **yes**, at `warn` |
147
147
  | sentinel, `migration-folder-without-sql` | 1 | **yes**, at `warn` |
148
+ | sentinel, its rules on the SQL of templates | 5 | **yes**, at `warn` |
149
+ | sentinel, its opt-in rules on the SQL of templates | 3 | no: one runs once the module gives it a level |
148
150
 
149
- **55 rules run on every module**, the set squawk itself runs, plus sentinel's five. sentinel turns
151
+ **60 rules run on every module**, the set squawk itself runs, plus sentinel's ten. sentinel turns
150
152
  no squawk rule off and turns no opt-in rule on: the choice of what runs by default is squawk's, and
151
- a module moves it in its own config. `pnpm exec sentinel --inspect --sql --json` lists all 82 names
152
- with the level each has in this module: squawk's 76, sentinel's five, and `syntax-error`.
153
+ a module moves it in its own config. `pnpm exec sentinel --inspect --sql --json` lists all 90 names
154
+ with the level each has in this module: squawk's 76, sentinel's thirteen, and `syntax-error`. The
155
+ rules on the SQL of templates are in [The SQL of templates](#the-sql-of-templates-queryraw-executeraw-prismasql).
153
156
 
154
157
  **A migration that does not parse** is reported first, with its first error (the ones squawk gives
155
158
  after it follow from it), and counts as **one finding** under `syntax-error`, at `warn` like every
@@ -177,15 +180,16 @@ every setting the module can move and the role's value today, generated from the
177
180
  cannot drift from them. A setting the module leaves out keeps the role's value; a setting it writes
178
181
  **replaces** it, including inside a list, and the html report shows it as overridden by this module.
179
182
 
180
- | Setting | Default | What it moves |
181
- | --------------------- | ------------------------------------------ | ------------------------------------------------------ |
182
- | `migrations.include` | `["**/migrations/*/migration.sql"]` | which files are migrations |
183
- | `migrations.exclude` | `[]` | migrations never read |
184
- | `unsafe.includeTests` | `true` | whether calls in test files are checked, by both rules |
185
- | `unsafe.tests` | test folders and `*.spec`/`*.test`/… files | what counts as a test file |
186
- | `ignore` | `node_modules`, `dist`, `coverage` | never read, by either check |
187
- | `pgVersion` | `"16.8"` | the PostgreSQL version squawk checks against |
188
- | `rules` | `{}`, every rule at its default | a level per rule, by its name |
183
+ | Setting | Default | What it moves |
184
+ | ------------------------ | ------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |
185
+ | `migrations.include` | `["**/migrations/*/migration.sql"]` | which files are migrations |
186
+ | `migrations.exclude` | `[]` | migrations never read |
187
+ | `migrations.indexesFrom` | `[]` | other migrations folders whose trigram indexes this module's queries use, read for `leading-wildcard-like` only |
188
+ | `unsafe.includeTests` | `true` | whether calls in test files are checked, by both rules |
189
+ | `unsafe.tests` | test folders and `*.spec`/`*.test`/… files | what counts as a test file |
190
+ | `ignore` | `node_modules`, `dist`, `coverage` | never read, by either check |
191
+ | `pgVersion` | `"16.8"` | the PostgreSQL version squawk checks against |
192
+ | `rules` | `{}`, every rule at its default | a level per rule, by its name |
189
193
 
190
194
  An example that blocks two rules, silences one and turns an opt-in rule on:
191
195
 
@@ -546,22 +550,126 @@ the safety of the text rests on code the call does not show.
546
550
  list, but its separator, prefix and suffix are SQL text. Measured on `main`: 88 calls with a
547
551
  separator, every one a literal (`' AND '`, `' OR '`, `'\n'`), so none is reported.
548
552
 
553
+ ## The SQL of templates, `$queryRaw`, `$executeRaw`, `Prisma.sql`
554
+
555
+ Prisma binds every `${}` of these three, so they are safe from injection. Their SQL is still SQL,
556
+ and the 19 May incident was written in one. The role reads each template of the files the branch
557
+ adds or changes with **PostgreSQL's own parser** (`libpg-query` 16.8.3, the 16 line the monorepo
558
+ runs), the same grammar the server applies: a rule matches the tree, never a word in a string or a
559
+ comment.
560
+
561
+ **How a fragment is read.** A `Prisma.sql` is often a fragment, a condition or an `ORDER BY` list,
562
+ joined into a query later. Each `${}` is filled with what it most likely is (a value, then an
563
+ identifier, then nothing, then a list of values), and the text is wrapped in the smallest statement
564
+ it can stand in (itself, `SELECT …`, `SELECT 1 WHERE …`, `… ORDER BY …`, `WITH … SELECT 1`, …). The
565
+ first reading PostgreSQL accepts is kept. A rule never reports what the wrap wrote, and a rule
566
+ about a whole statement (`UPDATE` without `WHERE`) runs only on a template that is one.
567
+
568
+ **What cannot be read alone** is named in every report, the console, the comment, the json and the
569
+ page, with its line, and never fails the run: the role reads all it can rather than stop. On
570
+ `main` 837abe3f29c, 1 237 of the 1 360 production templates holding SQL of their own are read
571
+ (91 %), and 227 of 227 in tests. A template made of `${}` only has nothing to read and is not
572
+ counted.
573
+
574
+ **Tests are read**, as the `Unsafe` rule reads them: `unsafe.includeTests`, which a module may set
575
+ to `false` for both.
576
+
577
+ | Rule | Default | Reports | Leaves alone |
578
+ | --------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- |
579
+ | `exists-union-correlated-outside` | **on** | an `EXISTS` over a derived `UNION` filtered only outside it | a `UNION` whose branches each carry the correlation (mission's `UNION ALL`) |
580
+ | `update-delete-without-where` | **on** | an `UPDATE` or `DELETE` with no `WHERE`, `UPDATE … FROM` included | a `SET` fragment |
581
+ | `insert-without-columns` | **on** | an `INSERT` with values and no column list | `DEFAULT VALUES`, a `VALUES` fragment |
582
+ | `select-star` | **on** | `SELECT *` or `t.*` on a table of the schema | `EXISTS (SELECT * …)`, `count(*)`, a `WITH` table, a subquery, `jsonb_to_recordset(…)` |
583
+ | `leading-wildcard-like` | **on** | a `LIKE` / `ILIKE` pattern starting with `%`, written in the SQL or built by the TypeScript, on an expression no trigram index of the migrations read serves | an anchored pattern, one whose start the code does not show, a served search, a `CHECK` constraint |
584
+ | `offset-pagination` | opt-in | `OFFSET` in a query or in the fragment that pages it | `LIMIT` alone |
585
+ | `select-distinct` | opt-in | a plain `SELECT DISTINCT` | `DISTINCT ON (…)` |
586
+ | `not-in-subquery` | opt-in | `NOT IN (SELECT …)`, which one `NULL` in the result empties | `NOT IN (1, 2)`, `NOT EXISTS` |
587
+
588
+ Measured over every template of `main` 837abe3f29c: the five rules on by default report 3
589
+ templates of production code (all `select-star` on a table) and 15 in tests (fixtures that update
590
+ every row or insert by position, and two `ILIKE '%…'` on `pg_indexes`). Turned on, the opt-in
591
+ ones would report 14, 22 and 0 templates of production code.
592
+
593
+ ### Searches inside the text, `leading-wildcard-like`
594
+
595
+ A pattern that starts with `%` cannot use a B-tree index: every row is read. A trigram index
596
+ (`pg_trgm`, `gin_trgm_ops` or `gist_trgm_ops`) on the very expression searched serves it, so the
597
+ rule speaks only when none is in the migrations it read.
598
+
599
+ It reads the pattern wherever it is written: a literal (`'%x'`), SQL that builds it (`'%' || $1`,
600
+ `concat('%', $1)`, `LIKE … ESCAPE`), and the TypeScript that builds and binds it
601
+ (``${`%${word}%`}``, or a `const` of the file), through `lower`, `upper`, `unaccent` and
602
+ `immutable_unaccent`. A pattern whose start the code does not show, a function parameter, is not
603
+ judged.
604
+
605
+ The index must be on the same expression: an index on `"searchName"` does not serve
606
+ `unaccent(w."searchName")`. When a fragment does not say which table it reads (its `FROM` is in
607
+ another template), an index on that expression of any table counts.
608
+
609
+ **A module that queries another module's database** names that module's migrations, or the rule
610
+ would say that no index serves searches that one does:
611
+
612
+ ```js
613
+ // apps/nest/microservices/mission/sql.config.mjs
614
+ export default defineSql({
615
+ root: import.meta.dirname,
616
+ overrides: { migrations: { indexesFrom: ['../../../../libs/nest/db-main/prisma/migrations'] } },
617
+ })
618
+ ```
619
+
620
+ Those migrations are read for their indexes only, never checked. An index created by hand in a
621
+ database is in no migration: the message says which migrations were read, and that such an index
622
+ is not seen.
623
+
624
+ Measured on `main` 190dc8e3595, production code: the literal pattern alone, the rule of
625
+ 1.7.0-alpha.33, reported **0** places. This one reports 38 with each module's own migrations, and
626
+ **26** once the modules name `libs/nest/db-main`'s, where the 9 trigram indexes of the monorepo
627
+ are: 12 searches are served and stay silent. The 26 were read one by one: none has a trigram index
628
+ on its expression in any migration (`unaccent(w."searchName")` on an index of `"searchName"`,
629
+ recruitment's searches on a database whose migrations create the extension and no index).
630
+
631
+ ### The 19 May incident, `exists-union-correlated-outside`
632
+
633
+ ```sql
634
+ EXISTS (
635
+ SELECT 1 FROM (
636
+ SELECT j.profile_id FROM profile_jobs j WHERE j.approval = 'idle'
637
+ UNION
638
+ SELECT s.profile_id FROM profile_specialties s WHERE s.approval = 'idle'
639
+ ) pending
640
+ WHERE pending.profile_id = p.id
641
+ )
642
+ ```
643
+
644
+ The correlation to the outer row sits outside the union, on the derived table, and PostgreSQL does
645
+ not push it into the branches: for every outer row it builds the whole union. That made the
646
+ network list scan both tables once per profile (monorepo 868e2b4). Run on a copy of `network`, the
647
+ rule reports `has-pending-skill-requests.filter-strategy.ts:21` at `868e2b4^1` and nothing at
648
+ `868e2b4`; over every template of `main`, nothing.
649
+
650
+ ```
651
+ this EXISTS reads the UNION `pending` and filters it only outside the union (`pending.profile_id`): PostgreSQL cannot push that filter into the branches, so it builds the whole union for every outer row. This is the shape of the 19 May incident.
652
+ ```
653
+
654
+ The fix: repeat the correlation in each branch (`WHERE j.profile_id = p.id`), or write one
655
+ `EXISTS` per branch joined by `OR`, so each branch is filtered with its own index.
656
+
549
657
  ## Every way to send SQL text, and what reads it
550
658
 
551
659
  Measured on the monorepo (`main` f12da701121), every call that can send text to a database:
552
660
 
553
- | Entry point | Calls | Its text is | Read by |
554
- | ---------------------------------------------------------------------- | ------------: | -------------------------------------------------------- | --------------------------------------- |
555
- | `` $queryRaw`…` ``, `` $executeRaw`…` ``, `` Prisma.sql`…` `` (tagged) | 332 and 1 079 | a template whose every `${}` Prisma binds | nothing to report: safe by construction |
556
- | `$queryRaw(sql)` called as a function | 30 | a `Prisma.Sql` object; TypeScript refuses a plain string | nothing to report |
557
- | `$queryRawUnsafe` / `$executeRawUnsafe` | 219 | SQL | `unsafe-sql-pasted-value` |
558
- | `pg` `query` | 37 | SQL | `unsafe-sql-pasted-value` |
559
- | postgres.js `unsafe` | 1 | SQL | `unsafe-sql-pasted-value` |
560
- | `Prisma.raw` | 97 | SQL, pasted as is | `unsafe-sql-raw-fragment` |
561
- | `Prisma.join` separator, prefix, suffix | 88 | SQL | `unsafe-sql-raw-fragment` |
562
- | postgres.js tagged `` sql`…` `` | | a template whose every `${}` the driver binds | nothing to report |
563
- | knex, TypeORM, Sequelize, mysql | 0 | | not used |
564
- | MongoDB (35 imports) | | not SQL | outside this role |
661
+ | Entry point | Calls | Its text is | Read by |
662
+ | ---------------------------------------------------------------------- | ------------: | -------------------------------------------------------- | -------------------------------------------------------------- |
663
+ | `` $queryRaw`…` ``, `` $executeRaw`…` ``, `` Prisma.sql`…` `` (tagged) | 332 and 1 079 | a template whose every `${}` Prisma binds | safe from injection; its SQL is read by the rules on templates |
664
+ | `$queryRaw(sql)` called as a function | 30 | a `Prisma.Sql` object; TypeScript refuses a plain string | nothing to report |
665
+ | `$queryRawUnsafe` / `$executeRawUnsafe` | 219 | SQL | `unsafe-sql-pasted-value` |
666
+ | `pg` `query` | 37 | SQL | `unsafe-sql-pasted-value` |
667
+ | postgres.js `unsafe` | 1 | SQL | `unsafe-sql-pasted-value` |
668
+ | `Prisma.raw` | 97 | SQL, pasted as is | `unsafe-sql-raw-fragment` |
669
+ | `Prisma.join` separator, prefix, suffix | 88 | SQL | `unsafe-sql-raw-fragment` |
670
+ | postgres.js tagged `` sql`…` `` | | a template whose every `${}` the driver binds | nothing to report |
671
+ | knex, TypeORM, Sequelize, mysql | 0 | | not used |
672
+ | MongoDB (35 imports) | | not SQL | outside this role |
565
673
 
566
674
  ## What the role does not read yet
567
675
 
@@ -570,9 +678,14 @@ Said here so that a clean report is not read as more than it is:
570
678
  - **`VACUUM` in a migration of several statements.** PostgreSQL refuses it inside a transaction,
571
679
  as it refuses `CONCURRENTLY`, and squawk 2.72.0 does not report it there. No migration of the
572
680
  monorepo runs `VACUUM`.
573
- - **The SQL text itself** of a raw query is not parsed: a tagged `$queryRaw` with only parameters is
574
- safe from injection, and its SQL is not checked against any rule. A syntax error inside it is not
575
- seen. That is the next step, with libpg-query.
681
+ - **A problem split across two templates.** Each template is read alone: an `EXISTS` in one
682
+ `Prisma.sql` and the `UNION` a `${}` brings from another are two readings, and the rule sees
683
+ neither whole. Assembling the fragments of a query would be close to reading the ORM chain.
684
+ - **The templates PostgreSQL's parser cannot read alone**, about 9 % of the production ones on
685
+ `main` 837abe3f29c: named in every report, never a failure, and checked by no rule.
686
+ - **The SQL text of `$queryRawUnsafe`** is checked for what is pasted into it, not against the
687
+ rules on templates, and **drizzle-orm's `` sql`…` ``** (6 files) is not read: its fragments are
688
+ built for its query builder.
576
689
  - **JavaScript files** (`.js`, `.mjs`): the role reads TypeScript (`.ts`, `.mts`, `.cts`).
577
690
  - **Files outside a module.** The role runs on a module; a script at the repository's root that
578
691
  belongs to no module is read by no role.
@@ -330,6 +330,7 @@ $ sentinel --report --json 2>/dev/null
330
330
  "migrations": 0,
331
331
  "codeFiles": 1,
332
332
  "unsafeFiles": 0,
333
+ "templateFiles": 0,
333
334
  "base": null,
334
335
  "migrationsRead": 0,
335
336
  "migrationsUnchanged": 0,
@@ -338,6 +339,9 @@ $ sentinel --report --json 2>/dev/null
338
339
  "unsafeCalls": 0,
339
340
  "rawFragmentCalls": 0,
340
341
  "unsafeUnparsed": 0,
342
+ "templateFilesRead": 0,
343
+ "templatesRead": 0,
344
+ "templatesUnread": 0,
341
345
  "findings": 0,
342
346
  "errors": 0,
343
347
  "rulesOff": [],
@@ -454,6 +458,7 @@ $ sentinel --report --json 2>/dev/null
454
458
  "migrations": 0,
455
459
  "codeFiles": 1,
456
460
  "unsafeFiles": 0,
461
+ "templateFiles": 0,
457
462
  "base": null,
458
463
  "migrationsRead": 0,
459
464
  "migrationsUnchanged": 0,
@@ -462,6 +467,9 @@ $ sentinel --report --json 2>/dev/null
462
467
  "unsafeCalls": 0,
463
468
  "rawFragmentCalls": 0,
464
469
  "unsafeUnparsed": 0,
470
+ "templateFilesRead": 0,
471
+ "templatesRead": 0,
472
+ "templatesUnread": 0,
465
473
  "findings": 0,
466
474
  "errors": 0,
467
475
  "rulesOff": [],
@@ -578,6 +586,7 @@ $ sentinel --report --json 2>/dev/null
578
586
  "migrations": 0,
579
587
  "codeFiles": 1,
580
588
  "unsafeFiles": 0,
589
+ "templateFiles": 0,
581
590
  "base": null,
582
591
  "migrationsRead": 0,
583
592
  "migrationsUnchanged": 0,
@@ -586,6 +595,9 @@ $ sentinel --report --json 2>/dev/null
586
595
  "unsafeCalls": 0,
587
596
  "rawFragmentCalls": 0,
588
597
  "unsafeUnparsed": 0,
598
+ "templateFilesRead": 0,
599
+ "templatesRead": 0,
600
+ "templatesUnread": 0,
589
601
  "findings": 0,
590
602
  "errors": 0,
591
603
  "rulesOff": [],
@@ -690,6 +702,7 @@ $ sentinel --report --json 2>/dev/null
690
702
  "migrations": 0,
691
703
  "codeFiles": 1,
692
704
  "unsafeFiles": 0,
705
+ "templateFiles": 0,
693
706
  "base": null,
694
707
  "migrationsRead": 0,
695
708
  "migrationsUnchanged": 0,
@@ -698,6 +711,9 @@ $ sentinel --report --json 2>/dev/null
698
711
  "unsafeCalls": 0,
699
712
  "rawFragmentCalls": 0,
700
713
  "unsafeUnparsed": 0,
714
+ "templateFilesRead": 0,
715
+ "templatesRead": 0,
716
+ "templatesUnread": 0,
701
717
  "findings": 0,
702
718
  "errors": 0,
703
719
  "rulesOff": [],
@@ -854,6 +870,7 @@ $ sentinel --report --all --json 2>/dev/null
854
870
  "migrations": 0,
855
871
  "codeFiles": 1,
856
872
  "unsafeFiles": 0,
873
+ "templateFiles": 0,
857
874
  "base": null,
858
875
  "migrationsRead": 0,
859
876
  "migrationsUnchanged": 0,
@@ -862,6 +879,9 @@ $ sentinel --report --all --json 2>/dev/null
862
879
  "unsafeCalls": 0,
863
880
  "rawFragmentCalls": 0,
864
881
  "unsafeUnparsed": 0,
882
+ "templateFilesRead": 0,
883
+ "templatesRead": 0,
884
+ "templatesUnread": 0,
865
885
  "findings": 0,
866
886
  "errors": 0,
867
887
  "rulesOff": [],
@@ -978,6 +998,7 @@ $ sentinel --report --all --json 2>/dev/null
978
998
  "migrations": 0,
979
999
  "codeFiles": 1,
980
1000
  "unsafeFiles": 0,
1001
+ "templateFiles": 0,
981
1002
  "base": null,
982
1003
  "migrationsRead": 0,
983
1004
  "migrationsUnchanged": 0,
@@ -986,6 +1007,9 @@ $ sentinel --report --all --json 2>/dev/null
986
1007
  "unsafeCalls": 0,
987
1008
  "rawFragmentCalls": 0,
988
1009
  "unsafeUnparsed": 0,
1010
+ "templateFilesRead": 0,
1011
+ "templatesRead": 0,
1012
+ "templatesUnread": 0,
989
1013
  "findings": 0,
990
1014
  "errors": 0,
991
1015
  "rulesOff": [],
@@ -1102,6 +1126,7 @@ $ sentinel --report --all --json 2>/dev/null
1102
1126
  "migrations": 0,
1103
1127
  "codeFiles": 1,
1104
1128
  "unsafeFiles": 0,
1129
+ "templateFiles": 0,
1105
1130
  "base": null,
1106
1131
  "migrationsRead": 0,
1107
1132
  "migrationsUnchanged": 0,
@@ -1110,6 +1135,9 @@ $ sentinel --report --all --json 2>/dev/null
1110
1135
  "unsafeCalls": 0,
1111
1136
  "rawFragmentCalls": 0,
1112
1137
  "unsafeUnparsed": 0,
1138
+ "templateFilesRead": 0,
1139
+ "templatesRead": 0,
1140
+ "templatesUnread": 0,
1113
1141
  "findings": 0,
1114
1142
  "errors": 0,
1115
1143
  "rulesOff": [],
@@ -1214,6 +1242,7 @@ $ sentinel --report --all --json 2>/dev/null
1214
1242
  "migrations": 0,
1215
1243
  "codeFiles": 1,
1216
1244
  "unsafeFiles": 0,
1245
+ "templateFiles": 0,
1217
1246
  "base": null,
1218
1247
  "migrationsRead": 0,
1219
1248
  "migrationsUnchanged": 0,
@@ -1222,6 +1251,9 @@ $ sentinel --report --all --json 2>/dev/null
1222
1251
  "unsafeCalls": 0,
1223
1252
  "rawFragmentCalls": 0,
1224
1253
  "unsafeUnparsed": 0,
1254
+ "templateFilesRead": 0,
1255
+ "templatesRead": 0,
1256
+ "templatesUnread": 0,
1225
1257
  "findings": 0,
1226
1258
  "errors": 0,
1227
1259
  "rulesOff": [],
@@ -2090,7 +2122,6 @@ $ sentinel --run --env
2090
2122
  env (level warning: report, and annotate in GitHub Actions; never fails)
2091
2123
  2 env file(s), 0 contract(s), 0 required and 0 optional variable(s) read, 1 Dockerfile(s), node 10.15.3
2092
2124
  settings: sentinel defaults (no env.config.mjs)
2093
- compared with origin/main at 90d0ae1: only what this branch adds is listed
2094
2125
 
2095
2126
  ✗ [committed-env-file] rule 2, blocking, 2
2096
2127
  a real env file is committed: remove it from git (only .example contracts belong there; values come from a secret store)
@@ -2114,7 +2145,7 @@ env (level warning: report, and annotate in GitHub Actions; never fails)
2114
2145
  note: no required reader call found (getOrFail, requireEnv, requireEnvVariable): rule 1 had nothing to check; name the repository's own helper in readers.required
2115
2146
  note: not an nx workspace (no nx.json): rule 8 skipped
2116
2147
 
2117
- 5 blocking findings added: reported, not failing
2148
+ 5 blocking findings: reported, not failing
2118
2149
  ✓ serviceapp (repository) env — level=warning blocking=5
2119
2150
  1 repository [serviceapp] in <n>ms
2120
2151
  # exit: 0
@@ -2124,10 +2155,9 @@ env (level warning: report, and annotate in GitHub Actions; never fails)
2124
2155
 
2125
2156
  ```console
2126
2157
  $ sentinel --run --env
2127
- env (level error: fails on a blocking finding this branch adds (rules 1, 2, 6, 7 to 10))
2158
+ env (level error: fails on a blocking finding (rules 1, 2, 6, 7 to 10))
2128
2159
  2 env file(s), 0 contract(s), 0 required and 0 optional variable(s) read, 1 Dockerfile(s), node 10.15.3
2129
2160
  settings: sentinel defaults (no env.config.mjs)
2130
- compared with origin/main at 90d0ae1: only what this branch adds is listed
2131
2161
 
2132
2162
  ✗ [committed-env-file] rule 2, blocking, 2
2133
2163
  a real env file is committed: remove it from git (only .example contracts belong there; values come from a secret store)
@@ -2151,7 +2181,7 @@ env (level error: fails on a blocking finding this branch adds (rules 1, 2, 6, 7
2151
2181
  note: no required reader call found (getOrFail, requireEnv, requireEnvVariable): rule 1 had nothing to check; name the repository's own helper in readers.required
2152
2182
  note: not an nx workspace (no nx.json): rule 8 skipped
2153
2183
 
2154
- 5 blocking findings added: failing
2184
+ 5 blocking findings: failing
2155
2185
  ✗ serviceapp (repository) env — level=error blocking=5
2156
2186
  1 repository [serviceapp] in <n>ms
2157
2187
  # exit: 1
@@ -2164,7 +2194,6 @@ $ sentinel --run --env
2164
2194
  env (level warning: report, and annotate in GitHub Actions; never fails)
2165
2195
  2 env file(s), 0 contract(s), 0 required and 0 optional variable(s) read, 1 Dockerfile(s), node 10.15.3
2166
2196
  settings: sentinel defaults (no env.config.mjs)
2167
- compared with origin/main at 90d0ae1: only what this branch adds is listed
2168
2197
 
2169
2198
  ✗ [committed-env-file] rule 2, blocking, 2
2170
2199
  a real env file is committed: remove it from git (only .example contracts belong there; values come from a secret store)
@@ -2188,7 +2217,7 @@ env (level warning: report, and annotate in GitHub Actions; never fails)
2188
2217
  note: no required reader call found (getOrFail, requireEnv, requireEnvVariable): rule 1 had nothing to check; name the repository's own helper in readers.required
2189
2218
  note: not an nx workspace (no nx.json): rule 8 skipped
2190
2219
 
2191
- 5 blocking findings added: reported, not failing
2220
+ 5 blocking findings: reported, not failing
2192
2221
  ::warning file=variables/dev.variables.env,title=env rule 2%3A committed-env-file::variables/dev.variables.env: a real env file is committed: remove it from git (only .example contracts belong there; values come from a secret store)
2193
2222
  ::warning file=variables/production.variables.env,title=env rule 2%3A committed-env-file::variables/production.variables.env: a real env file is committed: remove it from git (only .example contracts belong there; values come from a secret store)
2194
2223
  ::warning file=variables/dev.variables.env,line=2,title=env rule 5%3A public-secret-to-review::REACT_APP_SEGMENT_API_KEY_ADMINS: a public-prefixed, secret-named variable carries a committed value: it ships to the browser by design, confirm it is genuinely public
@@ -2219,7 +2248,7 @@ $ sentinel --run --env --json 2>/dev/null
2219
2248
  "ok": true,
2220
2249
  "status": "ok",
2221
2250
  "level": "warning",
2222
- "verdict": "5 blocking findings added: reported, not failing",
2251
+ "verdict": "5 blocking findings: reported, not failing",
2223
2252
  "blocking": 5,
2224
2253
  "config": null,
2225
2254
  "scanned": [
@@ -2294,70 +2323,6 @@ $ sentinel --run --env --json 2>/dev/null
2294
2323
  "line": 8
2295
2324
  }
2296
2325
  ],
2297
- "comparison": {
2298
- "base": {
2299
- "ref": "origin/main",
2300
- "commit": "90d0ae1"
2301
- },
2302
- "added": [
2303
- {
2304
- "rule": "committed-env-file",
2305
- "number": 2,
2306
- "severity": "blocking",
2307
- "name": "variables/dev.variables.env",
2308
- "file": "variables/dev.variables.env"
2309
- },
2310
- {
2311
- "rule": "committed-env-file",
2312
- "number": 2,
2313
- "severity": "blocking",
2314
- "name": "variables/production.variables.env",
2315
- "file": "variables/production.variables.env"
2316
- },
2317
- {
2318
- "rule": "public-secret-to-review",
2319
- "number": 5,
2320
- "severity": "advisory",
2321
- "name": "REACT_APP_SEGMENT_API_KEY_ADMINS",
2322
- "file": "variables/dev.variables.env",
2323
- "line": 2
2324
- },
2325
- {
2326
- "rule": "public-secret-to-review",
2327
- "number": 5,
2328
- "severity": "advisory",
2329
- "name": "REACT_APP_SEGMENT_API_KEY_ADMINS",
2330
- "file": "variables/production.variables.env",
2331
- "line": 2
2332
- },
2333
- {
2334
- "rule": "secret-not-blanked",
2335
- "number": 6,
2336
- "severity": "blocking",
2337
- "name": "DPAE_PASSWORD",
2338
- "file": "variables/dev.variables.env",
2339
- "line": 1
2340
- },
2341
- {
2342
- "rule": "secret-not-blanked",
2343
- "number": 6,
2344
- "severity": "blocking",
2345
- "name": "DPAE_PASSWORD",
2346
- "file": "variables/production.variables.env",
2347
- "line": 1
2348
- },
2349
- {
2350
- "rule": "copy-not-owned",
2351
- "number": 10,
2352
- "severity": "blocking",
2353
- "name": "COPY --from=build /home/node/app .",
2354
- "file": "Dockerfile",
2355
- "line": 8
2356
- }
2357
- ],
2358
- "fixed": [],
2359
- "known": 0
2360
- },
2361
2326
  "inventory": {
2362
2327
  "required": [],
2363
2328
  "optional": [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hublo/sentinel",
3
- "version": "1.7.0-alpha.35",
3
+ "version": "1.7.0-alpha.36",
4
4
  "description": "One CLI that guards code health across Hublo repos: shared lint/typescript/build/test presets, static & dynamic analysis, and architecture checks.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -177,6 +177,7 @@
177
177
  "jscpd": "5.4.0",
178
178
  "jsdom": "^24.1.3",
179
179
  "jsonc-parser": "^3.3.1",
180
+ "libpg-query": "16.8.3",
180
181
  "msw": "1.3.3",
181
182
  "nitro": "3.0.260415-beta",
182
183
  "oxc-parser": "0.147.0",