English 中文(简体)
404 不能在获得未经许可/未获得原始资源时成立?
原标题:404 Not Found when Accessing Unauthorized/Not Found Resources?

附录一载有1、2、3、4、用户A的识别资料;只有2个。

  • If he tries to access Task #3, which is unauthorized, should I give 404 or just say he s not authorized? I get this idea from logins, whether the username is valid, I always just give a generic invalid username/password combination, to prevent the user from knowing if the user/resource exists
  • If he tries to access Task #5 non-existant should I give 404? or say resource not found in a generic page?
最佳回答

让我们说,你有一个网站,有几页的上网权利:

  1. A general page, to which every one has an access.
  2. A page which requires a logged in user, still access by a mass public.
  3. An admin page, which can be accessed only by a small group of people.
  4. A non existent page.

So for a visitor with no rights what I suggest is to use:
403 (No permissions) with 2.
404 (Does not exists) with 3, as no general user should ever come across any link to that page so it should as well be non existent for them.
And obviously 4, a non existent page, should always result in a 404 response.

问题回答

如果使用者没有机会从事这项任务,那么他就知道这项任务存在,就使用403条。 如果使用者甚至能够确定他没有获得、使用404项任务的存在。

试图获得一项不存在的任务,必然会导致404个对策。

您应始终在吉大港定居人士协会的回复中采用适当的地位法,因为它告诉浏览者,它应如何对待应对措施。 如果将“未发现的资源”错误信息退回到《科索沃地位法》200条,浏览器就会认为,这一信息是用户要求的实际网页,而且可能为此敲响。 如果你使用404条法典(即403条等),浏览器会知道,你寄回的那页实际上就是所要求的,因此,它知道,在浏览的历史上,它不会藏匿或进入URL。 答复的 载于上,仍然可以是一只冰层的超文本页面,其错误信息可以读到。





相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

MALICIOUS_CODE EI_EXPOSE_REP Medium

I run findbugs against all of my code and only tackle the top stuff. I finally got the top stuff resolved and now am looking at the details. I have a simple entity, say a user: public class User ...

XSS on jsbin.com

Anyone know if jsbin.com implements any protection for XSS or other javascript attacks? I see jsbin links used fairly regularly on sites like this one and I can t find any indication from the site ...

Make md5 strong

Im making a website that will intergrate with game that only support md5 hashing metod (atm). Which ofc is not especially safe anymore. But how could i make it stronger? Should I just generate long ...

Why running a service as Local System is bad on windows?

I am trying to find out the difference between difference service account types. I tumbled upon this question. The answer was because it has powerful access to local resources, and Network Service ...

Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

热门标签