- Nodejs
- Express.js
- Redis
- User enters URL to shorten
- Create random string of length 6 consisting of [a-z A-z 0-9] -> Check in redis if this string exists. If it does then append extra 3 characters
- Save in redis
- Redirect user to page with shortened link and generate QR code using kjua QR code generator
- The first version lacked support for passwords
- Data was stored as key-value :
SET shortURl longUrl
- Password support was added
- Minimum length of passwords is 4
bcryptbcryptjsis used to generate the password's hash (salt is also added usingbcryptbcryptjs)- The url is stored in plaintext while the password's hash is stored
- Data was stored using redis hashes (string field to string value mapping) :
HMSET shortUrl url longUrl pwd passwordHash - If password is not opted for then a
"no"is saved instead of"passwordHash"
- The longUrl is encrypted using symetric-key ("AES-192-CTR") with the password as the key . If the password matches the one in redis then the longUrl will be decrypted using it .This ensures that longUrl are not visible even to db admins.
- CSRF is implemented
- Basic limiting on number of password attempts is introduced
- Improved error handling and error codes
Need to Add nonce to AES
Passing password in URL will be removed, Password would have to be entered in seperate page
Done
Other features to be added :
- Protection : Based on OWASP guidelines
- Basic rate limiting
- Compression
- Caching