Coder Social home page Coder Social logo

ruiquelhas / houdin Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 79 KB

Route-level file type validation for hapi parsed in-memory request payloads

Home Page: https://www.npmjs.com/package/houdin

License: BSD 3-Clause "New" or "Revised" License

JavaScript 100.00%

houdin's People

Contributors

greenkeeperio-bot avatar ruiquelhas avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

houdin's Issues

Account for `file-type` breaking change

The file-type module introduced a minor update that increased the input size requirement for validating magic numbers. A test is currently failing because the buffer that gets validated does not have the newly required length.

mp4 validation problem

I have tried to validate various mp4 files, got Bad Request error like:

{ 
   "statusCode": 400, 
   "error": "Bad Request", 
   "message": "child \"file\" fails because [\"file\" type is unknown]", 
   "validation": { "source": "payload", "keys": [ "file" ] 
}

When i try to use it as standalone, i got
ValidationError: child "file" fails because ["file" type is unknown]

Ftyp information (in Hex) of my sample set are:
1 - [0x00, 0x00, 0x00, 0x14]
2 - [0x00, 0x00, 0x00, 0x18]
3 - [0x00, 0x00, 0x00, 0x1C]
4 - [0x00, 0x00, 0x00, 0x20]

Correct handling of multiple invalid file types

Currently, the logic to iterate over the payload items is faulty. To avoid issues with duplicate callbacks, the iteration should stop as soon as it hits the first invalid file type. This is currently not happening due to a recent change, leading to a lot of issues when the validation happens through a hapi plugin, such as copperfield.

Update package keywords

Update the keywords array in the package.json file to ensure they better match the intent of the package itself and to aim for better discoverability.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.