Giter Site home page Giter Site logo

Comments (4)

big-r81 avatar big-r81 commented on August 28, 2024

Hey,

what do you mean by „with illegal IDs“ and „ID validity check”? Can you give a concrete example what’s going wrong?

from couchdb.

alxndrsn avatar alxndrsn commented on August 28, 2024

Can you give a concrete example what’s going wrong?

Setup

docker run --detach --network host --rm -e COUCHDB_USER=admin -e COUCHDB_PASSWORD=password -it --name my-couchdb-$RANDOM apache/couchdb &&
sleep 5 &&
curl http://admin:password@localhost:5984/main -X PUT && curl http://admin:password@localhost:5984/_users -X PUT

Create legal doc (PUT)

$ curl http://admin:password@localhost:5984/main/some-valid-doc-id -X PUT -H 'content-type: application/json' --data '{"hi":true}'
{"ok":true,"id":"some-valid-doc-id","rev":"1-e7e9148335bb3e3d0f04263e57edef01"}

Try to create illegal doc (PUT)

$ curl http://admin:password@localhost:5984/main/_bad_path -X PUT -H 'content-type: application/json' --data '{"hi":true}'
{"error":"illegal_docid","reason":"Only reserved document ids may start with underscore."}

Create illegal doc (COPY)

$ curl http://admin:password@localhost:5984/main/some-valid-doc-id -X COPY -H 'Destination: _bad_path'
{"ok":true,"id":"_bad_path","rev":"1-e7e9148335bb3e3d0f04263e57edef01"}

Retrieve illegal doc (GET)

$ curl http://admin:password@localhost:5984/main/_bad_path
{"_id":"_bad_path","_rev":"1-e7e9148335bb3e3d0f04263e57edef01","hi":true}

from couchdb.

alxndrsn avatar alxndrsn commented on August 28, 2024

This creates some weird situations, e.g.

$ curl http://admin:password@localhost:5984/main/some-valid-doc-id -X COPY -H 'Destination: _all_docs'
{"ok":true,"id":"_all_docs","rev":"1-e7e9148335bb3e3d0f04263e57edef01"}
$ curl http://admin:password@localhost:5984/main/_all_docs
{"total_rows":3,"offset":0,"rows":[
{"id":"_all_docs","key":"_all_docs","value":{"rev":"1-e7e9148335bb3e3d0f04263e57edef01"}},
{"id":"_bad_path","key":"_bad_path","value":{"rev":"1-e7e9148335bb3e3d0f04263e57edef01"}},
{"id":"some-valid-doc-id","key":"some-valid-doc-id","value":{"rev":"1-e7e9148335bb3e3d0f04263e57edef01"}}
]}

from couchdb.

big-r81 avatar big-r81 commented on August 28, 2024

Thx 🙏 for giving an example and that doesn’t look good…

from couchdb.

Related Issues (20)

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.