Skip to content

Sensitive API error responses exposed to users #58

@tembo

Description

@tembo

Security Vulnerability Report

Severity: Low

Vulnerability Type: Information Disclosure

Affected Files and Lines

  • src/services/typefully.ts - Line 48

Code Snippet

if (!response.ok) {
  const errorText = await response.text();
  throw new Error(`Typefully API error (${response.status}): ${errorText}`);
}

Description

The error response from Typefully API is displayed directly to the user. If the API returns error messages containing sensitive information (API limits, internal IDs, rate limit details, etc.), this data would be exposed to the user and could leak into logs or error reporting.

Impact

  • Internal API details could be exposed
  • Rate limit information could help attackers time their attacks
  • Error messages might contain sensitive implementation details

Recommended Fix

if (!response.ok) {
  const errorText = await response.text();
  if (response.status === 401) {
    throw new Error('Typefully API authentication failed. Check your TYPEFULLY_API_KEY.');
  } else if (response.status === 429) {
    throw new Error('Typefully API rate limit reached. Please try again later.');
  } else {
    // Log full response for debugging, but show generic message to user
    logger.debug(`Typefully API error (${response.status}): ${errorText}`);
    throw new Error(`Typefully API error (${response.status}). Please check your API key and try again.`);
  }
}

References

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions