vouchington-tooling 0.57.0 → 0.59.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/README.md +26 -0
- package/dist/agent-issue-labels/ensure-labels.d.mts +17 -0
- package/dist/agent-issue-labels/ensure-labels.mjs +55 -0
- package/dist/agent-issue-labels/index.d.mts +5 -0
- package/dist/agent-issue-labels/index.mjs +3 -0
- package/dist/agent-issue-labels/label-policy.d.mts +21 -0
- package/dist/agent-issue-labels/label-policy.mjs +67 -0
- package/dist/agent-issue-labels/labels-from-paths.d.mts +9 -0
- package/dist/agent-issue-labels/labels-from-paths.mjs +54 -0
- package/dist/browser-session-runner/tail-queue.d.mts +1 -1
- package/dist/browser-session-runner/tail-queue.mjs +1 -1
- package/dist/cli/commands/agent-issue-labels.d.mts +2 -0
- package/dist/cli/commands/agent-issue-labels.mjs +17 -0
- package/dist/cli/commands/gitleaks-directory-scan.d.mts +4 -0
- package/dist/cli/commands/gitleaks-directory-scan.mjs +9 -0
- package/dist/cli/commands/transient-retry.d.mts +13 -0
- package/dist/cli/commands/transient-retry.mjs +68 -0
- package/dist/cli/index.mjs +14 -53
- package/dist/cli/parse-agent-issue-labels.d.mts +19 -0
- package/dist/cli/parse-agent-issue-labels.mjs +70 -0
- package/dist/cli/parse-forwarded-commands.d.mts +9 -0
- package/dist/cli/parse-forwarded-commands.mjs +6 -0
- package/dist/cli/parse.d.mts +11 -1
- package/dist/cli/parse.mjs +3 -0
- package/dist/cli/script-paths.d.mts +5 -0
- package/dist/cli/script-paths.mjs +48 -0
- package/dist/cli/usage.d.mts +1 -1
- package/dist/cli/usage.mjs +12 -0
- package/dist/dead-code/baseline.d.mts +19 -0
- package/dist/dead-code/baseline.mjs +124 -0
- package/dist/dead-code/child-command.d.mts +6 -0
- package/dist/dead-code/child-command.mjs +107 -0
- package/dist/dead-code/cli.d.mts +5 -0
- package/dist/dead-code/cli.mjs +71 -0
- package/dist/dead-code/entry-roots.d.mts +7 -0
- package/dist/dead-code/entry-roots.mjs +43 -0
- package/dist/dead-code/fixture-deadline.test-helpers.d.mts +1 -0
- package/dist/dead-code/fixture-deadline.test-helpers.mjs +9 -0
- package/dist/dead-code/gate.d.mts +29 -0
- package/dist/dead-code/gate.mjs +33 -0
- package/dist/dead-code/gate.test-helpers.d.mts +14 -0
- package/dist/dead-code/gate.test-helpers.mjs +35 -0
- package/dist/dead-code/index.d.mts +9 -0
- package/dist/dead-code/index.mjs +7 -0
- package/dist/dead-code/scan.d.mts +11 -0
- package/dist/dead-code/scan.mjs +37 -0
- package/dist/dead-code/tracked-snapshot.d.mts +2 -0
- package/dist/dead-code/tracked-snapshot.mjs +72 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +1 -0
- package/dist/markdown/details-scope.d.mts +1 -1
- package/dist/markdown/details-scope.mjs +1 -1
- package/dist/transient-retry/attempts.d.mts +1 -1
- package/dist/transient-retry/attempts.mjs +1 -1
- package/dist/transient-retry/decision-evaluator.d.mts +3 -3
- package/dist/transient-retry/gh-api.d.mts +30 -0
- package/dist/transient-retry/gh-api.mjs +68 -0
- package/dist/transient-retry/github-actions-log.d.mts +7 -0
- package/dist/transient-retry/github-actions-log.mjs +33 -0
- package/dist/transient-retry/index.d.mts +15 -0
- package/dist/transient-retry/index.mjs +8 -0
- package/dist/transient-retry/log-stream.d.mts +12 -0
- package/dist/transient-retry/log-stream.mjs +39 -0
- package/dist/transient-retry/log-window.d.mts +18 -0
- package/dist/transient-retry/log-window.mjs +94 -0
- package/dist/transient-retry/rerun.d.mts +23 -0
- package/dist/transient-retry/rerun.mjs +68 -0
- package/dist/transient-retry/run-context-annotations.d.mts +7 -0
- package/dist/transient-retry/run-context-annotations.mjs +44 -0
- package/dist/transient-retry/run-context-jobs.d.mts +20 -0
- package/dist/transient-retry/run-context-jobs.mjs +54 -0
- package/dist/transient-retry/run-context-logs.d.mts +12 -0
- package/dist/transient-retry/run-context-logs.mjs +86 -0
- package/dist/transient-retry/run-context-rule-attempts.d.mts +14 -0
- package/dist/transient-retry/run-context-rule-attempts.mjs +65 -0
- package/dist/transient-retry/run-context-types.d.mts +49 -0
- package/dist/transient-retry/run-context-types.mjs +3 -0
- package/dist/transient-retry/run-context.d.mts +9 -0
- package/dist/transient-retry/run-context.mjs +25 -0
- package/dist/transient-retry/run-context.test-helpers.d.mts +16 -0
- package/dist/transient-retry/run-context.test-helpers.mjs +56 -0
- package/dist/transient-retry/types.d.mts +8 -7
- package/dist/vitest-diagnostics/vitest-worker-exit-diagnostics-reporter.mjs +1 -1
- package/dist/workflow-secrets-drift/cli.d.mts +10 -0
- package/dist/workflow-secrets-drift/cli.mjs +73 -0
- package/dist/workflow-secrets-drift/collect.d.mts +10 -0
- package/dist/workflow-secrets-drift/collect.mjs +70 -0
- package/dist/workflow-secrets-drift/drift.d.mts +22 -0
- package/dist/workflow-secrets-drift/drift.mjs +49 -0
- package/dist/workflow-secrets-drift/gh-parse.d.mts +5 -0
- package/dist/workflow-secrets-drift/gh-parse.mjs +41 -0
- package/dist/workflow-secrets-drift/gh.d.mts +4 -0
- package/dist/workflow-secrets-drift/gh.mjs +51 -0
- package/dist/workflow-secrets-drift/index.d.mts +11 -0
- package/dist/workflow-secrets-drift/index.mjs +6 -0
- package/dist/workflow-secrets-drift/inventory.d.mts +10 -0
- package/dist/workflow-secrets-drift/inventory.mjs +78 -0
- package/dist/workflow-secrets-drift/scopes.d.mts +12 -0
- package/dist/workflow-secrets-drift/scopes.mjs +56 -0
- package/dist/workflow-secrets-drift/settle.d.mts +3 -0
- package/dist/workflow-secrets-drift/settle.mjs +19 -0
- package/dist/workflow-secrets-drift/types.d.mts +33 -0
- package/dist/workflow-secrets-drift/types.mjs +1 -0
- package/package.json +16 -1
- package/scripts/__pycache__/run_bounded_process.cpython-312.pyc +0 -0
|
@@ -10,7 +10,7 @@ export interface RetryContext {
|
|
|
10
10
|
targetNames?: ReadonlySet<string>;
|
|
11
11
|
}
|
|
12
12
|
export type RetryDecision = 'rerun' | 'ignore' | 'fresh-plan' | 'reap-lock' | 'dispatch';
|
|
13
|
-
export type RetryTarget = {
|
|
13
|
+
export type RetryTarget<C extends RetryContext = RetryContext> = {
|
|
14
14
|
targetName: string;
|
|
15
15
|
targetFamily?: never;
|
|
16
16
|
resolveTargetName?: never;
|
|
@@ -19,20 +19,21 @@ export type RetryTarget = {
|
|
|
19
19
|
/** Static prefix shared by every dynamically named target in the family. */
|
|
20
20
|
targetFamily: string;
|
|
21
21
|
/** Resolves the exact target for this run, or null when it cannot be determined. */
|
|
22
|
-
resolveTargetName: (context:
|
|
22
|
+
resolveTargetName: (context: C) => string | null;
|
|
23
23
|
};
|
|
24
|
-
interface RetryRuleBase {
|
|
24
|
+
interface RetryRuleBase<C extends RetryContext> {
|
|
25
25
|
/** Stable identifier for logs and telemetry. */
|
|
26
26
|
id: string;
|
|
27
27
|
/** Maximum normalized attempts at which this rule may match. */
|
|
28
28
|
maxAttempts: number;
|
|
29
|
-
match: (context:
|
|
29
|
+
match: (context: C) => boolean | Promise<boolean>;
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
/** `C` lets a provider narrow the context its rules read, e.g. to add logs. */
|
|
32
|
+
export type RetryRule<C extends RetryContext = RetryContext> = (RetryRuleBase<C> & {
|
|
32
33
|
decision?: 'rerun';
|
|
33
34
|
/** When omitted, the match is an untargeted provider-level rerun. */
|
|
34
|
-
retryTarget?: RetryTarget
|
|
35
|
-
}) | (RetryRuleBase & {
|
|
35
|
+
retryTarget?: RetryTarget<C>;
|
|
36
|
+
}) | (RetryRuleBase<C> & {
|
|
36
37
|
decision: Exclude<RetryDecision, 'rerun'>;
|
|
37
38
|
retryTarget?: never;
|
|
38
39
|
});
|
|
@@ -13,10 +13,10 @@ const workerExitSignals = [
|
|
|
13
13
|
'Worker exited unexpectedly',
|
|
14
14
|
];
|
|
15
15
|
class VitestWorkerExitDiagnosticsReporter {
|
|
16
|
-
recordDirectory;
|
|
17
16
|
emitted = false;
|
|
18
17
|
recentModuleEvents = [];
|
|
19
18
|
recentStderrLines = [];
|
|
19
|
+
recordDirectory;
|
|
20
20
|
constructor(recordDirectory) {
|
|
21
21
|
this.recordDirectory = recordDirectory;
|
|
22
22
|
// Clear once before forks start. Clearing on watch reruns would unlink the files still held
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { WorkflowSecretInventory, WorkflowSecretsDependencies } from './types.mts';
|
|
2
|
+
export declare const USAGE: string;
|
|
3
|
+
export interface VerifyWorkflowSecretsOptions {
|
|
4
|
+
dependencies?: WorkflowSecretsDependencies;
|
|
5
|
+
output?: Pick<Console, 'error' | 'log'>;
|
|
6
|
+
/** Skips loading `--inventory` when supplied. */
|
|
7
|
+
inventory?: WorkflowSecretInventory;
|
|
8
|
+
cwd?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function runVerifyWorkflowSecretsCli(argv: readonly string[], options?: VerifyWorkflowSecretsOptions): Promise<number>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { parseArgs } from 'node:util';
|
|
2
|
+
import { collectLiveSecretNames } from "./collect.mjs";
|
|
3
|
+
import { diffAgainstInventory, formatDrift, missingConfirmedSecrets, unconfirmedNewlyProvisioned, } from "./drift.mjs";
|
|
4
|
+
import { createGhDependencies } from "./gh.mjs";
|
|
5
|
+
import { DEFAULT_INVENTORY_EXPORT, DEFAULT_INVENTORY_PATH, loadInventory, normalizeInventory, } from "./inventory.mjs";
|
|
6
|
+
import { requiredEnvironmentNames, requiredSecretScopeViolations } from "./scopes.mjs";
|
|
7
|
+
import { errorMessage } from "./settle.mjs";
|
|
8
|
+
export const USAGE = 'Usage: vouchington verify-workflow-secrets [--repo <owner/repo>] [--confirm <name1,name2,...>] ' +
|
|
9
|
+
'[--inventory <module>] [--export <name>] [--branch <name>]';
|
|
10
|
+
const splitNames = (raw) => (raw ?? '')
|
|
11
|
+
.split(',')
|
|
12
|
+
.map((name) => name.trim().toUpperCase())
|
|
13
|
+
.filter((name) => name.length > 0);
|
|
14
|
+
export async function runVerifyWorkflowSecretsCli(argv, options = {}) {
|
|
15
|
+
const { output = console, dependencies = createGhDependencies() } = options;
|
|
16
|
+
let values;
|
|
17
|
+
try {
|
|
18
|
+
;
|
|
19
|
+
({ values } = parseArgs({
|
|
20
|
+
args: [...argv],
|
|
21
|
+
options: {
|
|
22
|
+
repo: { type: 'string' },
|
|
23
|
+
confirm: { type: 'string' },
|
|
24
|
+
inventory: { type: 'string', default: DEFAULT_INVENTORY_PATH },
|
|
25
|
+
export: { type: 'string', default: DEFAULT_INVENTORY_EXPORT },
|
|
26
|
+
branch: { type: 'string', default: 'main' },
|
|
27
|
+
},
|
|
28
|
+
strict: true,
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
output.error(`${USAGE}\n${errorMessage(err)}`);
|
|
33
|
+
return 2;
|
|
34
|
+
}
|
|
35
|
+
const confirmNames = splitNames(values.confirm);
|
|
36
|
+
const emptyOption = ['repo', 'inventory', 'export', 'branch'].find((key) => values[key] !== undefined && values[key].trim() === '');
|
|
37
|
+
if (emptyOption !== undefined || (values.confirm !== undefined && confirmNames.length === 0)) {
|
|
38
|
+
output.error(`${USAGE}\n--${emptyOption ?? 'confirm'} requires a non-empty value`);
|
|
39
|
+
return 2;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
const inventory = normalizeInventory(options.inventory ??
|
|
43
|
+
(await loadInventory(values.inventory, values.export, options.cwd ?? process.cwd())));
|
|
44
|
+
const repo = values.repo ?? (await dependencies.resolveRepo());
|
|
45
|
+
const live = await collectLiveSecretNames(repo, dependencies, requiredEnvironmentNames(inventory));
|
|
46
|
+
const drift = diffAgainstInventory(inventory, live.names, live.warnings);
|
|
47
|
+
output.log(formatDrift(drift));
|
|
48
|
+
const scopeViolations = requiredSecretScopeViolations(inventory, {
|
|
49
|
+
...live,
|
|
50
|
+
deploymentBranch: values.branch,
|
|
51
|
+
});
|
|
52
|
+
if (scopeViolations.length > 0) {
|
|
53
|
+
output.log(`Secret scope violations:\n${scopeViolations.map((value) => ` - ${value}`).join('\n')}`);
|
|
54
|
+
}
|
|
55
|
+
const missingConfirmed = missingConfirmedSecrets(confirmNames, live.names);
|
|
56
|
+
if (confirmNames.length > 0) {
|
|
57
|
+
output.log(missingConfirmed.length > 0
|
|
58
|
+
? `--confirm expected these secret(s) to be live, but gh does not see them: ${missingConfirmed.join(', ')}`
|
|
59
|
+
: `Confirmed all ${confirmNames.length} --confirm secret(s) are live.`);
|
|
60
|
+
}
|
|
61
|
+
const failed = unconfirmedNewlyProvisioned(drift, confirmNames).length > 0 ||
|
|
62
|
+
drift.notActuallyProvisioned.length > 0 ||
|
|
63
|
+
drift.accidentallyProvisioned.length > 0 ||
|
|
64
|
+
drift.warnings.length > 0 ||
|
|
65
|
+
scopeViolations.length > 0 ||
|
|
66
|
+
missingConfirmed.length > 0;
|
|
67
|
+
return failed ? 1 : 0;
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
output.error(`verify-workflow-secrets failed: ${errorMessage(err)}`);
|
|
71
|
+
return 1;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EnvironmentDeploymentBranchPolicy, WorkflowSecretsDependencies } from './types.mts';
|
|
2
|
+
export interface LiveSecretNames {
|
|
3
|
+
names: Set<string>;
|
|
4
|
+
repositoryNames: Set<string>;
|
|
5
|
+
organizationNames: Set<string>;
|
|
6
|
+
environmentNames: Map<string, Set<string>>;
|
|
7
|
+
environmentDeploymentBranchPolicies: Map<string, EnvironmentDeploymentBranchPolicy>;
|
|
8
|
+
warnings: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare function collectLiveSecretNames(repo: string, dependencies: WorkflowSecretsDependencies, requiredPolicyEnvironments: ReadonlySet<string>): Promise<LiveSecretNames>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { errorMessage, settleLimited } from "./settle.mjs";
|
|
2
|
+
const QUERY_CONCURRENCY = 5;
|
|
3
|
+
/** GitHub stores secret names upper-case and compares them case-insensitively. */
|
|
4
|
+
const upperCased = (names) => new Set(names.map((name) => name.toUpperCase()));
|
|
5
|
+
async function collectOrganizationNames(repo, dependencies, warnings) {
|
|
6
|
+
try {
|
|
7
|
+
const ownerType = await dependencies.listRepositoryOwnerType(repo);
|
|
8
|
+
if (ownerType !== 'Organization' && ownerType !== 'User') {
|
|
9
|
+
throw new Error(`unexpected repository owner type: ${ownerType}`);
|
|
10
|
+
}
|
|
11
|
+
if (ownerType === 'User')
|
|
12
|
+
return new Set();
|
|
13
|
+
return upperCased(await dependencies.listRepositoryOrganizationSecretNames(repo));
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
warnings.push(`Could not list organization secrets for ${repo}: ${errorMessage(err)}`);
|
|
17
|
+
return new Set();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
async function collectEnvironmentNames(repo, dependencies, warnings) {
|
|
21
|
+
let environments = [];
|
|
22
|
+
try {
|
|
23
|
+
environments = await dependencies.listEnvironmentNames(repo);
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
warnings.push(`Could not list deployment environments for ${repo}: ${errorMessage(err)}`);
|
|
27
|
+
}
|
|
28
|
+
const results = await settleLimited(environments, QUERY_CONCURRENCY, (environment) => dependencies.listEnvironmentSecretNames(repo, environment));
|
|
29
|
+
const byEnvironment = new Map();
|
|
30
|
+
results.forEach((result, index) => {
|
|
31
|
+
if (result.status === 'fulfilled') {
|
|
32
|
+
byEnvironment.set(environments[index].toLowerCase(), upperCased(result.value));
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
warnings.push(`Could not list secrets for environment "${environments[index]}": ${errorMessage(result.reason)}`);
|
|
36
|
+
});
|
|
37
|
+
return byEnvironment;
|
|
38
|
+
}
|
|
39
|
+
async function collectBranchPolicies(repo, environments, dependencies, warnings) {
|
|
40
|
+
const names = [...environments];
|
|
41
|
+
const results = await settleLimited(names, QUERY_CONCURRENCY, (environment) => dependencies.getEnvironmentDeploymentBranchPolicy(repo, environment));
|
|
42
|
+
const policies = new Map();
|
|
43
|
+
results.forEach((result, index) => {
|
|
44
|
+
if (result.status === 'fulfilled') {
|
|
45
|
+
policies.set(names[index], result.value);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
warnings.push(`Could not list deployment branch policy for environment "${names[index]}": ${errorMessage(result.reason)}`);
|
|
49
|
+
});
|
|
50
|
+
return policies;
|
|
51
|
+
}
|
|
52
|
+
export async function collectLiveSecretNames(repo, dependencies, requiredPolicyEnvironments) {
|
|
53
|
+
const warnings = [];
|
|
54
|
+
const repositoryNames = upperCased(await dependencies.listRepoSecretNames(repo));
|
|
55
|
+
const organizationNames = await collectOrganizationNames(repo, dependencies, warnings);
|
|
56
|
+
const environmentNames = await collectEnvironmentNames(repo, dependencies, warnings);
|
|
57
|
+
const environmentDeploymentBranchPolicies = await collectBranchPolicies(repo, requiredPolicyEnvironments, dependencies, warnings);
|
|
58
|
+
const names = new Set([...repositoryNames, ...organizationNames]);
|
|
59
|
+
for (const scoped of environmentNames.values())
|
|
60
|
+
for (const name of scoped)
|
|
61
|
+
names.add(name);
|
|
62
|
+
return {
|
|
63
|
+
names,
|
|
64
|
+
repositoryNames,
|
|
65
|
+
organizationNames,
|
|
66
|
+
environmentNames,
|
|
67
|
+
environmentDeploymentBranchPolicies,
|
|
68
|
+
warnings,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { WorkflowSecretInventory } from './types.mts';
|
|
2
|
+
export interface SecretDrift {
|
|
3
|
+
/** `provisioned: false` in the inventory, but live: flip the flag to true. */
|
|
4
|
+
readonly newlyProvisioned: string[];
|
|
5
|
+
/** `provisioned: true` in the inventory, but not live: investigate. */
|
|
6
|
+
readonly notActuallyProvisioned: string[];
|
|
7
|
+
/** `neverProvision: true` in the inventory, but live anyway: delete the live secret. */
|
|
8
|
+
readonly accidentallyProvisioned: string[];
|
|
9
|
+
/** Live secret with no inventory entry: informational, not a drift failure. */
|
|
10
|
+
readonly unreferenced: string[];
|
|
11
|
+
/** Reads the secret store could not complete (permissions, deleted mid-run, etc). */
|
|
12
|
+
readonly warnings: string[];
|
|
13
|
+
}
|
|
14
|
+
export declare function diffAgainstInventory(inventory: WorkflowSecretInventory, liveNames: ReadonlySet<string>, warnings: readonly string[]): SecretDrift;
|
|
15
|
+
/** `confirmNames` entries that are not live: the operator's post-provisioning checklist fell short. */
|
|
16
|
+
export declare function missingConfirmedSecrets(confirmNames: readonly string[], liveNames: ReadonlySet<string>): string[];
|
|
17
|
+
/**
|
|
18
|
+
* `drift.newlyProvisioned` names not covered by `--confirm`. A confirmed name is expected to still
|
|
19
|
+
* be `provisioned: false` until a follow-up edit, so only other newly-provisioned names are drift.
|
|
20
|
+
*/
|
|
21
|
+
export declare function unconfirmedNewlyProvisioned(drift: SecretDrift, confirmNames: readonly string[]): string[];
|
|
22
|
+
export declare function formatDrift(drift: SecretDrift): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export function diffAgainstInventory(inventory, liveNames, warnings) {
|
|
2
|
+
const newlyProvisioned = [];
|
|
3
|
+
const notActuallyProvisioned = [];
|
|
4
|
+
const accidentallyProvisioned = [];
|
|
5
|
+
for (const [name, entry] of Object.entries(inventory)) {
|
|
6
|
+
if (entry.neverProvision) {
|
|
7
|
+
if (liveNames.has(name))
|
|
8
|
+
accidentallyProvisioned.push(name);
|
|
9
|
+
}
|
|
10
|
+
else if (!entry.provisioned && liveNames.has(name))
|
|
11
|
+
newlyProvisioned.push(name);
|
|
12
|
+
else if (entry.provisioned && !liveNames.has(name))
|
|
13
|
+
notActuallyProvisioned.push(name);
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
newlyProvisioned: newlyProvisioned.toSorted(),
|
|
17
|
+
notActuallyProvisioned: notActuallyProvisioned.toSorted(),
|
|
18
|
+
accidentallyProvisioned: accidentallyProvisioned.toSorted(),
|
|
19
|
+
unreferenced: [...liveNames].filter((name) => !Object.hasOwn(inventory, name)).toSorted(),
|
|
20
|
+
warnings: [...warnings],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** `confirmNames` entries that are not live: the operator's post-provisioning checklist fell short. */
|
|
24
|
+
export function missingConfirmedSecrets(confirmNames, liveNames) {
|
|
25
|
+
return confirmNames.filter((name) => !liveNames.has(name));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* `drift.newlyProvisioned` names not covered by `--confirm`. A confirmed name is expected to still
|
|
29
|
+
* be `provisioned: false` until a follow-up edit, so only other newly-provisioned names are drift.
|
|
30
|
+
*/
|
|
31
|
+
export function unconfirmedNewlyProvisioned(drift, confirmNames) {
|
|
32
|
+
const confirmed = new Set(confirmNames);
|
|
33
|
+
return drift.newlyProvisioned.filter((name) => !confirmed.has(name));
|
|
34
|
+
}
|
|
35
|
+
function section(title, names) {
|
|
36
|
+
return names.length === 0 ? [] : [title, ...names.map((name) => ` - ${name}`)];
|
|
37
|
+
}
|
|
38
|
+
export function formatDrift(drift) {
|
|
39
|
+
const lines = [
|
|
40
|
+
...section('Now provisioned but still marked `provisioned: false` (flip it in the inventory):', drift.newlyProvisioned),
|
|
41
|
+
...section('Marked `provisioned: true` but not visible to this gh session (deleted, renamed, or a token-scope gap; verify before editing):', drift.notActuallyProvisioned),
|
|
42
|
+
...section('Marked `neverProvision: true` but provisioned live anyway (delete the live secret, do not flip `provisioned`):', drift.accidentallyProvisioned),
|
|
43
|
+
...section('Provisioned but not in the inventory (fine if consumed outside workflows, e.g. Dependabot/Codespaces):', drift.unreferenced),
|
|
44
|
+
...drift.warnings.map((warning) => `Warning: ${warning}`),
|
|
45
|
+
];
|
|
46
|
+
if (lines.length === 0)
|
|
47
|
+
lines.push('The inventory matches the live secret store. No drift.');
|
|
48
|
+
return `${lines.join('\n')}\n`;
|
|
49
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DeploymentBranchRule, EnvironmentDeploymentBranchPolicy } from './types.mts';
|
|
2
|
+
export declare function outputNames(stdout: string): string[];
|
|
3
|
+
export declare function parseSecretNames(stdout: string): string[];
|
|
4
|
+
export declare function parseDeploymentBranchPolicy(stdout: string): Omit<EnvironmentDeploymentBranchPolicy, 'deploymentBranchRules'>;
|
|
5
|
+
export declare function parseDeploymentBranchRules(stdout: string): DeploymentBranchRule[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
2
|
+
export function outputNames(stdout) {
|
|
3
|
+
return stdout
|
|
4
|
+
.split('\n')
|
|
5
|
+
.map((line) => line.trim())
|
|
6
|
+
.filter((line) => line.length > 0);
|
|
7
|
+
}
|
|
8
|
+
export function parseSecretNames(stdout) {
|
|
9
|
+
return JSON.parse(stdout).map((entry) => entry.name);
|
|
10
|
+
}
|
|
11
|
+
export function parseDeploymentBranchPolicy(stdout) {
|
|
12
|
+
const parsed = JSON.parse(stdout);
|
|
13
|
+
if (!isRecord(parsed) ||
|
|
14
|
+
typeof parsed.protected_branches !== 'boolean' ||
|
|
15
|
+
typeof parsed.custom_branch_policies !== 'boolean') {
|
|
16
|
+
throw new Error('unexpected deployment branch policy metadata');
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
protectedBranchesEnabled: parsed.protected_branches,
|
|
20
|
+
customBranchPoliciesEnabled: parsed.custom_branch_policies,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export function parseDeploymentBranchRules(stdout) {
|
|
24
|
+
const parsed = JSON.parse(stdout);
|
|
25
|
+
const invalid = new Error('unexpected deployment branch policy');
|
|
26
|
+
if (!isRecord(parsed))
|
|
27
|
+
throw invalid;
|
|
28
|
+
const { total_count, branch_policies } = parsed;
|
|
29
|
+
if (!Number.isSafeInteger(total_count) ||
|
|
30
|
+
!Array.isArray(branch_policies) ||
|
|
31
|
+
branch_policies.length > 2 ||
|
|
32
|
+
branch_policies.length !== total_count) {
|
|
33
|
+
throw invalid;
|
|
34
|
+
}
|
|
35
|
+
return branch_policies.map((rule) => {
|
|
36
|
+
if (!isRecord(rule) || typeof rule.name !== 'string' || typeof rule.type !== 'string') {
|
|
37
|
+
throw invalid;
|
|
38
|
+
}
|
|
39
|
+
return { name: rule.name, type: rule.type };
|
|
40
|
+
});
|
|
41
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type RunTextCommand } from '../gh-cli/index.mts';
|
|
2
|
+
import type { WorkflowSecretsDependencies } from './types.mts';
|
|
3
|
+
/** Builds the live reads on top of an injectable `gh` runner (argv in, stdout out). */
|
|
4
|
+
export declare function createGhDependencies(run?: RunTextCommand): WorkflowSecretsDependencies;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { runGh } from "../gh-cli/index.mjs";
|
|
2
|
+
import { outputNames, parseDeploymentBranchPolicy, parseDeploymentBranchRules, parseSecretNames, } from "./gh-parse.mjs";
|
|
3
|
+
/** Builds the live reads on top of an injectable `gh` runner (argv in, stdout out). */
|
|
4
|
+
export function createGhDependencies(run = runGh) {
|
|
5
|
+
return {
|
|
6
|
+
resolveRepo: async () => (await run(['repo', 'view', '--json', 'nameWithOwner', '--jq', '.nameWithOwner'])).trim(),
|
|
7
|
+
listRepoSecretNames: async (repo) => parseSecretNames(await run(['secret', 'list', '-R', repo, '--json', 'name'])),
|
|
8
|
+
listRepositoryOwnerType: async (repo) => (await run(['api', `repos/${repo}`, '--jq', '.owner.type'])).trim(),
|
|
9
|
+
listRepositoryOrganizationSecretNames: async (repo) => outputNames(await run([
|
|
10
|
+
'api',
|
|
11
|
+
`repos/${repo}/actions/organization-secrets`,
|
|
12
|
+
'--paginate',
|
|
13
|
+
'--jq',
|
|
14
|
+
'.secrets[].name',
|
|
15
|
+
])),
|
|
16
|
+
listEnvironmentNames: async (repo) => outputNames(await run([
|
|
17
|
+
'api',
|
|
18
|
+
`repos/${repo}/environments`,
|
|
19
|
+
'--paginate',
|
|
20
|
+
'--jq',
|
|
21
|
+
'.environments[].name',
|
|
22
|
+
])),
|
|
23
|
+
listEnvironmentSecretNames: async (repo, environment) => outputNames(await run([
|
|
24
|
+
'api',
|
|
25
|
+
`repos/${repo}/environments/${encodeURIComponent(environment)}/secrets`,
|
|
26
|
+
'--paginate',
|
|
27
|
+
'--jq',
|
|
28
|
+
'.secrets[].name',
|
|
29
|
+
])),
|
|
30
|
+
getEnvironmentDeploymentBranchPolicy: async (repo, environment) => {
|
|
31
|
+
const endpoint = `repos/${repo}/environments/${encodeURIComponent(environment)}`;
|
|
32
|
+
const policy = parseDeploymentBranchPolicy(await run(['api', endpoint, '--jq', '.deployment_branch_policy']));
|
|
33
|
+
if (!policy.customBranchPoliciesEnabled || policy.protectedBranchesEnabled) {
|
|
34
|
+
return { ...policy, deploymentBranchRules: [] };
|
|
35
|
+
}
|
|
36
|
+
const rules = await run([
|
|
37
|
+
'api',
|
|
38
|
+
'-X',
|
|
39
|
+
'GET',
|
|
40
|
+
`${endpoint}/deployment-branch-policies`,
|
|
41
|
+
'-F',
|
|
42
|
+
'per_page=2',
|
|
43
|
+
'-F',
|
|
44
|
+
'page=1',
|
|
45
|
+
'--jq',
|
|
46
|
+
'{total_count, branch_policies: [.branch_policies[] | {name, type}]}',
|
|
47
|
+
]);
|
|
48
|
+
return { ...policy, deploymentBranchRules: parseDeploymentBranchRules(rules) };
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { runVerifyWorkflowSecretsCli, USAGE } from './cli.mts';
|
|
2
|
+
export type { VerifyWorkflowSecretsOptions } from './cli.mts';
|
|
3
|
+
export { collectLiveSecretNames } from './collect.mts';
|
|
4
|
+
export type { LiveSecretNames } from './collect.mts';
|
|
5
|
+
export { diffAgainstInventory, formatDrift, missingConfirmedSecrets, unconfirmedNewlyProvisioned, } from './drift.mts';
|
|
6
|
+
export type { SecretDrift } from './drift.mts';
|
|
7
|
+
export { createGhDependencies } from './gh.mts';
|
|
8
|
+
export { DEFAULT_INVENTORY_EXPORT, DEFAULT_INVENTORY_PATH, loadInventory, normalizeInventory, } from './inventory.mts';
|
|
9
|
+
export { requiredEnvironmentNames, requiredSecretScopeViolations } from './scopes.mts';
|
|
10
|
+
export type { ScopeInput } from './scopes.mts';
|
|
11
|
+
export type { DeploymentBranchRule, EnvironmentDeploymentBranchPolicy, WorkflowSecretInventory, WorkflowSecretInventoryEntry, WorkflowSecretsDependencies, } from './types.mts';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { runVerifyWorkflowSecretsCli, USAGE } from "./cli.mjs";
|
|
2
|
+
export { collectLiveSecretNames } from "./collect.mjs";
|
|
3
|
+
export { diffAgainstInventory, formatDrift, missingConfirmedSecrets, unconfirmedNewlyProvisioned, } from "./drift.mjs";
|
|
4
|
+
export { createGhDependencies } from "./gh.mjs";
|
|
5
|
+
export { DEFAULT_INVENTORY_EXPORT, DEFAULT_INVENTORY_PATH, loadInventory, normalizeInventory, } from "./inventory.mjs";
|
|
6
|
+
export { requiredEnvironmentNames, requiredSecretScopeViolations } from "./scopes.mjs";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { WorkflowSecretInventory } from './types.mts';
|
|
2
|
+
export declare const DEFAULT_INVENTORY_PATH = ".github/workflows/workflow-secrets-inventory.mts";
|
|
3
|
+
export declare const DEFAULT_INVENTORY_EXPORT = "SECRET_INVENTORY";
|
|
4
|
+
/**
|
|
5
|
+
* GitHub stores secret names upper-case and treats environment names case-insensitively, so
|
|
6
|
+
* names are compared as upper-case secrets and lower-case environments.
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizeInventory(inventory: WorkflowSecretInventory): WorkflowSecretInventory;
|
|
9
|
+
/** Loads the named export of an inventory module (resolved against `cwd`) and checks its shape. */
|
|
10
|
+
export declare function loadInventory(modulePath: string, exportName: string, cwd?: string): Promise<WorkflowSecretInventory>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
import { resolve } from 'node:path';
|
|
10
|
+
import { pathToFileURL } from 'node:url';
|
|
11
|
+
export const DEFAULT_INVENTORY_PATH = '.github/workflows/workflow-secrets-inventory.mts';
|
|
12
|
+
export const DEFAULT_INVENTORY_EXPORT = 'SECRET_INVENTORY';
|
|
13
|
+
const OPTIONAL_FIELDS = [
|
|
14
|
+
['neverProvision', 'boolean'],
|
|
15
|
+
['requiredEnvironment', 'string'],
|
|
16
|
+
['requiredBranchPolicy', 'string'],
|
|
17
|
+
];
|
|
18
|
+
function entryProblem(entry) {
|
|
19
|
+
if (typeof entry !== 'object' || entry === null)
|
|
20
|
+
return 'must be an object';
|
|
21
|
+
return recordProblem(entry);
|
|
22
|
+
}
|
|
23
|
+
function recordProblem(record) {
|
|
24
|
+
if (typeof record.provisioned !== 'boolean')
|
|
25
|
+
return 'must have a boolean provisioned';
|
|
26
|
+
for (const [field, type] of OPTIONAL_FIELDS) {
|
|
27
|
+
if (record[field] !== undefined && typeof record[field] !== type) {
|
|
28
|
+
return `${field} must be a ${type}`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (record.neverProvision && record.provisioned) {
|
|
32
|
+
return 'neverProvision cannot be combined with provisioned: true';
|
|
33
|
+
}
|
|
34
|
+
if (record.neverProvision && (record.requiredEnvironment ?? record.requiredBranchPolicy)) {
|
|
35
|
+
return 'neverProvision cannot be combined with a required scope';
|
|
36
|
+
}
|
|
37
|
+
if (record.requiredEnvironment !== undefined && record.requiredBranchPolicy !== undefined) {
|
|
38
|
+
return 'requiredEnvironment and requiredBranchPolicy are mutually exclusive';
|
|
39
|
+
}
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* GitHub stores secret names upper-case and treats environment names case-insensitively, so
|
|
44
|
+
* names are compared as upper-case secrets and lower-case environments.
|
|
45
|
+
*/
|
|
46
|
+
export function normalizeInventory(inventory) {
|
|
47
|
+
const normalized = {};
|
|
48
|
+
for (const [name, entry] of Object.entries(inventory)) {
|
|
49
|
+
const { requiredEnvironment, requiredBranchPolicy } = entry;
|
|
50
|
+
if (Object.hasOwn(normalized, name.toUpperCase())) {
|
|
51
|
+
throw new Error(`inventory names collide after normalization: ${name}`);
|
|
52
|
+
}
|
|
53
|
+
normalized[name.toUpperCase()] = {
|
|
54
|
+
...entry,
|
|
55
|
+
...(requiredEnvironment === undefined
|
|
56
|
+
? {}
|
|
57
|
+
: { requiredEnvironment: requiredEnvironment.toLowerCase() }),
|
|
58
|
+
...(requiredBranchPolicy === undefined
|
|
59
|
+
? {}
|
|
60
|
+
: { requiredBranchPolicy: requiredBranchPolicy.toLowerCase() }),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return normalized;
|
|
64
|
+
}
|
|
65
|
+
/** Loads the named export of an inventory module (resolved against `cwd`) and checks its shape. */
|
|
66
|
+
export async function loadInventory(modulePath, exportName, cwd = process.cwd()) {
|
|
67
|
+
const loaded = (await import(__rewriteRelativeImportExtension(pathToFileURL(resolve(cwd, modulePath)).href)));
|
|
68
|
+
const inventory = loaded[exportName];
|
|
69
|
+
if (typeof inventory !== 'object' || inventory === null || Array.isArray(inventory)) {
|
|
70
|
+
throw new Error(`${modulePath} must export an object named ${exportName}`);
|
|
71
|
+
}
|
|
72
|
+
for (const [name, entry] of Object.entries(inventory)) {
|
|
73
|
+
const problem = entryProblem(entry);
|
|
74
|
+
if (problem !== undefined)
|
|
75
|
+
throw new Error(`${modulePath}: ${exportName}.${name} ${problem}`);
|
|
76
|
+
}
|
|
77
|
+
return inventory;
|
|
78
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EnvironmentDeploymentBranchPolicy, WorkflowSecretInventory } from './types.mts';
|
|
2
|
+
export declare function requiredEnvironmentNames(inventory: WorkflowSecretInventory): Set<string>;
|
|
3
|
+
export interface ScopeInput {
|
|
4
|
+
repositoryNames: ReadonlySet<string>;
|
|
5
|
+
environmentNames: ReadonlyMap<string, ReadonlySet<string>>;
|
|
6
|
+
organizationNames: ReadonlySet<string>;
|
|
7
|
+
environmentDeploymentBranchPolicies: ReadonlyMap<string, EnvironmentDeploymentBranchPolicy>;
|
|
8
|
+
/** The only branch a required environment may deploy from. */
|
|
9
|
+
deploymentBranch: string;
|
|
10
|
+
}
|
|
11
|
+
/** Names whose checked-in scope contract disagrees with the live secret metadata. */
|
|
12
|
+
export declare function requiredSecretScopeViolations(inventory: WorkflowSecretInventory, input: ScopeInput): string[];
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export function requiredEnvironmentNames(inventory) {
|
|
2
|
+
const names = new Set();
|
|
3
|
+
for (const entry of Object.values(inventory)) {
|
|
4
|
+
if (entry.requiredEnvironment !== undefined)
|
|
5
|
+
names.add(entry.requiredEnvironment);
|
|
6
|
+
if (entry.requiredBranchPolicy !== undefined)
|
|
7
|
+
names.add(entry.requiredBranchPolicy);
|
|
8
|
+
}
|
|
9
|
+
return names;
|
|
10
|
+
}
|
|
11
|
+
function permitsOnlyBranch(policy, branch) {
|
|
12
|
+
const [rule] = policy?.deploymentBranchRules ?? [];
|
|
13
|
+
return (policy?.protectedBranchesEnabled === false &&
|
|
14
|
+
policy.customBranchPoliciesEnabled &&
|
|
15
|
+
policy.deploymentBranchRules.length === 1 &&
|
|
16
|
+
rule?.name === branch &&
|
|
17
|
+
rule.type === 'branch');
|
|
18
|
+
}
|
|
19
|
+
/** Names whose checked-in scope contract disagrees with the live secret metadata. */
|
|
20
|
+
export function requiredSecretScopeViolations(inventory, input) {
|
|
21
|
+
const { repositoryNames, environmentNames, organizationNames } = input;
|
|
22
|
+
const violations = [];
|
|
23
|
+
const rejectOtherScopes = (name, keepEnvironment) => {
|
|
24
|
+
for (const [environment, names] of environmentNames) {
|
|
25
|
+
if (environment !== keepEnvironment && names.has(name)) {
|
|
26
|
+
violations.push(`${name} must not exist in environment ${environment}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (organizationNames.has(name)) {
|
|
30
|
+
violations.push(`${name} must not exist as an organization secret`);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
for (const [name, entry] of Object.entries(inventory)) {
|
|
34
|
+
if (entry.requiredEnvironment) {
|
|
35
|
+
if (entry.provisioned && !environmentNames.get(entry.requiredEnvironment)?.has(name)) {
|
|
36
|
+
violations.push(`${name} is missing from environment ${entry.requiredEnvironment}`);
|
|
37
|
+
}
|
|
38
|
+
if (repositoryNames.has(name))
|
|
39
|
+
violations.push(`${name} must not exist as a repository secret`);
|
|
40
|
+
rejectOtherScopes(name, entry.requiredEnvironment);
|
|
41
|
+
}
|
|
42
|
+
else if (entry.requiredBranchPolicy) {
|
|
43
|
+
if (entry.provisioned && !repositoryNames.has(name)) {
|
|
44
|
+
violations.push(`${name} is missing from repository secrets`);
|
|
45
|
+
}
|
|
46
|
+
rejectOtherScopes(name, undefined);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
for (const environment of requiredEnvironmentNames(inventory)) {
|
|
50
|
+
const policy = input.environmentDeploymentBranchPolicies.get(environment);
|
|
51
|
+
if (!permitsOnlyBranch(policy, input.deploymentBranch)) {
|
|
52
|
+
violations.push(`environment ${environment} must permit deployments from only ${input.deploymentBranch}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return violations;
|
|
56
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const errorMessage: (error: unknown) => string;
|
|
2
|
+
/** `Promise.allSettled` over `items` with at most `limit` mappers in flight; results keep input order. */
|
|
3
|
+
export declare function settleLimited<T, R>(items: readonly T[], limit: number, mapper: (item: T) => Promise<R>): Promise<PromiseSettledResult<R>[]>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const errorMessage = (error) => error instanceof Error ? error.message : String(error);
|
|
2
|
+
/** `Promise.allSettled` over `items` with at most `limit` mappers in flight; results keep input order. */
|
|
3
|
+
export async function settleLimited(items, limit, mapper) {
|
|
4
|
+
const results = Array.from({ length: items.length });
|
|
5
|
+
let next = 0;
|
|
6
|
+
const worker = async () => {
|
|
7
|
+
while (next < items.length) {
|
|
8
|
+
const index = next++;
|
|
9
|
+
try {
|
|
10
|
+
results[index] = { status: 'fulfilled', value: await mapper(items[index]) };
|
|
11
|
+
}
|
|
12
|
+
catch (reason) {
|
|
13
|
+
results[index] = { status: 'rejected', reason };
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));
|
|
18
|
+
return results;
|
|
19
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { SecretInventoryEntry } from '../workflow-policy/secret-readiness.mts';
|
|
2
|
+
/**
|
|
3
|
+
* One inventory entry. Extends the readiness inventory entry with the optional drift and scope
|
|
4
|
+
* contracts. Only secret names and presence are ever read; values never leave the secret store.
|
|
5
|
+
*/
|
|
6
|
+
export interface WorkflowSecretInventoryEntry extends SecretInventoryEntry {
|
|
7
|
+
/** Secret must live only in this environment, never as a repository, other-environment or organization secret. */
|
|
8
|
+
readonly requiredEnvironment?: string;
|
|
9
|
+
/** Environment kept only for its deployment-branch gate while the secret itself is repository scoped. */
|
|
10
|
+
readonly requiredBranchPolicy?: string;
|
|
11
|
+
/** Contract-only placeholder name that must never become a real secret. */
|
|
12
|
+
readonly neverProvision?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export type WorkflowSecretInventory = Readonly<Record<string, WorkflowSecretInventoryEntry>>;
|
|
15
|
+
export interface DeploymentBranchRule {
|
|
16
|
+
name: string;
|
|
17
|
+
type: string;
|
|
18
|
+
}
|
|
19
|
+
export interface EnvironmentDeploymentBranchPolicy {
|
|
20
|
+
protectedBranchesEnabled: boolean;
|
|
21
|
+
customBranchPoliciesEnabled: boolean;
|
|
22
|
+
deploymentBranchRules: DeploymentBranchRule[];
|
|
23
|
+
}
|
|
24
|
+
/** Live secret-store reads. Every method returns names or metadata, never secret values. */
|
|
25
|
+
export interface WorkflowSecretsDependencies {
|
|
26
|
+
resolveRepo: () => Promise<string>;
|
|
27
|
+
listRepoSecretNames: (repo: string) => Promise<string[]>;
|
|
28
|
+
listRepositoryOwnerType: (repo: string) => Promise<string>;
|
|
29
|
+
listRepositoryOrganizationSecretNames: (repo: string) => Promise<string[]>;
|
|
30
|
+
listEnvironmentNames: (repo: string) => Promise<string[]>;
|
|
31
|
+
listEnvironmentSecretNames: (repo: string, environment: string) => Promise<string[]>;
|
|
32
|
+
getEnvironmentDeploymentBranchPolicy: (repo: string, environment: string) => Promise<EnvironmentDeploymentBranchPolicy>;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|