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

plDoc and whitelisting #16

Open
Anniepoo opened this issue May 7, 2016 · 11 comments
Open

plDoc and whitelisting #16

Anniepoo opened this issue May 7, 2016 · 11 comments

Comments

@Anniepoo
Copy link
Member

Anniepoo commented May 7, 2016

It would be quite convenient if plDoc generated html included some indication of which predicates were whitelisted.

Visually, we distinguish predicate types with gold vs light blue vs dark blue, etc. - maybe some elaboration of this scheme, or some icons, could do it

Not sure what we do about their being potentially more than one application.
Nor am I sure what to do about things that are conditionally whitelisted.

@wouterbeek
Copy link

@Anniepoo Can you define these categories for me? I see labels (1) gold, (2) light blue, (3) dark blue, (4) maybe more? These are related to categories (1) whitelisted, (2) conditionally whitelisted, (3) other?

If plDoc can discover the category based on parsing some Prolog file then the HTML rendition can include semantic RDFa annotations that describe this part of the semantics unambiguously.

@Anniepoo
Copy link
Member Author

Anniepoo commented May 7, 2016

the backgrounds of predicates are something like
gold - multifile
dark bLue - public
light blue - private

I think there's a second yellow tone for dynamic

another good plae to somehow display this is the editor.

@wouterbeek
Copy link

@Anniepoo Thanks for specifying the categories. But how do these interact with whitelisting? Not all public predicates should be whitelisted IIUC.

@Anniepoo
Copy link
Member Author

Anniepoo commented May 8, 2016

Well, shell is public, I hope we're not whitelisting it.

If you look at sources of pldoc pages, you'll see that the dt that defines the predicate header has a class set.

this class is pubdef for public predicates,
multidef for multifile public predicates
privdef for private predicates (you'll have to do this in the local doc server).

@wouterbeek
Copy link

wouterbeek commented May 8, 2016

@Anniepoo shell/1 would be defined as pubdef according to the following code in doc_html.pl:

(   private(Obj, Options)
->  Class = privdef     % private definition
;   multifile(Obj, Options)
->  (   option(scope(file), Options)
    ->  (   more_doc(Obj, Pos)
    ->  Class = multidef(object(Obj))
    ;   Class = multidef
    )
    ;   Class = multidef(file((Pos)))
    )
;   Class = pubdef      % public definition
),

If shell/1 is not whitelisted then this information must be stored somewhere else?

@Anniepoo
Copy link
Member Author

Anniepoo commented May 8, 2016

Yes, of course it would.
Technically, predicates aren't just whitelisted. safe_predicate can look at the args, so foo(2) could be safe but foo(3) not. I think there's a list of whitelisted system predicates somehwere, but I'm too busy with other stuff today to go looking for it.

@JanWielemaker
Copy link
Member

Yip. You can basically just do safe_goal(Head), using the most generic head. If that succeeds it is whitelisted, but indeed if it fails it may work with specific arguments. This is notably a problem for meta-predicates, which will not pass as safe without instantiating their arguments to something safe. That could be automated (find meta-arguments and instantiate them. I'd be tempted to use an icon to indicate safety rather than yet another colour. This might actually also be a good idea for multifile predicates as both are orthogonal to public/private.

@Anniepoo
Copy link
Member Author

Anniepoo commented May 9, 2016

Yes, the icon's a good idea.
I'll draw one

@Anniepoo
Copy link
Member Author

Anniepoo commented May 9, 2016

Would implementing this imply loading pengines library, and if so, are we creating a security issue?
If added to pldoc, simply starting the doc_server could expose a general pengine server.
Doing this without warning might be bad.

@JanWielemaker
Copy link
Member

No. You only need to load library(sandbox).

@Anniepoo
Copy link
Member Author

Anniepoo commented May 9, 2016

ah, cool

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

No branches or pull requests

3 participants