phpmyadmin / phpmyadmin/phpmyadmin

Importing a CSV file doesn't have enough checks

Open
#17,402 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
PHP
Stars
7.9k
Forks
3.6k
Avg merge
4d 18h
Merged PRs (30d)
36

Description

Describe the bug

When importing a PNG instead of a CSV file, a database and table are created, because there aren't enough checks to see if is a valid CSV file or not.

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://demo.phpmyadmin.net/master-config/index.php?route=/server/import
  2. Click on Browse... and select a PNG file
  3. Select CSV format
  4. Click on Import
  5. See error
Expected behavior

It should check and see if the file imported is CSV file or not, and show a message like it does for XML for example.
The CSV file specified was either malformed or incomplete. Please correct the issue and try again.

Screenshots

https://user-images.githubusercontent.com/25424343/154642030-57f64731-796e-42c0-a290-f22542b7111a.mp4

Server configuration
  • Operating system:
  • Web server:
  • Database version:
  • PHP version:
  • phpMyAdmin version:
Client configuration
  • Browser:
  • Operating system:
Additional context

Add any other context about the bug here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the /server/import entry point described in the reproduction steps and reproduce the PNG-as-CSV import. Trace the CSV import validation and compare its behavior with the XML validation mentioned in the issue. Done means invalid non-CSV input is rejected with a clear malformed-or-incomplete message before creating a database or table.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.