@rbbtsn0w/adg 0.6.0-beta.3 → 0.6.0-beta.4
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/dist/bin/adg.js +0 -1
- package/dist/src/sources.js +1 -1
- package/dist/src/telemetry.js +28 -21
- package/package.json +1 -1
package/dist/bin/adg.js
CHANGED
|
@@ -104,7 +104,6 @@ async function main(argv) {
|
|
|
104
104
|
let status = 0;
|
|
105
105
|
try {
|
|
106
106
|
span.setAttribute("process.executable.name", "adg");
|
|
107
|
-
span.setAttribute("process.executable.path", process.argv[1] || process.execPath);
|
|
108
107
|
span.setAttribute("process.pid", process.pid);
|
|
109
108
|
span.setAttribute("process.command_args", sanitizeArgs(["adg", ...argv]));
|
|
110
109
|
// Check for an available update (reads local cache; schedules a background
|
package/dist/src/sources.js
CHANGED
|
@@ -90,7 +90,7 @@ export function cloneGitHub(src, dest, opts = {}) {
|
|
|
90
90
|
}
|
|
91
91
|
return dest;
|
|
92
92
|
}
|
|
93
|
-
const defaultGitRunner = (args) => {
|
|
93
|
+
export const defaultGitRunner = (args) => {
|
|
94
94
|
const tracer = getTracer();
|
|
95
95
|
return tracer.startActiveSpan("git", { kind: SpanKind.CLIENT }, (span) => {
|
|
96
96
|
try {
|
package/dist/src/telemetry.js
CHANGED
|
@@ -50,32 +50,39 @@ export async function shutdownTelemetry() {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Unconditionally redact any non-empty string passed to it.
|
|
55
|
+
* Telemetry consumers need the command skeleton (subcommands + flags),
|
|
56
|
+
* not path details. Returning a fixed placeholder eliminates all
|
|
57
|
+
* path-related privacy edge cases.
|
|
58
|
+
*/
|
|
59
|
+
export function sanitizePath(path) {
|
|
60
|
+
if (!path)
|
|
61
|
+
return "";
|
|
62
|
+
return "[PATH]";
|
|
63
|
+
}
|
|
53
64
|
export function sanitizeArgs(args) {
|
|
54
65
|
return args.map((arg) => {
|
|
55
|
-
if (arg.startsWith("
|
|
56
|
-
arg.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
arg.startsWith("
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
if (arg.includes("@") && (arg.startsWith("http://") || arg.startsWith("https://"))) {
|
|
64
|
-
try {
|
|
65
|
-
const url = new URL(arg);
|
|
66
|
-
if (url.username) {
|
|
67
|
-
url.username = "[REDACTED]";
|
|
68
|
-
}
|
|
69
|
-
if (url.password) {
|
|
70
|
-
url.password = "[REDACTED]";
|
|
71
|
-
}
|
|
72
|
-
return url.toString();
|
|
66
|
+
if (arg.startsWith("-")) {
|
|
67
|
+
const eqIndex = arg.indexOf("=");
|
|
68
|
+
if (eqIndex !== -1) {
|
|
69
|
+
return `${arg.slice(0, eqIndex)}=[VALUE]`;
|
|
70
|
+
}
|
|
71
|
+
if (arg.startsWith("--") && /^--[a-zA-Z0-9-]+$/.test(arg)) {
|
|
72
|
+
return arg;
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
return
|
|
74
|
+
if (/^-[a-zA-Z0-9]$/.test(arg)) {
|
|
75
|
+
return arg;
|
|
76
76
|
}
|
|
77
|
+
if (/^-[a-zA-Z0-9]/.test(arg)) {
|
|
78
|
+
return `${arg.slice(0, 2)}[VALUE]`;
|
|
79
|
+
}
|
|
80
|
+
return "[VALUE]";
|
|
81
|
+
}
|
|
82
|
+
if (/^[a-z]+(-[a-z]+)*$/.test(arg) || /^[0-9]+$/.test(arg)) {
|
|
83
|
+
return arg;
|
|
77
84
|
}
|
|
78
|
-
return
|
|
85
|
+
return "[VALUE]";
|
|
79
86
|
});
|
|
80
87
|
}
|
|
81
88
|
/** Record a privacy-safe event without allowing telemetry to affect CLI behavior. */
|