https://bugs.documentfoundation.org/show_bug.cgi?id=159426
Bug ID: 159426
Summary: Add custom functions and dynamic data source
Product: LibreOffice
Version: unspecified
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: enhancement
Priority: medium
Component: Calc
Assignee: [email protected]
Reporter: [email protected]
Description:
Currently we have the built in functions, macros, and database data sources.
Therefore I'd like to suggest the addition of a new kind of more powerful and
generic functions that can serve as a middle ground between all of these. These
pure functions would be specified within the data sources view (where currently
only database connections are). The main goal of this is to simultaneously
reduce the risk current macro solutions have, making them distinct from macros
(so that it is easy to differentiate their threat level and access), as well as
provide deterministic (cachable result), reusable code and clean (functional
programming style and side effect free) implementation of data retrieval and
transformation. This also would add a simple way to extend libreoffice calc
with user defined functions.
These pure functions should be side effect free, be able to make web requests
and access only the current document. However before making a web request it
should need user approval (or a check against an allow list in the options).
This is to allow using a kind of macro without adding all of the risks of
macros. These functions should then also be usable to generate a dynamic data
source.
Such dynamic data sources should also be within the data sources view, and
output a table by only using other data sources as well as the formerly
mentioned pure functions. These dynamically generated tables should then be
accessible from the worksheet.
Because we already have the "webservice" function the formerly suggested
addition of functions within data sources probably doesn't need any special
access handing. However a few more functions could be useful to simplify the
creation of both such data sources as well as "just" formulas within normal
sheets. These include mostly data transformation ones like: let, map, filter,
foldl, foldr, tojson, fromjson, toxml, fromxml, toyml, fromyml, tocsv, fromcsv,
webservicerest, try-catch, sha1sum, sha256sum, sha512sum, md5sum, [oauth (with
the ability to capture/hook/register/intercept a specific callback url e.g. via
embedded browser)], ...
Intermediate states of such data sources should be able to contain nested
tables as well as errors. To allow for more sophisticated lookups probably also
the ability to add an table/sheet from within the current document could prove
useful to the data sources registry (this would allow to further lock down the
access of such data source functions and tables to only other data sources and
prevent them from accessing arbitrary areas of the document that have not been
added as a data source themselves beforehand).
(the "language" of these data source functions could be an extended version of
what we have currently with the normal versions but extended to a "full"
functional language. Mainly because that is probably the simplest way to
implement it. Alternatively something like a full
Scala/Lua/TypeScript/Haskell/F#/... support would also be nice, but esp. the
later ones are probably way more difficult to integrate. Especially because
most of the utility value of these languages would either vanish when ran
within such a restricted environment or add way too much complexity to get it
working to begin with.)
An alternative implementation of the requested feature would be to fork the
current macro system and add a new version of it that does not have access to
the system and is limited the same way as outlined above e.g. by putting it
into a kind of virtual machine where it can only interact with the outer system
through the above mentioned mechanisms (only the document itself and explicitly
allowed web endpoints) and thereby be usable without enabling macros and
without exposing the system to their "power"/threat. While simultaneously being
very useful.
Steps to Reproduce:
does not apply
Actual Results:
does not apply
Expected Results:
does not apply
Reproducible: Always
User Profile Reset: No
Additional Info:
Version: 7.6.4.1 (X86_64) / LibreOffice Community
Build ID: 60(Build:1)
CPU threads: 16; OS: Linux 6.6; UI render: default; VCL: kf5 (cairo+wayland)
Locale: en-US (en_US.UTF-8); UI: en-US
7.6.4-2
Calc: threaded
--
You are receiving this mail because:
You are the assignee for the bug.