From be9b34e3dcf7010364322c5b51f633abcebc90db Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Sat, 28 Nov 2026 12:04:07 -0500 Subject: [PATCH] The secrets check stops reading camelCase run ids as phone numbers (#4861) (#4881) The secrets check no longer reports an 11-digit GitHub Actions run id as a phone number when code names it `runId`, `RunGithubID` or passes it to a run call such as `resolveRunDetection(...)`. Why: Go and TypeScript test fixtures tripped a phone-number finding, and `gstack-post` asked for confirmation on PR bodies that quoted them. Nothing to do; every number the check reported before still reports. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/red-team#1 reader=red-team Review-Finding: p1/red-team#2 reader=red-team Review-Finding: p2/outside-voice#1 reader=outside-voice Review-Finding: p2/outside-voice#2 reader=outside-voice Review-Finding: p2/red-team#1 reader=red-team Review-Finding: p2/adversarial-native#1 reader=adversarial-native Review-Finding: p2/adversarial-native#3 reader=adversarial-native --- .../redact-camelcase-run-id-identifiers.md | 1 + docs/troubleshooting.md | 10 +++ lib/redact-patterns.ts | 38 ++++++++++- test/redact-context-exemptions.test.ts | 64 +++++++++++++++++++ 4 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 changelog.d/redact-camelcase-run-id-identifiers.md diff --git a/changelog.d/redact-camelcase-run-id-identifiers.md b/changelog.d/redact-camelcase-run-id-identifiers.md new file mode 100644 index 000000000..d344c0955 --- /dev/null +++ b/changelog.d/redact-camelcase-run-id-identifiers.md @@ -0,0 +1 @@ +**The secrets check no longer reports an 11-digit GitHub Actions run id as a phone number when code names it with a camelCase run identifier** such as `runId: `, `RunGithubID: ` or `resolveRunDetection(t, db, d, , ...)` (#4861). Everything the check reported before still reports, including a plain `"run": ` in JSON, a phone-named key such as `phoneRun` or `contactRunId`, an id with more text after it in the same value, and any number that isn't exactly 11 digits. diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index d9559b6c8..7d26dc6c9 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -3203,6 +3203,16 @@ exact tokens it finds in these positions: check accept it too, not only `gstack-post`. A national number written without its `+` right after a run word reads as a run id there; that is the accepted residual of the ruling that a run id is not a phone number; +- an 11-digit id that is the whole value of a key or assignment named by a + camelCase run identifier (`runId: `, `RunGithubID: `, + `workflowRunID = `, `lastRun := `), or an argument of a call whose + name ends in `Run` plus `Id`, `Detection`, `Status`, `Result`, `Attempt`, + `Log`, `Job` or `Artifact` after only plain identifier arguments + (`resolveRunDetection(t, db, d, , ...)`). The scanner itself exempts it + (`isCiRunIdentifier`). A plain `"run": ` key, `runner` or `brunId`, an + id with more text after it in the same value, and any line with a phone word + (`phone`, `tel`, `mobile`, `cell`, `contact`, `call`, …) within 80 + characters of the id still report (#4861); - every 11-digit id chained after an allowlisted one through `, `, ` and `, ` & `, ` or ` or ` / `, optionally with a `(#1234)` between (`screen 40269992077 (#3434) and 40275443393 (#3453)`); diff --git a/lib/redact-patterns.ts b/lib/redact-patterns.ts index ba06396f4..3978cb599 100644 --- a/lib/redact-patterns.ts +++ b/lib/redact-patterns.ts @@ -453,20 +453,56 @@ export function isNumericMetadataValue(span: string, match: RegExpExecArray): bo * owner's ruling that a run id is not a phone number; gstack-post's chained-id * allowlist reads the same position the same way. The same digits anywhere * else still report. + * + * Code names the run with a camelCase identifier instead (#4861), so an + * 11-digit id also counts as the whole value of a key or assignment named by + * a compound run identifier: Run after a lowercase letter or digit, optionally + * followed by Id/ID or GithubId/GitHubID/ActionsId/WorkflowId (`lastRun := `, + * `RunGithubID: ` inside a struct, `workflowRunID = `), or run/Run + * starting the name with one of those Id endings (`runId: `); or as an + * argument of a call whose name ends in Run plus Id, Detection, Status, + * Result, Attempt, Log, Job or Artifact, after only plain identifier + * arguments (`resolveRunDetection(t, db, d, ,`). A plain `run` key is + * left to the run-word rule above, so a quoted JSON `"run": ` still + * reports. The id must end the value (a closing quote matching an opening + * one, else the line end, a space, `,`, `;`, `)`, `}` or `]`), so + * `runId: '-'` reports. `runner`, `brunId` and `myRunnerPhone` + * exempt nothing, and neither does a phone word anywhere on the line within + * 80 characters either side of the id, read as a substring of the lowercased + * text (phone, tel, mobile, cell, fax, sms, contact, msisdn, whatsapp, call, + * dial: `phoneRun`, `cellphoneRunId`, `user.phone.lastRun`, + * `"phone-lastRunId"`, `resolveRunDetection(t, phone, `, + * `lastRun = ; // mobile`), nor a key or call whose name the + * 80-character window cuts off, since the cut part could hold one. */ const CI_ID_POSITION_BEFORE = /(?:--(?:run|job)(?:-id)?(?:[ \t]+|[ \t]*=[ \t]*)|\bgh[ \t]+run[ \t]+(?:view|watch|rerun|download|cancel)[ \t]+|(?:^|[\s\/(\[<"'])actions\/runs\/|\/jobs?\/|(?:run|job)_id["']?[ \t]*[:=][ \t]*["']?)$/i; const CI_RUN_LIST = /(? lineStart)))) return true; const line = input.slice(lineStart, lineEnd < 0 ? input.length : lineEnd); const at = start - lineStart; return [...line.matchAll(CI_RUN_LIST)].some(m => m.index! < at && at + span.length <= m.index! + m[0].length); diff --git a/test/redact-context-exemptions.test.ts b/test/redact-context-exemptions.test.ts index db10673c3..787f29569 100644 --- a/test/redact-context-exemptions.test.ts +++ b/test/redact-context-exemptions.test.ts @@ -462,6 +462,70 @@ describe("pii.phone.e164: GitHub Actions run and job ids in their id positions", ); }); +// #4861: Go and TypeScript fixtures name the run id with a camelCase identifier, not a plain run word. +describe("pii.phone.e164: an 11-digit run id after a camelCase run identifier (#4861)", () => { + table( + "pii.phone.e164", + "MEDIUM", + [ + "\tRunGithubID: 12345678901,", + " runId: 12345678901,", + "\tresolveRunDetection(t, db, d, 12345678901, createdAt)", + '{"runId":38969924945,"pr":3225}', + "const workflowRunID = 40477638211;", + "lastRun := 40477638211", + "RunGitHubId: 40477638211", + "s.getRunStatus(ctx, 40477638211)", + ], + [ + // A phone-shaped value under a phone-named key, or a Run that is not a whole camelCase word, still reports. + "userPhone: 14155551234", + "phoneNumber: 14155551234", + "myRunnerPhone: 14155551234", + "callRunPhone: 14155551234", + "runPhone: 14155551234", + "RunTel: 14155551234", + "runMobile = 14155551234", + "runContact: 14155551234", + "phoneRun: 14155551234", + "contactRunId: 14155551234", + "cellphoneRunId: 14155551234", + "homephoneRun = 14155551234", + "msisdnRunId: 14155551234", + // A phone word in a quoted, hyphenated or dotted key, a receiver, an outer call or a trailing comment still reports. + "mobile-lastRun: 14155551234", + '{"phone-lastRunId": 14155551234}', + "user.phone.lastRun = 14155551234", + "customer.contact.workflowRunId = 14155551234", + "phone.getRunLogs(14155551234)", + "phoneApi.getRunLogs(ctx, 14155551234)", + "dialPhone(getRunStatus(c, 14155551234))", + "const lastRun = 14155551234; // mom's mobile", + "runner: 14155551234", + "rerunnerId: 14155551234", + "brunId: 14155551234", + // A call that only mentions a run, or passes a phone-named argument, still reports. + "callRun(14155551234)", + "sendRunNotification(user, 14155551234)", + "resolveRunDetection(t, phone, 14155551234)", + "resolveRunDetection(t, db, \"x\", 14155551234)", + // A call name the 80-character window cuts off could hide a phone word in the cut part. + "phoneRunStatus(alphaBetaGammaDeltaArg1, alphaBetaGammaDeltaArg2, alphaBetaGamma3, 14155551234)", + // Separated from the identifier, not 11 digits, or written with a + or separators. + "runId: 1, phone: 14155551234", + "runId 14155551234", + "runId: 4155550123", + "runId: +14155551234", + "runId: 1-415-555-1234", + // A plain run key in quoted JSON stays with the run-word rule, and the id must be the whole value. + '{"run": 14155551234}', + "runId: '14155551234-20261109173601'", + '"sourceRun": "14155551234 slice 4"', + "lastRun = 14155551234/2", + ], + ); +}); + describe("pii.phone.e164: run ids in a runs= list or an actions/runs/ path (GST-1227)", () => { table( "pii.phone.e164",