mapbox / mapbox/s3scan

keys.js potential for uncaught exception

Open
#17 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
10
Forks
3
PR merge metrics
No merged PRs in 30d

Description

Sometimes it appears that the aws-sdk can return no error object, and also provide a data object where .Contents is undefined. In that case we would throw an unhandled error in the callback when we try and .slice the anticipated array.

s3.listObjects(params, function(err, data) {
  assert.notOk(err, 'there is no error');
  assert.notOk(data.Contents, 'there is also no information');
});

cc @yhahn

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 lib/keys.js line 53 and inspect the callback handling when the AWS response has no error but lacks data.Contents. Add coverage for the shown callback scenario and verify that it no longer produces an unhandled exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript, node.js
Domain
backend, cloud
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.