From 3d05326dd3e7e9239d0f14a1b85b409f7875a8b9 Mon Sep 17 00:00:00 2001 From: Daniel Szoke Date: Thu, 1 Aug 2024 16:31:49 +0200 Subject: [PATCH] test(tokens): Add test to ensure tokens redacted The test ensures that when the CLI args are echoed back, anything which might reasonably be an auth token is redacted. --- tests/integration/_cases/token-redacted.trycmd | 9 +++++++++ tests/integration/mod.rs | 5 +++++ 2 files changed, 14 insertions(+) create mode 100644 tests/integration/_cases/token-redacted.trycmd diff --git a/tests/integration/_cases/token-redacted.trycmd b/tests/integration/_cases/token-redacted.trycmd new file mode 100644 index 0000000000..f7cacc3d80 --- /dev/null +++ b/tests/integration/_cases/token-redacted.trycmd @@ -0,0 +1,9 @@ +``` +$ sentry-cli sourcemaps upload --auth-token not-following-token-format -o asdf -p sntrys_project_looks_like_token ./ --log-level=info +? failed +[..] +[..] +[..]INFO[..] sentry-cli was invoked with the following command line: "[..]" "sourcemaps" "upload" "--auth-token" (redacted) "-o" "asdf" "-p" (redacted) "./" "--log-level=info" +... + +``` diff --git a/tests/integration/mod.rs b/tests/integration/mod.rs index a5628fafab..5f73a6ffab 100644 --- a/tests/integration/mod.rs +++ b/tests/integration/mod.rs @@ -235,3 +235,8 @@ pub fn assert_endpoints(mocks: &[Mock]) { mock.assert(); } } + +#[test] +pub fn token_redacted() { + register_test("token-redacted.trycmd"); +}