-
Notifications
You must be signed in to change notification settings - Fork 802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor improvment #6956
Minor improvment #6956
Conversation
a52f0d8
to
f3e20c4
Compare
KP considered this quirk to be a feature, since debug items would have a harder time masquerading as legitimate drops. Though, as this PR demonstrates, it's a pretty weak defense. |
Obscurity != security. 😁 My main driver is testing in multiplayer. Especially if special items are needed. Also the current code can generate total valid items. But not always. That means even people without knowledge only have to run the function often enough or? 🤔 Some alternatives are
|
Turn off the check in debug makes sens. Makes it harder to send them to someone who isn't aware of there origin |
I agree, of course, but this isn't really a matter of security in the first place considering the way multiplayer is designed.
To get a valid item, a person who does not explicitly modify the code to generate valid items would instead need to verify the validity of each item they generate. Depending on their level of skill/knowledge, this could end up being a fairly prohibitively laborious and error-prone process. The feature justifies itself as a hurdle as opposed to a security mechanism. |
I like this, but we also should be able to test the validation in debug mode. So maybe a separate precompiler flag to explicitly disable the validation? |
If you want to raise the bar, it should be disabled by default in debug, and perhaps have a separate flag to enable it in debug.
I'm not sure it's a big hurdle. The logic of how the check is done is clean enough that it's fairly easy to understand, especially when it's enabled in debug mode. 😉 Personally, I would just generate valid items. But I don't have a strong motivation/interest in that either, so I'm fine with whatever we decide. |
I'm not sure what you mean by "raise the bar" in this context, but I did consider that, and it has its pros and cons. Ultimately, the reason I decided to suggest enabling it by default is because a developer who encounters a validation error is going to work to try and solve it. A developer who encounters no resistance at all will be none the wiser.
Yeah, and I suppose it's been made that much smaller by the existence of this PR. But I don't think it has to be a big hurdle. The point is that someone who is not that confident in their ability to read or write C++ code might attack the problem differently than you or I, ultimately deciding that clearing the hurdle is not worth the hassle. EDIT: Ah, I think I just realized what "raise the bar" meant. You meant it would make the hurdle bigger, right? |
f3e20c4
to
89c16a1
Compare
Yeah but on the other side it makes multiplayer testing harder if you need special items (like Doppelganger). That's why I meant you can't have both at the same time. 😉
Sorry for that. I didn't know the current behavior was intentional.
Yes I meant it would make it harder, because in your debug build it works but for other player it don't work. That would make it harder to diagnostic. |
833b651
to
9b93f24
Compare
9b93f24
to
38e98fb
Compare
Before this PR we were generating items with CF_LEVEL > 45.
This was no problem, but now we check this in
IsDungeonItemValid
.With this PR we only generate items with a level that a monster has. This ensures that we can use these items when testing multiplayer.
I discovered this when generating the doppelganger items for #6890.