• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

8 library(pwp): Prolog Well-formed Pages
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog SGML/XML parser
        • library(pwp): Prolog Well-formed Pages
          • Security
            • pwp_files/2
            • pwp_stream/3
            • pwp_xml/3

8.1 Security

A PWP template is a program. The values of pwp:ask, pwp:use and the ‘c(...)c and c[...]c` parts of attribute values are read as Prolog terms and executed with full privileges, and the text-file, xml-file and pwp-file values of pwp:how read arbitrary files (pwp-file also executes the embedded queries). Templates must therefore be trusted in the same way as Prolog source code. Notably:

  • Never process PWP documents that may be supplied or modified by untrusted users, for example files in an upload directory that is served by pwp_handler/2.
  • Data that is substituted into a page is not interpreted as PWP, but do not use request data to construct goals, format strings or file names in templates.
[det]pwp_files(:In:atom, +Out:atom)
loads an Xml document from the file named In, transforms it using the PWP attributes, and writes the transformed version to the new file named Out.
[det]pwp_stream(:Input:input_stream, +Output:output_stream, +Context:list)
Loads an Xml document from the given Input stream, transforms it using the PWP attributes, and writes the transformed version to the given Output stream. Context provides initial contextual variables and is a list of Name=Value.
pwp_xml(:In:list(xml), -Out:list(xml), +Context)
maps down a list of XML items, acting specially on elements and copying everything else unchanged, including white space. The Context is a list of ’VariableName’=CurrentValue bindings.

ClioPatria (version V3.1.1-59-g7b9a7a3)