Skip to content

bug(sheets,docs,slides): missing account verification in new services #115

@mherod

Description

@mherod

Problem

SheetsService, DocsService, and SlidesService do not verify that the OAuth token matches the --account flag. A mismatched token silently queries the wrong user's data, returning 404 or accessing the wrong account's files.

Location: src/services/sheets-service.ts:49, src/services/docs-service.ts:39, src/services/slides-service.ts:42
Found in: codebase scan (pattern gap identified during #113 fix)
Type: bug — same class as #113

Context

DriveService and MailService both verify the token matches --account during initialize():

The three new services added in #111 and #112 are missing this verification.

Recommended Approach

For each service, add account verification in initialize() after creating the API client:

  1. SheetsService: Use drive.about.get({ fields: "user" }) (requires adding Drive scope or using a separate Drive client) — OR use the Sheets API's own method if available. Alternatively, since Sheets files are also Drive files, the DriveService pattern works.
  2. DocsService: Same approach — verify via Drive API about.get.
  3. SlidesService: Same approach.

Alternatively, extract the verification logic into BaseService to avoid duplication across all services.

Acceptance Criteria

  • SheetsService.initialize() verifies token email matches --account
  • DocsService.initialize() verifies token email matches --account
  • SlidesService.initialize() verifies token email matches --account
  • Mismatch throws a clear error with re-auth instructions
  • Tests pass, no new lint errors

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority-highHigh priorityreadyIssue is refined and ready for implementation

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions