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

  • Home
  • SEARCH
  • 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 7190595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:32:59+00:00 2026-05-28T19:32:59+00:00

I have a line where I grab a database row with .get(field = ID)

  • 0

I have a line where I grab a database row with .get(field = ID). A normal user would always send an ID that exists in the database, but a hacker might not, and it would throw a DoesNotExist exception. Is it important to explicitly catch it or should I just leave the exception uncaught in that case? Either way, the hacker would not see any message so there is not any security risk either way.

I’m also wondering whether I should log this exception failing. Would be interested in hearing what you guys do as a general rule of thumb, and your justification for what you log/catch vs. what you let throw an uncaught exception.

  • 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-28T19:33:00+00:00Added an answer on May 28, 2026 at 7:33 pm

    The important part is in which context you are using this field. If you access the page through /profile/[ID] I would display a User not found page. If you do something like that

    ID = context["user"].id
    Object.get(field = ID)
    

    I wouldn’t try to catch the error seperately.

    All in all I save every error which can not be caused through normal user behaviour. Then I can take a look into my error log and can directly see where my site raises failures or whether hackers tried to find a security hole.

    Afterwards I fix this undefined behaviour so that the error log is as empty as possible.

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

Sidebar

Related Questions

I have a line of C# in my ASP.NET code behind that looks like
I have this line in a useful Bash script that I haven't managed to
I have a line that I draw in a window and I let the
I have a line (actually a cube) going from (x1,y1,z1) to (x2,y2,z2). I would
I have this line of JavaScript and the behavior I am seeing is that
I have a user complaining that my app is taking a lot of CPU
Let's say that I routinely have to work with files with an unknown, but
I have a little function that shows latest activity, it grab timestamp in unix
I have an iFrame and I want the user to be able to grab
I have an unordered list that wraps onto a second line, and needs to

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.