-
Notifications
You must be signed in to change notification settings - Fork 208
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
[Bug] [Jac Cloud] Private & Protected Walker Attributes are queryable in endpoint #1338
Comments
We can use additional option on __specs__, however, It might cause some restriction.
I think the right way to do it is by using python's behavior ( from dataclasses import dataclass, field
from typing import ClassVar
@dataclass
class WithPrivate1:
immutable_var: int = 1
mutable_var: dict = field(default_factory=dict)
var_for_type_hint: ClassVar[int]
# same with
class WithPrivate2:
var_for_type_hint: int
def __init__(self, immutable_var: int = 1, mutable_var: dict = None) -> None:
self.immutable_var = immutable_var
self.mutable_var = mutable_var or {} using walker sample{
has static val: int;
} |
Yes, I agree that |
Python handles ClassVar (equivalent to Since Python doesn't statically define variables in a class similar to other OOP languages, ClassVar can be used in different purposes. For example: class Sample:
val1: int = 1
val2: int
# similar to
# val1: ClassVar[int] = 1
# val2: ClassVar[int]
s = Sample()
s.val1 = 10
print(s.val1) # prints 10
print(Sample.val1) # prints 1
print(s.val2) # will error
s.val2 = 1
print(s.val2) # prints 1 In this context, I think using |
adding option to hide fields using However, I will add it just to support this edge case: |
|
Describe the bug
Private (:priv) and protected (:protect) walker attributes are queryable in Jac Cloud endpoint responses, which violates the expected encapsulation of such attributes. The expected behavior is that only public attributes (:pub) should be visible, while private and protected attributes should remain inaccessible to external queries.
To Reproduce
The text was updated successfully, but these errors were encountered: