@company-semantics/contracts 0.25.1 → 0.26.0
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/package.json +3 -1
- package/src/guards/config.ts +110 -1
- package/src/guards/index.ts +6 -0
- package/src/index.ts +16 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@company-semantics/contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -53,6 +53,8 @@
|
|
|
53
53
|
"guard:scripts-deps": "npx tsx scripts/ci/scripts-deps-guard.ts",
|
|
54
54
|
"guard:version-tag": "npx tsx scripts/ci/version-tag-guard.ts",
|
|
55
55
|
"guard:version-tag:json": "npx tsx scripts/ci/version-tag-guard.ts --json",
|
|
56
|
+
"guard:decisions-deprecation": "npx tsx scripts/ci/decisions-deprecation-guard.ts",
|
|
57
|
+
"guard:decisions-deprecation:json": "npx tsx scripts/ci/decisions-deprecation-guard.ts --json",
|
|
56
58
|
"guard:test": "vitest run scripts/ci/__tests__",
|
|
57
59
|
"release": "npx tsx scripts/release.ts",
|
|
58
60
|
"prepublishOnly": "echo 'ERROR: Publishing is CI-only via tag push. Use pnpm release instead.' && exit 1",
|
package/src/guards/config.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Each repo provides its own config values; shared guards consume them.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type { CheckResult } from './types.js';
|
|
11
|
+
import type { CheckResult, Soc2ControlArea } from './types.js';
|
|
12
12
|
|
|
13
13
|
// =============================================================================
|
|
14
14
|
// Size Limits
|
|
@@ -376,6 +376,115 @@ export interface SubdirectoryAffinityBaseline {
|
|
|
376
376
|
ignoredDirectories?: string[];
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
+
// =============================================================================
|
|
380
|
+
// SOC 2 Guard Configuration Types
|
|
381
|
+
// =============================================================================
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Configuration for the secrets detection guard.
|
|
385
|
+
* This is a blocking control for SOC 2 Access Control (AC).
|
|
386
|
+
*/
|
|
387
|
+
export interface SecretsDetectionConfig {
|
|
388
|
+
/** Source directory to scan (relative to repo root) */
|
|
389
|
+
srcDir?: string;
|
|
390
|
+
/** Additional directories to scan */
|
|
391
|
+
additionalDirs?: string[];
|
|
392
|
+
/** File patterns to exclude (globs) */
|
|
393
|
+
excludePatterns?: string[];
|
|
394
|
+
/** Additional secret patterns to detect (regex strings) */
|
|
395
|
+
additionalPatterns?: string[];
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Configuration for the structured logging guard.
|
|
400
|
+
* This is a non-blocking control for SOC 2 Logging & Monitoring (LM).
|
|
401
|
+
*/
|
|
402
|
+
export interface StructuredLoggingConfig {
|
|
403
|
+
/** Entry point files to check (relative to repo root) */
|
|
404
|
+
entryPoints?: string[];
|
|
405
|
+
/** Source directory to scan for logging (fallback if no entry points) */
|
|
406
|
+
srcDir?: string;
|
|
407
|
+
/** Recognized logging libraries */
|
|
408
|
+
loggingLibraries?: string[];
|
|
409
|
+
/** Logger instantiation patterns (regex strings) */
|
|
410
|
+
instantiationPatterns?: string[];
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Configuration for the alerts config guard.
|
|
415
|
+
* This is a non-blocking control for SOC 2 Logging & Monitoring (LM).
|
|
416
|
+
*/
|
|
417
|
+
export interface AlertsConfigGuardConfig {
|
|
418
|
+
/**
|
|
419
|
+
* Files or directories to check for alerting configuration.
|
|
420
|
+
* Supports both file paths and directory paths.
|
|
421
|
+
*/
|
|
422
|
+
files?: string[];
|
|
423
|
+
/**
|
|
424
|
+
* Whether this check should be skipped.
|
|
425
|
+
* Use for repos that don't have alerting (e.g., pure libraries).
|
|
426
|
+
*/
|
|
427
|
+
skip?: boolean;
|
|
428
|
+
/**
|
|
429
|
+
* Evidence string when alerting is explicitly skipped.
|
|
430
|
+
*/
|
|
431
|
+
skipEvidence?: string;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Configuration for the backup config guard.
|
|
436
|
+
* This is a non-blocking control for SOC 2 Backup & Recovery (BR).
|
|
437
|
+
*/
|
|
438
|
+
export interface BackupConfigGuardConfig {
|
|
439
|
+
/**
|
|
440
|
+
* Files or directories to check for backup configuration.
|
|
441
|
+
*/
|
|
442
|
+
files?: string[];
|
|
443
|
+
/**
|
|
444
|
+
* Whether this check should be skipped.
|
|
445
|
+
* Use for repos that don't manage backups (e.g., frontend-only).
|
|
446
|
+
*/
|
|
447
|
+
skip?: boolean;
|
|
448
|
+
/**
|
|
449
|
+
* Evidence string when backup check is explicitly skipped.
|
|
450
|
+
*/
|
|
451
|
+
skipEvidence?: string;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* SOC 2 compliance baselines.
|
|
456
|
+
* Configures SOC 2 control guards for a repository.
|
|
457
|
+
*
|
|
458
|
+
* Design: Product repos provide data only; CI orchestrator owns guard implementations.
|
|
459
|
+
*/
|
|
460
|
+
export interface Soc2Baselines {
|
|
461
|
+
/** Enable SOC 2 compliance reporting */
|
|
462
|
+
enabled?: boolean;
|
|
463
|
+
/** Advisory mode: all controls become non-blocking for visibility-only rollout */
|
|
464
|
+
advisoryMode?: boolean;
|
|
465
|
+
/** Repository name (for evidence) */
|
|
466
|
+
repository?: string;
|
|
467
|
+
/** Secrets detection configuration */
|
|
468
|
+
secretsDetection?: SecretsDetectionConfig;
|
|
469
|
+
/** Structured logging configuration */
|
|
470
|
+
structuredLogging?: StructuredLoggingConfig;
|
|
471
|
+
/** Alerts config configuration */
|
|
472
|
+
alertsConfig?: AlertsConfigGuardConfig;
|
|
473
|
+
/** Backup config configuration */
|
|
474
|
+
backupConfig?: BackupConfigGuardConfig;
|
|
475
|
+
/** Controls to explicitly skip (with evidence) */
|
|
476
|
+
skipControls?: {
|
|
477
|
+
area: Soc2ControlArea;
|
|
478
|
+
evidence: string;
|
|
479
|
+
}[];
|
|
480
|
+
/**
|
|
481
|
+
* Controls that remain blocking even in advisory mode.
|
|
482
|
+
* Use to gradually promote controls from advisory to blocking.
|
|
483
|
+
* Example: ['AC'] to make secrets-detection blocking first.
|
|
484
|
+
*/
|
|
485
|
+
alwaysBlockingControls?: Soc2ControlArea[];
|
|
486
|
+
}
|
|
487
|
+
|
|
379
488
|
/**
|
|
380
489
|
* Registry of checks grouped by tier.
|
|
381
490
|
* Each repo exports this from guard-entries.ts for universal orchestration.
|
package/src/guards/index.ts
CHANGED
|
@@ -54,6 +54,12 @@ export type {
|
|
|
54
54
|
FileClusterBaseline,
|
|
55
55
|
SubdirectoryAffinityBaseline,
|
|
56
56
|
MetaBaselines,
|
|
57
|
+
// SOC 2 Guard Configuration types
|
|
58
|
+
SecretsDetectionConfig,
|
|
59
|
+
StructuredLoggingConfig,
|
|
60
|
+
AlertsConfigGuardConfig,
|
|
61
|
+
BackupConfigGuardConfig,
|
|
62
|
+
Soc2Baselines,
|
|
57
63
|
} from './config.js';
|
|
58
64
|
|
|
59
65
|
// Config constants (type-level defaults)
|
package/src/index.ts
CHANGED
|
@@ -70,6 +70,17 @@ export type {
|
|
|
70
70
|
ContractsFreshnessBaseline,
|
|
71
71
|
CoverageBaseline,
|
|
72
72
|
MetaBaselines,
|
|
73
|
+
// SOC 2 Compliance types
|
|
74
|
+
Soc2ControlArea,
|
|
75
|
+
Soc2ControlStatus,
|
|
76
|
+
Soc2ControlResult,
|
|
77
|
+
Soc2ComplianceOutput,
|
|
78
|
+
// SOC 2 Guard Configuration types
|
|
79
|
+
SecretsDetectionConfig,
|
|
80
|
+
StructuredLoggingConfig,
|
|
81
|
+
AlertsConfigGuardConfig,
|
|
82
|
+
BackupConfigGuardConfig,
|
|
83
|
+
Soc2Baselines,
|
|
73
84
|
} from './guards/index.js'
|
|
74
85
|
|
|
75
86
|
export {
|
|
@@ -78,6 +89,11 @@ export {
|
|
|
78
89
|
DEFAULT_SKIP_DIRECTORIES,
|
|
79
90
|
DEFAULT_DOMAIN_SECTIONS,
|
|
80
91
|
DEFAULT_INFRA_SECTIONS,
|
|
92
|
+
// SOC 2 Compliance constants
|
|
93
|
+
SOC2_CONTROL_NAMES,
|
|
94
|
+
REQUIRED_SOC2_CONTROLS,
|
|
95
|
+
BLOCKING_SOC2_CONTROLS,
|
|
96
|
+
SOC2_SCHEMA_VERSION,
|
|
81
97
|
} from './guards/index.js'
|
|
82
98
|
|
|
83
99
|
// Compatibility manifest (CI guard vocabulary)
|