Skip to content
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

isLonely() does not solve the security issue #94

Open
mipo256 opened this issue Dec 29, 2024 · 4 comments
Open

isLonely() does not solve the security issue #94

mipo256 opened this issue Dec 29, 2024 · 4 comments

Comments

@mipo256
Copy link
Contributor

mipo256 commented Dec 29, 2024

The page that describes the solution provided by the isLonely() function is actually a bit wrong in the sense that this does not really solve the security issue.

For instance, a Book may have a field createdBy, which should be, for instance, determined from the current session of the given HTTP request. The problem is that this field is a scalar in terms of the Jimmer terminology, and therefore isLonely() would not complain about the fact that the client either accidentally or intentionally set the createdBy by himself.

So I think the warning in the docs is great, but we cannot really say that if the relations are unset or set to ID's only, then the operation is secure. It is not like that. It should be mentioned.

@babyfish-ct
Copy link
Owner

Any suggestion?

@mipo256
Copy link
Contributor Author

mipo256 commented Jan 3, 2025

The suggestion is to rephrase this in the documentation. I'll provide the PR.

@mipo256
Copy link
Contributor Author

mipo256 commented Jan 3, 2025

To be honest, I even think that if this approach does not solve both the API ambiguity problem and the security issue, then do we really need this solution at all?

It seems that if the user is just playing around, he does not need that at all. Alternatively, if he is dead serious about the consequences, then he must've handles both the security and API ambiguity issues. So it seems that the best thing to do here is to deprecate this function for removal and mark this in documentation.

CC: @babyfish-ct

@babyfish-ct
Copy link
Owner

No, isLonely is only used to check whether it is a single object, not a data structure. This is a simple, basic, theoretical, and business-independent auxiliary method.

For security of input parameter of business entry, DTO language supports InputDTO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants