Coder Social home page Coder Social logo

robokache's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

robokache's Issues

Replace Visibility Flag

Visibility flag is confusing, especially for anyone consuming this API. There are a couple of options for replacing this. The simplest one would be using two boolean flags, one for public and one for shareable.

Make sure files get deleted

I can delete documents via the UI and they get removed from the DB. But then I check my local robokache-data folder and it looks like none of the documents actually get deleted.

Add Metadata Field

Add an optional JSON metadata field. This field should accept an arbitrary dictionary of objects. This field will be useful for fields that are specific to document types that we don't want to manage within Robokache.

SQL Injection Vulnerability

// Get rows user is allowed to see
stmt := fmt.Sprintf(`
SELECT id, owner, visibility FROM questions
WHERE owner='%s' OR visibility>=%d
`, userEmail, public)
rows, err := db.Query(stmt)

Queries in the get.go are built using Sprintf. This allows a SQL Injection attack using a string like the following for the owner variable:

'DROP TABLE questions;'

Fix is to replace Sprintf with db.Prepare which accepts placeholders and fills them safely.

Data object not updated with sequential read then write

When calling:

PUT /api/:id/data
then
GET /api/:id/data

in quick succession, the data is not available. Likely cause is that the Go server is multithreaded by default, so the GET request is processed before the PUT finishes writing the file. We will need to write a test to confirm, and then fix probably with an RWMutex.

Expose visibility as string in the API

Visibility right now is exposed as an integer, but the integer does not have any meaning. What we should do is replace that with a string representation in the API.

Docker container name

It might be helpful to add --name robokache to the Readme instructions when running docker. Otherwise docker will assign a random name to the container, like agitated_visvesvaraya.

Split /api/document Route

Currently the /api/document route returns both public and owned documents. The only way to differentiate between these is the "owned" flag, which is inconvenient for consumers. One solution for this would be to split the route into personal documents (/api/myDocuments/) and public documents (/api/publicDocuments).

Don't clear DB on startup

Right now the DB is cleared every time the app starts up. New idea is to create a shell script that clears the DB for testing and then to simply initialize the database if it doesn't exist at startup.

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.