MemberJunction / MemberJunction/MJ

DropboxFileStorage: unconditional debug block adds an API call, 13 log lines and logs the account email on every ListObjects

Open Beginner friendly
#4,440 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TSQL
Stars
29
Forks
6
Avg merge
2d 1h
Merged PRs (30d)
323

Description

## Problem

`DropboxFileStorage.ListObjects` (lines 799–927) runs an unconditional debug block on **every** call:

```ts
// Debug: Try to get current account info to understand access type
try {
const accountInfo = await this._client.usersGetCurrentAccount();
console.log('[DropboxFileStorage] Account info:', {
accountId: accountInfo.result.account_id,
email: accountInfo.result.email, // PII, every call
name: accountInfo.result.name.display_name,
});
} catch (error) { ... }
```

Measured inside that one method:

| per `ListObjects` call | count |
|---|---|
| extra Dropbox API round-trips | 1 (`usersGetCurrentAccount`) |
| `console.log` statements | 13 |
| account email written to logs | 1 |

There is **no** debug/verbosity gate anywhere in the file — grepping for `DEBUG`, `verbose`, `LOG_LEVEL` returns nothing. There is also a diagnostic branch that probes several candidate paths when a listing comes back empty, adding further calls.

## Why it matters now

Before #4411, `AutotagCloudStorage` called `ListObjects` **once** per content source, so this was one extra API call and 13 log lines per run — tolerable. #4411 correctly made the listing recursive, so it is now **once per folder**. A 200-folder vault means 200 extra API calls against Dropbox rate limits, ~2,600 log lines, and the account email written 200 times.

## Scope

Pre-existing — #4411 amplifies it rather than causing it. Filed as the follow-up agreed in that review.

## Suggested fix

- Drop the `usersGetCurrentAccount` probe, or move it behind an explicit debug flag and call it at most once per driver instance.
- Remove `email` from the logged payload regardless of gating.
- Reduce the per-call `console.log` volume to one line, or route through the MJ logger so verbosity is controllable.

Found during review of #4411.

Contributor guide

Open the contributing guide

Research direction

Start in DropboxFileStorage.ListObjects (lines 799–927) and inspect the unconditional usersGetCurrentAccount probe, console logging, and empty-listing diagnostic branch. Done means avoiding the unnecessary account call, never logging the account email, and reducing or gating the per-call logs while preserving recursive listing behavior; no test file is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, cloud
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.