Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6989555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:13:39+00:00 2026-05-27T19:13:39+00:00

I was recently told that using mongodb _id fields in a URL is unsafe.

  • 0

I was recently told that using mongodb _id fields in a URL is unsafe. I was wondering if that’s true.

My site is restricted to registered users, and every user has their URL endpoints which contains an id from mongo. It’s the typical mongodb _id field – a SHA1. AFAIK, the id is unguessable, and even if someone hits upon someone else’s id, session based authentication in my app doesn’t allow access. No one has direct database access other than the application itself.

I’m curious to know if there’s anything I’m missing.

Edit: Clarified question. (mongodb ObjectIDs aren’t SHA1s)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:13:40+00:00Added an answer on May 27, 2026 at 7:13 pm

    _id field from MongoDB is (by default) of type ObjectID. It is not a SHA1.

    And its string representation (like 4ed7cbfd1d96406ca0000015 is, for sure, URL-safe. I use it everywhere.

    I mean, it is safe to expose it everywhere where you would put a regular int identifier (/products/3 or /users/42 or whatever).

    On your site you should check if a user is logged in and if he has access to given URL. You should not blindly allow users to visit URLs with ObjectIDs in them, just because they (ids) are not easy to guess (they’re easier than SHA1, though)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was told recently by a Flash developer that I respect that using include
This is a (hopefully) really simple question - I have been told recently that
I recently found an article online that told me about this: RewriteRule ^mock-up/([^/]+)/([^/]+) /mock-up/index.php?page=$1&section=$2
I was recently told that I should use transactions in my application as they
So I was recently doing some work, when somebody told me that if doing
Recently I have been told that static class/methods are evil. Take for example my
Recently I am told by my friend that putting a non-core theme in /themes
I was told recently (on here) that concatenating your Javascript will cause XSS vulnerabilities.
I was recently told that I'm abusing exceptions to control the flow in my
Someone recently told me that there was a licencing constraint that prevented Android from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.