Skip to content

Commit 43460ef

Browse files
fix(security): Reduct sensitive data from Maestro logs (#4872)
Co-authored-by: Krystof Woldrich <31292499+krystofwoldrich@users.noreply.github.com>
1 parent a1082c0 commit 43460ef

File tree

2 files changed

+31
-12
lines changed

2 files changed

+31
-12
lines changed

.github/workflows/e2e.yml renamed to .github/workflows/e2e-v2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: End-to-End Tests
1+
name: End-to-End Tests V2
22

33
on:
44
push:

dev-packages/e2e-tests/cli.mjs

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -234,16 +234,35 @@ if (actions.includes('test')) {
234234
if (!sentryAuthToken) {
235235
console.log('Skipping maestro test due to unavailable or empty SENTRY_AUTH_TOKEN');
236236
} else {
237-
execSync(
238-
`maestro test maestro \
239-
--env=APP_ID="${appId}" \
240-
--env=SENTRY_AUTH_TOKEN="${sentryAuthToken}" \
241-
--debug-output maestro-logs \
242-
--flatten-debug-output`,
243-
{
244-
stdio: 'inherit',
245-
cwd: e2eDir,
246-
},
247-
);
237+
try {
238+
execSync(
239+
`maestro test maestro \
240+
--env=APP_ID="${appId}" \
241+
--env=SENTRY_AUTH_TOKEN="${sentryAuthToken}" \
242+
--debug-output maestro-logs \
243+
--flatten-debug-output`,
244+
{
245+
stdio: 'inherit',
246+
cwd: e2eDir,
247+
},
248+
);
249+
} finally {
250+
// Always redact sensitive data, even if the test fails
251+
const redactScript = `
252+
if [[ "$(uname)" == "Darwin" ]]; then
253+
find ./maestro-logs -type f -exec sed -i '' "s/${sentryAuthToken}/[REDACTED]/g" {} +
254+
echo 'Redacted sensitive data from logs on MacOS'
255+
else
256+
find ./maestro-logs -type f -exec sed -i "s/${sentryAuthToken}/[REDACTED]/g" {} +
257+
echo 'Redacted sensitive data from logs on Ubuntu'
258+
fi
259+
`;
260+
261+
try {
262+
execSync(redactScript, { stdio: 'inherit', cwd: e2eDir, shell: '/bin/bash' });
263+
} catch (error) {
264+
console.warn('Failed to redact sensitive data from logs:', error.message);
265+
}
266+
}
248267
}
249268
}

0 commit comments

Comments
 (0)