@oxagen/cli 5.5.1-147 → 5.5.1-155

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.
Files changed (2) hide show
  1. package/oxagen.mjs +93 -11
  2. package/package.json +1 -1
package/oxagen.mjs CHANGED
@@ -32034,7 +32034,7 @@ import { readFileSync as readFileSync11 } from "node:fs";
32034
32034
  import { dirname as dirname14, resolve as resolve3 } from "node:path";
32035
32035
  import { fileURLToPath } from "node:url";
32036
32036
  function readVersion() {
32037
- if (true) return "5.5.1-147";
32037
+ if (true) return "5.5.1-155";
32038
32038
  try {
32039
32039
  const here = dirname14(fileURLToPath(import.meta.url));
32040
32040
  const pkg = JSON.parse(
@@ -78060,7 +78060,7 @@ var init_package = __esm({
78060
78060
  "package.json"() {
78061
78061
  package_default = {
78062
78062
  name: "@oxagen/cli",
78063
- version: "5.5.1-147",
78063
+ version: "5.5.1-155",
78064
78064
  description: "Oxagen governance CLI: spend, source tracking, grounding, credentials, and audit (agentic coding lives in the stella CLI)",
78065
78065
  type: "module",
78066
78066
  main: "./dist/index.js",
@@ -110603,6 +110603,44 @@ var init_codegraph_settings = __esm({
110603
110603
  }
110604
110604
  });
110605
110605
 
110606
+ // ../../packages/oxagen/src/steering-repo/company-email-domains.ts
110607
+ var CONSUMER_MAIL_DOMAINS, CONSUMER, DOMAIN, companyEmailDomainSchema;
110608
+ var init_company_email_domains = __esm({
110609
+ "../../packages/oxagen/src/steering-repo/company-email-domains.ts"() {
110610
+ "use strict";
110611
+ init_zod();
110612
+ init_json_schema();
110613
+ CONSUMER_MAIL_DOMAINS = [
110614
+ "aol.com",
110615
+ "gmail.com",
110616
+ "gmx.com",
110617
+ "googlemail.com",
110618
+ "hotmail.com",
110619
+ "icloud.com",
110620
+ "live.com",
110621
+ "mail.com",
110622
+ "me.com",
110623
+ "msn.com",
110624
+ "outlook.com",
110625
+ "proton.me",
110626
+ "protonmail.com",
110627
+ "qq.com",
110628
+ "yahoo.com",
110629
+ "yandex.com",
110630
+ "zoho.com"
110631
+ ];
110632
+ CONSUMER = new Set(CONSUMER_MAIL_DOMAINS);
110633
+ DOMAIN = /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/;
110634
+ companyEmailDomainSchema = withJsonSchema(
110635
+ external_exports.string().max(253).regex(DOMAIN, "a domain name in lower case, such as example.com").refine(
110636
+ (domain) => !CONSUMER.has(domain),
110637
+ "a mail domain anyone can sign up for would pass every address there"
110638
+ ),
110639
+ { not: { enum: [...CONSUMER_MAIL_DOMAINS] } }
110640
+ );
110641
+ }
110642
+ });
110643
+
110606
110644
  // ../../packages/oxagen/src/steering-repo/delivery.ts
110607
110645
  function toolMentionText(name2, modes) {
110608
110646
  const ref = parseToolRef(name2);
@@ -110668,6 +110706,14 @@ var init_delivery = __esm({
110668
110706
  });
110669
110707
 
110670
110708
  // ../../packages/oxagen/src/steering-repo/governance.ts
110709
+ function companyEmailDomainsOf(file) {
110710
+ return [...file.personal_data?.company_email_domains ?? []];
110711
+ }
110712
+ function companyEmailDomainsInToml(text6) {
110713
+ if (text6 === null) return [];
110714
+ const read2 = readTomlFile(text6, "governance/v1", governanceSchema);
110715
+ return read2.ok ? companyEmailDomainsOf(read2.value) : [];
110716
+ }
110671
110717
  var ledgerRotationSchema, governanceSchema, ALWAYS_ON_TOKENS_SETTING, MEMORY_HALF_LIFE_SETTING, STEERING_OVER_BUDGET_SETTING;
110672
110718
  var init_governance = __esm({
110673
110719
  "../../packages/oxagen/src/steering-repo/governance.ts"() {
@@ -110678,6 +110724,8 @@ var init_governance = __esm({
110678
110724
  init_settings_bag();
110679
110725
  init_workspace_settings();
110680
110726
  init_common2();
110727
+ init_company_email_domains();
110728
+ init_files2();
110681
110729
  init_json_schema();
110682
110730
  init_paths2();
110683
110731
  init_tokens();
@@ -110708,6 +110756,14 @@ var init_governance = __esm({
110708
110756
  ),
110709
110757
  auto_merge: external_exports.boolean().optional().describe("Allowed in solo mode only.")
110710
110758
  }).strict().optional(),
110759
+ personal_data: external_exports.object({
110760
+ company_email_domains: uniqueArray(
110761
+ companyEmailDomainSchema,
110762
+ "company_email_domains"
110763
+ ).optional().describe(
110764
+ "The email domains the company owns. A steering record may name an address at one of them or at one of its subdomains, such as contact@example.com. A domain counts only when an Owner of the organization has a verified account email at exactly that domain. Every other address fails the secret and personal-data check."
110765
+ )
110766
+ }).strict().optional(),
110711
110767
  reviewers: external_exports.array(
110712
110768
  external_exports.object({
110713
110769
  paths: external_exports.array(external_exports.string().min(1)).min(1),
@@ -111686,6 +111742,7 @@ var init_steering_repo = __esm({
111686
111742
  init_bundle4();
111687
111743
  init_codegraph_settings();
111688
111744
  init_common2();
111745
+ init_company_email_domains();
111689
111746
  init_delivery();
111690
111747
  init_files2();
111691
111748
  init_governance();
@@ -113748,9 +113805,19 @@ function isSecretToken(token) {
113748
113805
  }
113749
113806
  return isJwt(token) || isHighEntropyBlob(token);
113750
113807
  }
113751
- function hasPersonalEmail(text6) {
113808
+ function isCompanyDomain(domain, owned) {
113809
+ const name2 = domain.toLowerCase();
113810
+ return owned.some((entry2) => {
113811
+ const own = entry2.toLowerCase();
113812
+ return own !== "" && (name2 === own || name2.endsWith(`.${own}`));
113813
+ });
113814
+ }
113815
+ function hasPersonalEmail(text6, owned) {
113752
113816
  for (const m of text6.matchAll(EMAIL)) {
113753
- if (!SERVICE_ACCOUNT_DOMAIN.test(m[1])) return true;
113817
+ const domain = m[1];
113818
+ if (SERVICE_ACCOUNT_DOMAIN.test(domain)) continue;
113819
+ if (isCompanyDomain(domain, owned)) continue;
113820
+ return true;
113754
113821
  }
113755
113822
  return false;
113756
113823
  }
@@ -113768,7 +113835,7 @@ function luhn(digits2) {
113768
113835
  }
113769
113836
  return sum3 % 10 === 0;
113770
113837
  }
113771
- function findSecretsAndPii(text6) {
113838
+ function findSecretsAndPii(text6, options = {}) {
113772
113839
  const findings = [];
113773
113840
  if (/-----BEGIN [A-Z ]*PRIVATE KEY-----/.test(text6))
113774
113841
  findings.push("private key block");
@@ -113786,7 +113853,8 @@ function findSecretsAndPii(text6) {
113786
113853
  break;
113787
113854
  }
113788
113855
  }
113789
- if (hasPersonalEmail(text6)) findings.push("email address");
113856
+ if (hasPersonalEmail(text6, options.companyEmailDomains ?? []))
113857
+ findings.push("email address");
113790
113858
  if (/\b\d{3}-\d{2}-\d{4}\b/.test(text6))
113791
113859
  findings.push("US social security number");
113792
113860
  for (const m of text6.matchAll(/\b(?:\d[ -]?){13,19}\b/g)) {
@@ -113909,16 +113977,29 @@ function describe6(label) {
113909
113977
  fix: PERSONAL_FIX
113910
113978
  };
113911
113979
  }
113912
- function firstLines(text6, labels) {
113980
+ function firstLines(text6, labels, options) {
113913
113981
  const found = /* @__PURE__ */ new Map();
113914
113982
  for (const [index, line] of text6.split("\n").entries()) {
113915
- for (const label of findSecretsAndPii(line)) {
113983
+ for (const label of findSecretsAndPii(line, options)) {
113916
113984
  if (labels.has(label) && !found.has(label)) found.set(label, index + 1);
113917
113985
  }
113918
113986
  if (found.size === labels.size) break;
113919
113987
  }
113920
113988
  return found;
113921
113989
  }
113990
+ function listedDomains(tree) {
113991
+ return companyEmailDomainsInToml(tree.get(GOVERNANCE_TOML_PATH) ?? null);
113992
+ }
113993
+ function scanOptions(tree, env) {
113994
+ const own = listedDomains(tree);
113995
+ const production = env.base === null ? null : new Set(listedDomains(env.base));
113996
+ const owners = env.context.ownerEmailDomains === void 0 ? null : new Set(env.context.ownerEmailDomains);
113997
+ return {
113998
+ companyEmailDomains: own.filter(
113999
+ (domain) => (production === null || production.has(domain)) && (owners === null || owners.has(domain))
114000
+ )
114001
+ };
114002
+ }
113922
114003
  var find10, OXAGEN_WRITES2, LOCK_KIND, SANDBOX_SERVICE_KIND, CREDENTIAL_FIX, PERSONAL_FIX, PERSONAL2, secretsCheck;
113923
114004
  var init_secrets3 = __esm({
113924
114005
  "../../packages/steering-check/src/checks/secrets.ts"() {
@@ -113937,16 +114018,17 @@ var init_secrets3 = __esm({
113937
114018
  "US social security number": "a US social security number",
113938
114019
  "payment card number": "a payment card number"
113939
114020
  };
113940
- secretsCheck = (tree) => {
114021
+ secretsCheck = (tree, env) => {
113941
114022
  const findings = [];
114023
+ const options = scanOptions(tree, env);
113942
114024
  for (const [path2, text6] of tree) {
113943
114025
  const kind = classifySteeringRepoPath(path2);
113944
114026
  if (OXAGEN_WRITES2.has(kind)) continue;
113945
114027
  const labels = new Set(
113946
- findSecretsAndPii(text6).filter((label) => !skipped(kind, label))
114028
+ findSecretsAndPii(text6, options).filter((label) => !skipped(kind, label))
113947
114029
  );
113948
114030
  if (labels.size === 0) continue;
113949
- const lines = firstLines(text6, labels);
114031
+ const lines = firstLines(text6, labels, options);
113950
114032
  for (const label of labels) {
113951
114033
  const described2 = describe6(label);
113952
114034
  if (kind === LOCK_KIND && described2.rule !== "credential") continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxagen/cli",
3
- "version": "5.5.1-147",
3
+ "version": "5.5.1-155",
4
4
  "description": "Oxagen governance CLI: spend, source tracking, grounding, credentials, and audit (agentic coding lives in the stella CLI)",
5
5
  "type": "module",
6
6
  "bin": {