@argos-ci/core 6.8.4 → 6.8.5

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/dist/index.mjs +25 -4
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -17,6 +17,24 @@ import tmp from "tmp";
17
17
  //#region src/debug.ts
18
18
  const KEY = "@argos-ci/core";
19
19
  const debug = createDebug(KEY);
20
+ /**
21
+ * Leading characters of a token kept in the debug output: enough to tell two
22
+ * tokens apart, far too few to use.
23
+ */
24
+ const TOKEN_PREVIEW_LENGTH = 6;
25
+ /**
26
+ * Show which token is in play without publishing it.
27
+ *
28
+ * Debug output is the documented way to report an upload problem: it gets
29
+ * pasted into public issues and written to CI logs, which are world-readable on
30
+ * public repositories, so a token printed in full is a published token
31
+ * (GHSA-28pg-v3hp-9g7f). The first few characters answer "is that the token I
32
+ * think it is?" and are useless to anyone else.
33
+ */
34
+ function maskToken(token) {
35
+ if (!token) return token;
36
+ return `${token.slice(0, TOKEN_PREVIEW_LENGTH)}…`;
37
+ }
20
38
  const isDebugEnabled = createDebug.enabled(KEY);
21
39
  const debugTime = (arg) => {
22
40
  if (isDebugEnabled) console.time(arg);
@@ -958,7 +976,7 @@ function listAncestorCommits(input) {
958
976
  */
959
977
  async function getCiEnvironment() {
960
978
  const context = createContext();
961
- debug("Detecting CI environment", context);
979
+ debug("Detecting CI environment");
962
980
  const service = getCiService(context);
963
981
  if (service) {
964
982
  debug("Internal service matched", service.name);
@@ -971,6 +989,7 @@ async function getCiEnvironment() {
971
989
  debug("CI environment", ciEnvironment);
972
990
  return ciEnvironment;
973
991
  }
992
+ debug("No CI service matched");
974
993
  return null;
975
994
  }
976
995
  //#endregion
@@ -1460,7 +1479,7 @@ async function exchangeGitHubActionsTokenlessToken(args) {
1460
1479
  */
1461
1480
  async function resolveArgosToken(config) {
1462
1481
  if (config.token) {
1463
- debug("Authenticated with ARGOS_TOKEN.");
1482
+ debug(`Authenticated with ARGOS_TOKEN (${maskToken(config.token)}).`);
1464
1483
  return config.token;
1465
1484
  }
1466
1485
  if (isGitHubActionsOidcAvailable()) {
@@ -2211,7 +2230,8 @@ const PLAYWRIGHT_TRACE_CONTENT_TYPE = "application/zip";
2211
2230
  * Upload screenshots to Argos.
2212
2231
  */
2213
2232
  async function upload(params) {
2214
- debug("Starting upload with params", params);
2233
+ const { token: _paramsToken, ...debugParams } = params;
2234
+ debug("Starting upload with params", debugParams);
2215
2235
  const [config, argosSdk] = await Promise.all([getConfigFromOptions(params), getArgosCoreSDKIdentifier()]);
2216
2236
  const authToken = await resolveArgosToken(config);
2217
2237
  const apiClient = createClient({
@@ -2227,7 +2247,8 @@ async function upload(params) {
2227
2247
  }
2228
2248
  const previewUrlFormatter = params.previewUrl ?? (config.previewBaseUrl ? { baseUrl: config.previewBaseUrl } : void 0);
2229
2249
  const globs = params.files ?? ["**/*.{png,jpg,jpeg}"];
2230
- debug("Using config and files", config, globs);
2250
+ const { token: _configToken, ...debugConfig } = config;
2251
+ debug("Using config and files", debugConfig, globs);
2231
2252
  const files = await discoverSnapshots(globs, {
2232
2253
  root: params.root,
2233
2254
  ignore: params.ignore
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@argos-ci/core",
3
3
  "description": "Node.js SDK for visual testing with Argos.",
4
- "version": "6.8.4",
4
+ "version": "6.8.5",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
@@ -68,5 +68,5 @@
68
68
  "lint": "eslint .",
69
69
  "test": "vitest"
70
70
  },
71
- "gitHead": "212ed2c37ce532dd32c87ac685b55e2ab6e154c4"
71
+ "gitHead": "18b61fb04ed2502c5018eb42a521ec358bef194e"
72
72
  }