You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ponymail.apache.org by GitBox <gi...@apache.org> on 2022/04/04 10:02:41 UTC

[GitHub] [incubator-ponymail-foal] sbp opened a new issue, #235: Second argument to can_access_list is accidentally polymorphic in syntax

sbp opened a new issue, #235:
URL: https://github.com/apache/incubator-ponymail-foal/issues/235

   [In server/plugins/messages.py](https://github.com/apache/incubator-ponymail-foal/blob/f23c9ed887db8af2a6b9456f93f5460337369bdb/server/plugins/messages.py#L492-L495) the second argument to `plugins.aaa.can_access_list`, `listname`, is a List-Id:
   
   ```python3
       private_lists_accessible = []
       for listname in private_lists_found:
           if plugins.aaa.can_access_list(session, listname):
               private_lists_accessible.append(listname)
   ```
   
   So it would e.g. receive `<example.lists.example.org>`.
   
   But [in server/endpoints/preferences.py](https://github.com/apache/incubator-ponymail-foal/blob/f23c9ed887db8af2a6b9456f93f5460337369bdb/server/endpoints/preferences.py#L50-L52) the second argument, `ml`, is an email address:
   
   ```python3
               can_access = True
               if entry.get("private", True):
                   can_access = plugins.aaa.can_access_list(session, ml)
   ```
   
   So it would e.g. receive `example@lists.example.com`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ponymail.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-ponymail-foal] Humbedooh commented on issue #235: Second argument to can_access_list is accidentally polymorphic in syntax

Posted by GitBox <gi...@apache.org>.
Humbedooh commented on issue #235:
URL: https://github.com/apache/incubator-ponymail-foal/issues/235#issuecomment-1091962554

   I think a good first step is to agree on what we should send to AAA, and then ensure we always do that in the code. We can add tests as we go along later, but addressing the root of the problem should come first.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ponymail.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-ponymail-foal] sebbASF commented on issue #235: Second argument to can_access_list is accidentally polymorphic in syntax

Posted by GitBox <gi...@apache.org>.
sebbASF commented on issue #235:
URL: https://github.com/apache/incubator-ponymail-foal/issues/235#issuecomment-1087746767

   The openapi.yaml definition currently uses list: in 3 different ways:
   dev
   <dev.asterixdb.apache.org>
   dev@lists.example.org
   
   The StatsResponse definition even has two different usages, dev@lists.example.org and dev in different parts of the response.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ponymail.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-ponymail-foal] sebbASF commented on issue #235: Second argument to can_access_list is accidentally polymorphic in syntax

Posted by GitBox <gi...@apache.org>.
sebbASF commented on issue #235:
URL: https://github.com/apache/incubator-ponymail-foal/issues/235#issuecomment-1087393428

   Is there a way to detect such issues at compile time?
   e.g. define specific classes for different types of string object; these classes could contain the code to convert from raw strings rather than having such code duplicated


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ponymail.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-ponymail-foal] sbp commented on issue #235: Second argument to can_access_list is accidentally polymorphic in syntax

Posted by GitBox <gi...@apache.org>.
sbp commented on issue #235:
URL: https://github.com/apache/incubator-ponymail-foal/issues/235#issuecomment-1089324182

   > Is there a way to detect such issues at compile time?
   
   I'm a big fan of compile time checking, and I have attempted to do string syntax differentiation in other Python projects, but my experiences brought me to the conclusion that in most cases it's not worth the effort. This is of course a highly qualitative opinion and may not apply to foal, but it's very difficult to keep the boilerplate involved to a manageable level, and the effort involved is usually enormous because strings are so ubiquitous. Runtime checks, testing, and documentation are probably still the way forward for now.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ponymail.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-ponymail-foal] Humbedooh commented on issue #235: Second argument to can_access_list is accidentally polymorphic in syntax

Posted by GitBox <gi...@apache.org>.
Humbedooh commented on issue #235:
URL: https://github.com/apache/incubator-ponymail-foal/issues/235#issuecomment-1087359000

   Yeah, I noticed that a while back, and this does need to conform to one or the other, and only that.
   A quick hot-fix in the meantime for custom AAA is to do something like:
   ~~~python
   listname = "<" + listname.strip("<>").replace("@", ".") + ">"
   ~~~
   
   Or the other way around, depending on what's best.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ponymail.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-ponymail-foal] sbp commented on issue #235: Second argument to can_access_list is accidentally polymorphic in syntax

Posted by GitBox <gi...@apache.org>.
sbp commented on issue #235:
URL: https://github.com/apache/incubator-ponymail-foal/issues/235#issuecomment-1087362594

   I fix it locally by doing this in custom AAA:
   
   ```python3
       if "@" not in second_arg:
           second_arg = second_arg.strip("<>").replace(".", "@", 1)
   ```
   
   Which is compatible with both kinds of value, and means I don't have to patch upstream.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ponymail.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org