Security updates #394
27 changed files with 1811 additions and 2058 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import { defineConfig } from 'vitepress'
|
import { defineConfig } from 'vitepress'
|
||||||
import { withMermaid } from 'vitepress-plugin-mermaid'
|
import { withMermaid } from 'vitepress-mermaid-viewer'
|
||||||
|
|
||||||
const forgejoIcon = `
|
const forgejoIcon = `
|
||||||
<svg viewBox="0 0 212 212" xmlns="http://www.w3.org/2000/svg">
|
<svg viewBox="0 0 212 212" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
|
@ -50,6 +50,9 @@ const config = defineConfig({
|
||||||
title: "shacl-vue",
|
title: "shacl-vue",
|
||||||
description: "Automatic generation of user interfaces from SHACL",
|
description: "Automatic generation of user interfaces from SHACL",
|
||||||
head: [['link', { rel: 'icon', href: 'favicon.ico' }]],
|
head: [['link', { rel: 'icon', href: 'favicon.ico' }]],
|
||||||
|
mermaid: {
|
||||||
|
layout: 'dagre',
|
||||||
|
},
|
||||||
themeConfig: {
|
themeConfig: {
|
||||||
// https://vitepress.dev/reference/default-theme-config
|
// https://vitepress.dev/reference/default-theme-config
|
||||||
search: {
|
search: {
|
||||||
|
|
@ -82,7 +85,8 @@ const config = defineConfig({
|
||||||
items: [
|
items: [
|
||||||
{ text: 'Application inputs', link: '/app-inputs' },
|
{ text: 'Application inputs', link: '/app-inputs' },
|
||||||
{ text: 'Application configuration', link: '/app-configuration' },
|
{ text: 'Application configuration', link: '/app-configuration' },
|
||||||
{ text: 'Application deployment', link: '/app-deployment' },
|
{ text: 'Build and deploy', link: '/app-deployment' },
|
||||||
|
{ text: 'Build configuration', link: '/build-configuration' },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -99,6 +103,8 @@ const config = defineConfig({
|
||||||
{ text: 'Form property ordering', link: '/features-property-ordering' },
|
{ text: 'Form property ordering', link: '/features-property-ordering' },
|
||||||
{ text: 'Starter variant', link: '/features-starter' },
|
{ text: 'Starter variant', link: '/features-starter' },
|
||||||
{ text: 'Runtime plugins', link: '/features-runtime-plugins' },
|
{ text: 'Runtime plugins', link: '/features-runtime-plugins' },
|
||||||
|
{ text: 'Tenant-based deployment', link: '/features-tenant' },
|
||||||
|
{ text: 'Security features', link: '/features-security' },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -107,8 +113,11 @@ const config = defineConfig({
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: 'Contributing',
|
text: 'For developers',
|
||||||
link: '/contributing'
|
items: [
|
||||||
|
{ text: 'Contributing', link: '/contributing' },
|
||||||
|
{ text: 'Package publishing', link: '/package-publishing' },
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: 'Acknowledgements',
|
text: 'Acknowledgements',
|
||||||
|
|
@ -126,4 +135,11 @@ const config = defineConfig({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
export default withMermaid(config)
|
export default withMermaid({
|
||||||
|
...config,
|
||||||
|
vite: {
|
||||||
|
optimizeDeps: {
|
||||||
|
include: ['mermaid'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ At startup in the browser, a `shacl-vue` instance will make a [HTTP HEAD request
|
||||||
|
|
||||||
If the `shacl-vue` instance URL loaded in the browser contains the `config` [query param](https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Query), e.g. `shacl-vue` will take the parameter value as the config URL that is to be loaded.
|
If the `shacl-vue` instance URL loaded in the browser contains the `config` [query param](https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Query), e.g. `shacl-vue` will take the parameter value as the config URL that is to be loaded.
|
||||||
|
|
||||||
### 3. Cnfig via `App.vue` modification
|
### 3. Config via `App.vue` modification
|
||||||
The configuration file URL can also be provided explicitly to the `shacl-vue` deployment by updating `App.vue` to instantiate the main `ShaclVue` component with the `configUrl` prop. This requires a rebuild of the `shacl-vue` instance from updated source.
|
The configuration file URL can also be provided explicitly to the `shacl-vue` deployment by updating `App.vue` to instantiate the main `ShaclVue` component with the `configUrl` prop. This requires a rebuild of the `shacl-vue` instance from updated source.
|
||||||
|
|
||||||
### 4. Via default config files served alongside the `shacl-vue` instance
|
### 4. Via default config files served alongside the `shacl-vue` instance
|
||||||
|
|
|
||||||
|
|
@ -2,21 +2,22 @@
|
||||||
layout: doc
|
layout: doc
|
||||||
---
|
---
|
||||||
|
|
||||||
# Application deployment and dependencies
|
# Build and deploy `shacl-vue`
|
||||||
|
|
||||||
The sections below describe the suggested processes involved in:
|
The sections below describe the suggested processes involved in:
|
||||||
- Setting up and deploying `shacl-vue` for a specific UI instance
|
1. Setting up `shacl-vue` for a UI deployment
|
||||||
- For developers: publishing `shacl-vue` and its dependencies to `npm`
|
2. Configuring and running the build process
|
||||||
|
|
||||||
## 1. `shacl-vue` UI deployment setup
|
## 1. `shacl-vue` UI deployment setup
|
||||||
|
|
||||||
The static files for a `shacl-vue` deployment, such as the one at https://pool.psychoinformatics.de/ui/, can be built from a separate git repository (for the given example, this repository is at: https://hub.psychoinformatics.de/www/pool.psychoinformatics.de-ui) that contains the following:
|
The static files for a `shacl-vue` deployment, such as the one at https://pool.psychoinformatics.de/ui/, can be built from a dedicated git repository (for the given example, this repository is at: https://hub.psychoinformatics.de/www/pool.psychoinformatics.de-ui) that contains the following:
|
||||||
|
|
||||||
1. Input files to the `shacl-vue` build process:
|
1. Input files to the `shacl-vue` build process:
|
||||||
- required configuration file (for the given example, see [`config.yaml`](https://hub.psychoinformatics.de/www/pool.psychoinformatics.de-ui/src/branch/main/config.yaml))
|
- required configuration file (for the given example, see [`config.yaml`](https://hub.psychoinformatics.de/www/pool.psychoinformatics.de-ui/src/branch/main/config.yaml))
|
||||||
- optional assets such as a logo or front page HTML file or wizard editor templates
|
- optional assets such as a logo or front page HTML file or wizard editor templates
|
||||||
|
- optional build configuration file and environment variables
|
||||||
2. `shacl-vue` as a git submodule
|
2. `shacl-vue` as a git submodule
|
||||||
3. A makefile (e.g. [this](https://hub.psychoinformatics.de/www/pool.psychoinformatics.de-ui/src/branch/main/Makefile)) containing the commands necessary for setting up the build environment.
|
4. A makefile (e.g. [this](https://hub.psychoinformatics.de/www/pool.psychoinformatics.de-ui/src/branch/main/Makefile)) containing the commands necessary for setting up the build environment and building application.
|
||||||
|
|
||||||
Extra details are provided per repository component:
|
Extra details are provided per repository component:
|
||||||
|
|
||||||
|
|
@ -32,6 +33,14 @@ A configuration file can be supplied in either YAML or JSON format.
|
||||||
|
|
||||||
This submodule pins a specific version/tag of the `shacl-vue` source code to the UI deployment. It should be kept up to date with the latest commit in the `main` branch if the goal is to support the latest `shacl-vue` features for the deployed UI instance. On the other hand, it is possible that a specific branch or tag is pinned to the repository for a specific reason, for example a production UI instance that should not be changed for consistency. If that is the case, this version/tag should be noted explicitly and adhered to.
|
This submodule pins a specific version/tag of the `shacl-vue` source code to the UI deployment. It should be kept up to date with the latest commit in the `main` branch if the goal is to support the latest `shacl-vue` features for the deployed UI instance. On the other hand, it is possible that a specific branch or tag is pinned to the repository for a specific reason, for example a production UI instance that should not be changed for consistency. If that is the case, this version/tag should be noted explicitly and adhered to.
|
||||||
|
|
||||||
|
### Build configuration
|
||||||
|
|
||||||
|
`shacl-vue` supports the use of [build-time configuration options](./build-configuration) that are supplied either directly as ENV variables or via a config file. Such a config file can be supplied here in JSON and YAML format, and should be passed to the build command (see below) using the `BUILD_CONFIG` variable, e.g.:
|
||||||
|
|
||||||
|
```
|
||||||
|
BUILD_CONFIG="path/to/local/config/file.yaml" npm run build:app
|
||||||
|
```
|
||||||
|
|
||||||
### Makefile
|
### Makefile
|
||||||
|
|
||||||
This suggested deployment approach uses [make](https://www.gnu.org/software/make/) for environment setup and deployment steps. The Makefile contains commands for, amongst others:
|
This suggested deployment approach uses [make](https://www.gnu.org/software/make/) for environment setup and deployment steps. The Makefile contains commands for, amongst others:
|
||||||
|
|
@ -70,28 +79,3 @@ make deploy
|
||||||
```
|
```
|
||||||
|
|
||||||
This hypothetical `deploy` step will likely require credentials for write access to the server.
|
This hypothetical `deploy` step will likely require credentials for write access to the server.
|
||||||
|
|
||||||
## 3. Publishing `shacl-vue` and its dependencies to `npm`
|
|
||||||
|
|
||||||
Relevant `npm` packages are:
|
|
||||||
- [shacl-tulip](https://www.npmjs.com/package/shacl-tulip)
|
|
||||||
- [flatson-js](https://www.npmjs.com/package/flatson-js)
|
|
||||||
- [shacl-vue](https://www.npmjs.com/package/shacl-vue)
|
|
||||||
|
|
||||||
RDF and form data handling functionalities underlying the core `shacl-vue` features are provided by the [`shacl-tulip`](https://hub.psychoinformatics.de/orinoco/shacl-tulip) library (like "`shacl-vue`-lib", but flowery), a core dependency of `shacl-vue`. It is completely independent of VueJS, yet class constructors allow passing reactive objects as arguments, which `shacl-tulip` handles seamlessly. It also focuses purely on library-level functionality and contains no frontend code.
|
|
||||||
|
|
||||||
For table import and export support, `shacl-vue` uses the [FlatSON specification](https://hub.psychoinformatics.de/orinoco/flatson), for which [flatson-js](https://www.npmjs.com/package/flatson-js) provides helper functionality.
|
|
||||||
|
|
||||||
Lastly, while the `shacl-vue` deployment steps above describe a git-repository-based process, it is also possible to use the `shacl-vue` package as a dependency in other VueJS projects. For that reason it is also published to `npm`.
|
|
||||||
|
|
||||||
Publishing any of these packages to `npm` requires:
|
|
||||||
- A registered `npm` user
|
|
||||||
- Maintainer privileges for that user to the relevant `npm` package
|
|
||||||
- Acquiring a local clone of the package's source code repository
|
|
||||||
- Updating the package source code, and in particular bumping the package major/minor version in the `package.json` file (e.g. [here](https://hub.psychoinformatics.de/orinoco/shacl-tulip/src/branch/main/package.json#L3))
|
|
||||||
- A local environment with `nodejs` installed
|
|
||||||
- Running: `npm publish` from the local root directory of the git clone
|
|
||||||
|
|
||||||
_Note that 2FA might be involved in the authentication step_
|
|
||||||
|
|
||||||
If the published version of either `shacl-tulip` or `flatson-js` is changed, the dependency in `shacl-vue` also needs to be updated (e.g. [here](https://hub.psychoinformatics.de/orinoco/shacl-vue/src/commit/6f1651320aa22667bfff808b84bf2f3754d8853f/package.json#L60)), which in turn will require a new commit to the `shacl-vue` repository and an updated version published to `npm`. This will in turn require projects using `shacl-vue` to pin the latest version, either by updating the submodule described in the git-repository-based process above or by accessing the latest `shacl-vue` package version from `npm`.
|
|
||||||
72
docs/build-configuration.md
Normal file
72
docs/build-configuration.md
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
---
|
||||||
|
layout: doc
|
||||||
|
---
|
||||||
|
|
||||||
|
# Build configuration
|
||||||
|
|
||||||
|
`shacl-vue` supports the use of build-time configuration options that are supplied either directly as ENV variables or via a config file, for example:
|
||||||
|
|
||||||
|
```
|
||||||
|
BUILD_GIT_COMMIT="$(shell git rev-parse HEAD)" npm run build:app
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```
|
||||||
|
BUILD_CONFIG='path/to/config/file.yaml' npm run build:app
|
||||||
|
```
|
||||||
|
|
||||||
|
The latter allows the specification of config options at build time via a path to a JSON or YAML file, using the `BUILD_CONFIG` environment variable. The file is read by `Vite` at build time and injected into environment variables that are made accessible to the rest of the application in the standard `Vite` approach, i.e. via `import.meta.env.VITE_MY_VARIABLE` in Javascript/VueJS files and `%VITE_MY_VARIABLE%` in HTML. Note that variables specified via such a build config file are not required to have the `VITE_` prefix.
|
||||||
|
|
||||||
|
Currently supported build variables are described below in sections:
|
||||||
|
|
||||||
|
## Build environment details
|
||||||
|
|
||||||
|
### BUILD_CONFIG
|
||||||
|
|
||||||
|
A path to a build-environment-local JSON or YAML file that contains build configuration variables.
|
||||||
|
|
||||||
|
### BUILD_GIT_*
|
||||||
|
|
||||||
|
For easier status checks and debugging, `shacl-vue` UI can display the specifics of a git repository used during the build process. This is shown in the `Settings` dialog, for example:
|
||||||
|
|
||||||
|
<div style="text-align:center">
|
||||||
|
<div style="display:inline-block; padding:0; width:70%">
|
||||||
|
<img src="/build_git_state.png" alt="alt">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
To allow this, four environment variables should be accessible to the build process:
|
||||||
|
- `BUILD_GIT_COMMIT`: The git commit hash of the git repository when the UI was built
|
||||||
|
- `BUILD_GIT_COMMIT_SHORT`: The short version of the commit hash of the git repository when the UI was built
|
||||||
|
- `BUILD_GIT_BRANCH`: The branch of the git repository used during the build
|
||||||
|
- `BUILD_GIT_DATE`: The datetime snapshot at build time
|
||||||
|
|
||||||
|
This can be done dynamically at build time, e.g.:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
BUILD_GIT_COMMIT="$(shell git rev-parse HEAD)" \
|
||||||
|
BUILD_GIT_COMMIT_SHORT="$(shell git rev-parse --short HEAD)" \
|
||||||
|
BUILD_GIT_BRANCH="$(shell git rev-parse --abbrev-ref HEAD)" \
|
||||||
|
BUILD_GIT_DATE="$(shell git show -s --format=%cI HEAD)" npm run build:app
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build outputs
|
||||||
|
|
||||||
|
### VITE_OUT_DIR
|
||||||
|
|
||||||
|
A local path can be provided to specify where the build output files should be saved.
|
||||||
|
|
||||||
|
## UI specifications
|
||||||
|
|
||||||
|
### VITE_SHACLVUE_VARIANT
|
||||||
|
|
||||||
|
This can be used to specify of the `default` or `starter` variant of the UI should be build. See the [`shacl-vue` Starter variant](./features-starter) section for more information.
|
||||||
|
|
||||||
|
## Security specifications
|
||||||
|
|
||||||
|
Some browser-side security features of `shacl-vue` can be configured via build config options, including:
|
||||||
|
|
||||||
|
- `DOMPURIFY`
|
||||||
|
- `CSP_CONTENT`
|
||||||
|
- `FETCH`
|
||||||
|
|
||||||
|
See the [Security features](./features-security) section for a detailed specification.
|
||||||
|
|
@ -18,12 +18,12 @@ flowchart TD
|
||||||
0[App.vue]
|
0[App.vue]
|
||||||
A(ShaclVue)
|
A(ShaclVue)
|
||||||
A2{user selects data type}
|
A2{user selects data type}
|
||||||
A3.1(AppHeader)
|
A31(AppHeader)
|
||||||
A3.2(AppFooter)
|
A32(AppFooter)
|
||||||
D(NodeShapeViewer)
|
D(NodeShapeViewer)
|
||||||
D2.1(BlankNodeViewer)
|
D21(BlankNodeViewer)
|
||||||
D2.2(LiteralNodeViewer)
|
D22(LiteralNodeViewer)
|
||||||
D2.3(NamedNodeViewer)
|
D23(NamedNodeViewer)
|
||||||
E(FormEditor)
|
E(FormEditor)
|
||||||
F(NodeShapeEditor)
|
F(NodeShapeEditor)
|
||||||
G(PropertyShapeEditor)
|
G(PropertyShapeEditor)
|
||||||
|
|
@ -32,22 +32,17 @@ flowchart TD
|
||||||
0 --> |config| A
|
0 --> |config| A
|
||||||
|
|
||||||
A --> A2
|
A --> A2
|
||||||
A --> A3.1
|
A --> A31
|
||||||
A --> A3.2
|
A --> A32
|
||||||
|
|
||||||
A2 --> D
|
A2 --> D
|
||||||
A2 --> |add record| E
|
A2 --> |add record| E
|
||||||
D --> |edit record| E
|
D --> |edit record| E
|
||||||
|
|
||||||
D --> D2.1
|
D --> D21
|
||||||
D --> D2.2
|
D --> D22
|
||||||
D --> D2.3
|
D --> D23
|
||||||
E --> |exactly one instance| F
|
E --> |exactly one instance| F
|
||||||
F --> |one instance per property| G
|
F --> |one instance per property| G
|
||||||
G --> |runs matching code| H
|
G --> |runs matching code| H
|
||||||
|
|
||||||
|
|
||||||
%% B --> C{Decision}
|
|
||||||
%% C -->|One| D[Result 1]
|
|
||||||
%% C -->|Two| E[Result 2]
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
125
docs/features-security.md
Normal file
125
docs/features-security.md
Normal file
|
|
@ -0,0 +1,125 @@
|
||||||
|
---
|
||||||
|
layout: doc
|
||||||
|
---
|
||||||
|
|
||||||
|
# Security features
|
||||||
|
|
||||||
|
Apart from browser-standard web security measures (such as the [Same-origin policy](https://developer.mozilla.org/en-US/docs/Web/Security/Defenses/Same-origin_policy) and [CORS](https://developer.mozilla.org/en-US/docs/Glossary/CORS)), `shacl-vue` includes several configurable security features to protect against possible [attacks](https://developer.mozilla.org/en-US/docs/Web/Security/Attacks). Such measures work preventatively against possible exploits of `shacl-vue`'s config-, schema-, and [content fetching](./app-configuration#content) functionality.
|
||||||
|
|
||||||
|
These features include:
|
||||||
|
- Sanitization of in-app injected HTML to prevent [XSS attacks](https://developer.mozilla.org/en-US/docs/Web/Security/Attacks/XSS)
|
||||||
|
- Specification of a [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/Security/Practical_implementation_guides/CSP)
|
||||||
|
- Heightened security restrictions when using the [`fetch` API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) to get content
|
||||||
|
|
||||||
|
The configurability becomes especially useful in the context of a [multi-tenant deployment](./features-tenant), where the administrator of the `shacl-vue` deployment and the provider of a UI instance configuration are not the same entities. While a tenant will configure the user-facing aspects of their UI/UX, the administrator can retain full control of security-specific configuration for that specific deployment via `shacl-vue`'s build configuration approach.
|
||||||
|
|
||||||
|
Below we describe the security-specific build configuration variables that `shacl-vue` currently supports:
|
||||||
|
|
||||||
|
## Sanitization with `DOMpurify` configuration
|
||||||
|
|
||||||
|
[DOMpurify](https://github.com/cure53/DOMPurify) prevents XSS attacks by sanitizing HTML, SVG, and MathML content on the client side. `shacl-vue` uses this wherever `v-html` directives are used to render HTML content. The `DOMpurify` config option can receive an object with [any standard DOMpurify options](https://github.com/cure53/DOMPurify#can-i-configure-dompurify) to tweak the sanitization behaviour
|
||||||
|
|
||||||
|
The default configuration, which will be overwritten if options are specified via build config, is:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
DOMpurify:
|
||||||
|
WHOLE_DOCUMENT: true
|
||||||
|
USE_PROFILES:
|
||||||
|
html: true
|
||||||
|
svg: true
|
||||||
|
```
|
||||||
|
|
||||||
|
## Content Security Policy configuration
|
||||||
|
|
||||||
|
A [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/Security/Practical_implementation_guides/CSP) provides "fine-grained control over the code that can be loaded on a site, and what it is allowed to do". It protects against [XSS attacks](https://developer.mozilla.org/en-US/docs/Web/Security/Attacks/XSS), [clickjacking](https://developer.mozilla.org/en-US/docs/Web/Security/Attacks/Clickjacking), and [MITM](https://developer.mozilla.org/en-US/docs/Web/Security/Attacks/MITM) attacks.
|
||||||
|
|
||||||
|
The `CSP_CONTENT` build config option can be used to specify [fetch- and other directives](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#fetch_directives) for the deployment, essentially resulting in an "allowlist" of origins that can pass CSP constraints for specific resources. The configured variables will be injected into the `index.html`'s `<meta http-equiv="Content-Security-Policy" content="…">` element.
|
||||||
|
|
||||||
|
There is no default specification, which means that no CSP is included/deployed by default.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
CSP_CONTENT:
|
||||||
|
connect-src:
|
||||||
|
- "'self'"
|
||||||
|
- https://hub.psychoinformatics.de/
|
||||||
|
- https://concepts.datalad.org/
|
||||||
|
```
|
||||||
|
|
||||||
|
Note:
|
||||||
|
- multiple values per directive should be specified as a list
|
||||||
|
- the 'self' specification in any directive, if provided via YAML, should be enclosed in single AND double quotes, in order to retain the required single quotes after injecting it into the `index.html` file.
|
||||||
|
|
||||||
|
## Secure `fetch` configuration
|
||||||
|
|
||||||
|
`shacl-vue` has an internal `secureFetch` method that replaces all app-wide and `GET`-method-specific uses of the standard `fetch` API. This occurs when:
|
||||||
|
- fetching the `shacl-vue` configuration file content
|
||||||
|
- fetching content specified in the `shacl-vue` configuration file
|
||||||
|
- fetch turtle (`ttl`) content from an integrated `dump-things-service` backend
|
||||||
|
|
||||||
|
The reasoning behind `secureFetch` is to tighten security around the content that a `shacl-vue` instance can fetch from URLs that are configuration-supplied. Since these configuration files are not necessarily under the control of a deployment administrator, `shacl-vue` provides admin-level control by allowing build-time configuration of the `secureFetch` method via the `FETCH` option.
|
||||||
|
|
||||||
|
By default, `secureFetch` internally constrains a `fetch` operation to the following options:
|
||||||
|
- `method: 'GET'`
|
||||||
|
- `credentials: 'omit'`
|
||||||
|
- `method: 'cors'`
|
||||||
|
|
||||||
|
Build-time configurable options include:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
FETCH:
|
||||||
|
MAX_BYTES: 5_000
|
||||||
|
TIMEOUT_MS: 10_000
|
||||||
|
CONTENT_TYPES: ...
|
||||||
|
```
|
||||||
|
|
||||||
|
Here:
|
||||||
|
- `MAX_BYTES` specifies the maximum content size that `secureFetch` may fetch. By default this is unspecified and unconstrained.
|
||||||
|
- `TIMEOUT_MS` specifies the maximum time a request is allowed to take before being aborted by the browser. By default this is unspecified and unconstrained.
|
||||||
|
- `CONTENT_TYPES` specifies the standard content types that the application is allowed to `fetch`
|
||||||
|
|
||||||
|
The default in-app-specified content types are:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
json: [
|
||||||
|
'application/json',
|
||||||
|
'application/problem+json',
|
||||||
|
],
|
||||||
|
html: [
|
||||||
|
'text/html',
|
||||||
|
],
|
||||||
|
yaml: [
|
||||||
|
'application/yaml',
|
||||||
|
'application/x-yaml',
|
||||||
|
'text/yaml',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
text: [
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
rdf: [
|
||||||
|
'application/ld+json',
|
||||||
|
'application/rdf+xml',
|
||||||
|
'text/turtle',
|
||||||
|
'application/n-triples',
|
||||||
|
'application/trig',
|
||||||
|
],
|
||||||
|
svg: [
|
||||||
|
'image/svg+xml',
|
||||||
|
],
|
||||||
|
image: [
|
||||||
|
'image/png',
|
||||||
|
'image/jpeg',
|
||||||
|
'image/gif',
|
||||||
|
'image/webp',
|
||||||
|
'image/avif',
|
||||||
|
'image/apng',
|
||||||
|
'image/bmp',
|
||||||
|
],
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
- Build-time specification of ANY `CONTENT_TYPES` will override ALL in-app defaults.
|
||||||
|
- For `CONTENT_TYPES`, the same keys MUST be used to re-specify existing defaults. New keys are not constrained.
|
||||||
|
- The result of a constraint violation is that an error will be thrown which will be visible in the console.
|
||||||
13
docs/features-tenant.md
Normal file
13
docs/features-tenant.md
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
layout: doc
|
||||||
|
---
|
||||||
|
|
||||||
|
# The tenant-based deployment
|
||||||
|
|
||||||
|
::: info
|
||||||
|
TODO
|
||||||
|
:::
|
||||||
|
|
||||||
|
See:
|
||||||
|
- https://hub.psychoinformatics.de/orinoco/shacl-vue/issues/387
|
||||||
|
- [App configuration URL via `x-shacl-vue-config` header](./app-configuration#_1-config-via-request-header-x-shacl-vue-config)
|
||||||
|
|
@ -16,8 +16,7 @@ Think of it as an automatic builder that you just have to feed with a model of y
|
||||||
|
|
||||||
`shacl-vue` is built with [VueJS 3](https://vuejs.org/), [Vuetify](https://vuetifyjs.com), and [Vite](https://vitejs.dev/), and was heavily inspired by the WC3 Draft: [Form Generation using SHACL and DASH](https://datashapes.org/forms.html).
|
`shacl-vue` is built with [VueJS 3](https://vuejs.org/), [Vuetify](https://vuetifyjs.com), and [Vite](https://vitejs.dev/), and was heavily inspired by the WC3 Draft: [Form Generation using SHACL and DASH](https://datashapes.org/forms.html).
|
||||||
|
|
||||||
:rocket: Try out a live demo at https://psychoinformatics-de.github.io/shacl-vue/app
|
:rocket: Try out a live demo at https://pool.psychoinformatics.de/ui
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
|
||||||
|
|
@ -10,14 +10,14 @@ hero:
|
||||||
alt: shacl-vue
|
alt: shacl-vue
|
||||||
actions:
|
actions:
|
||||||
- theme: brand
|
- theme: brand
|
||||||
text: Try it out!
|
text: See it live!
|
||||||
link: https://psychoinformatics-de.github.io/shacl-vue/app
|
link: https://pool.psychoinformatics.de/ui
|
||||||
- theme: alt
|
- theme: alt
|
||||||
text: User Docs
|
text: Docs
|
||||||
link: /get-started
|
link: /get-started
|
||||||
- theme: alt
|
- theme: alt
|
||||||
text: Source
|
text: Source
|
||||||
link: https://hub.psychoinformatics.de/datalink/shacl-vue
|
link: https://hub.psychoinformatics.de/orinoco/shacl-vue
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
28
docs/package-publishing.md
Normal file
28
docs/package-publishing.md
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
---
|
||||||
|
layout: doc
|
||||||
|
---
|
||||||
|
|
||||||
|
# Publishing `shacl-vue` and its dependencies to `npm`
|
||||||
|
|
||||||
|
Relevant `npm` packages are:
|
||||||
|
- [shacl-tulip](https://www.npmjs.com/package/shacl-tulip)
|
||||||
|
- [flatson-js](https://www.npmjs.com/package/flatson-js)
|
||||||
|
- [shacl-vue](https://www.npmjs.com/package/shacl-vue)
|
||||||
|
|
||||||
|
RDF and form data handling functionalities underlying the core `shacl-vue` features are provided by the [`shacl-tulip`](https://hub.psychoinformatics.de/orinoco/shacl-tulip) library (like "`shacl-vue`-lib", but flowery), a core dependency of `shacl-vue`. It is completely independent of VueJS, yet class constructors allow passing reactive objects as arguments, which `shacl-tulip` handles seamlessly. It also focuses purely on library-level functionality and contains no frontend code.
|
||||||
|
|
||||||
|
For table import and export support, `shacl-vue` uses the [FlatSON specification](https://hub.psychoinformatics.de/orinoco/flatson), for which [flatson-js](https://www.npmjs.com/package/flatson-js) provides helper functionality.
|
||||||
|
|
||||||
|
Lastly, while the `shacl-vue` deployment steps above describe a git-repository-based process, it is also possible to use the `shacl-vue` package as a dependency in other VueJS projects. For that reason it is also published to `npm`.
|
||||||
|
|
||||||
|
Publishing any of these packages to `npm` requires:
|
||||||
|
- A registered `npm` user
|
||||||
|
- Maintainer privileges for that user to the relevant `npm` package
|
||||||
|
- Acquiring a local clone of the package's source code repository
|
||||||
|
- Updating the package source code, and in particular bumping the package major/minor version in the `package.json` file (e.g. [here](https://hub.psychoinformatics.de/orinoco/shacl-tulip/src/branch/main/package.json#L3))
|
||||||
|
- A local environment with `nodejs` installed
|
||||||
|
- Running: `npm publish` from the local root directory of the git clone
|
||||||
|
|
||||||
|
_Note that 2FA might be involved in the authentication step_
|
||||||
|
|
||||||
|
If the published version of either `shacl-tulip` or `flatson-js` is changed, the dependency in `shacl-vue` also needs to be updated (e.g. [here](https://hub.psychoinformatics.de/orinoco/shacl-vue/src/commit/6f1651320aa22667bfff808b84bf2f3754d8853f/package.json#L60)), which in turn will require a new commit to the `shacl-vue` repository and an updated version published to `npm`. This will in turn require projects using `shacl-vue` to pin the latest version, either by updating the submodule described in the git-repository-based process above or by accessing the latest `shacl-vue` package version from `npm`.
|
||||||
BIN
docs/public/build_git_state.png
Normal file
BIN
docs/public/build_git_state.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 88 KiB |
|
|
@ -1,9 +1,16 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<meta
|
||||||
|
http-equiv="Content-Security-Policy"
|
||||||
|
content="%CSP_CONTENT%"
|
||||||
|
/>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" href="/favicon.ico" />
|
<link rel="icon" href="/favicon.ico" />
|
||||||
<link rel="stylesheet" type="text/css" href="src/assets/style.css" />
|
<link rel="stylesheet" type="text/css" href="src/assets/style.css" />
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&display=swap">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title></title>
|
<title></title>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
||||||
3038
package-lock.json
generated
3038
package-lock.json
generated
File diff suppressed because it is too large
Load diff
21
package.json
21
package.json
|
|
@ -62,7 +62,7 @@
|
||||||
"@codemirror/theme-one-dark": "^6.1.3",
|
"@codemirror/theme-one-dark": "^6.1.3",
|
||||||
"@codemirror/view": "^6.39.11",
|
"@codemirror/view": "^6.39.11",
|
||||||
"@mdi/font": "7.4.47",
|
"@mdi/font": "7.4.47",
|
||||||
"dompurify": "^3.3.1",
|
"dompurify": "^3.4.17",
|
||||||
"highlight.js": "^11.11.1",
|
"highlight.js": "^11.11.1",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"markdown-it": "^14.1.0",
|
"markdown-it": "^14.1.0",
|
||||||
|
|
@ -76,20 +76,25 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^6.0.1",
|
"@vitejs/plugin-vue": "^6.0.1",
|
||||||
"happy-dom": "^20.0.11",
|
"happy-dom": "^20.0.11",
|
||||||
"mermaid": "^11.11.0",
|
"mermaid": "^12.2.0",
|
||||||
"prettier": "^3.6.2",
|
"prettier": "^3.6.2",
|
||||||
"sass": "^1.92.1",
|
"sass": "^1.92.1",
|
||||||
"unplugin-fonts": "^1.4.0",
|
"unplugin-vue-components": "^32.1.0",
|
||||||
"unplugin-vue-components": "^29.0.0",
|
|
||||||
"vite": "^7.1.5",
|
"vite": "^7.1.5",
|
||||||
"vite-plugin-vuetify": "^2.1.2",
|
"vite-plugin-vuetify": "^2.1.2",
|
||||||
"vitepress": "^1.6.4",
|
"vitepress": "^2.0.0-alpha.20",
|
||||||
"vitepress-plugin-mermaid": "^2.0.17",
|
"vitepress-mermaid-viewer": "^0.5.1",
|
||||||
"vitest": "^3.2.4",
|
"vitest": "^5.0.5",
|
||||||
"vue": "^3.5.21"
|
"vue": "^3.5.21",
|
||||||
|
"vuetify": "^3.11.4"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"vue": "^3.5.21",
|
"vue": "^3.5.21",
|
||||||
"vuetify": "^3.11.4"
|
"vuetify": "^3.11.4"
|
||||||
|
},
|
||||||
|
"overrides": {
|
||||||
|
"vitepress-mermaid-viewer": {
|
||||||
|
"vitepress": "$vitepress"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,12 +92,12 @@
|
||||||
@submit.prevent="saveForm()"
|
@submit.prevent="saveForm()"
|
||||||
>
|
>
|
||||||
<br />
|
<br />
|
||||||
<p v-html="formattedDescription" class="quote-description"></p>
|
<SanitizedHtmlViewer as="p" :html="formattedDescription" class="quote-description"/>
|
||||||
<div style="margin-top: 0.3em;"></div>
|
<div style="margin-top: 0.3em;"></div>
|
||||||
<span v-if="fieldNotes">
|
<span v-if="fieldNotes">
|
||||||
<span v-for="(note, i) in fieldNotes">
|
<span v-for="(note, i) in fieldNotes">
|
||||||
<em v-if="i == 0"><p v-html="addCodeTagsToText(note, 'Notes: <br/>* ')" class="quote-description"></p></em>
|
<em v-if="i == 0"><SanitizedHtmlViewer as="p" :html="addCodeTagsToText(note, 'Notes: <br/>* ')" class="quote-description"/></em>
|
||||||
<em v-else><p v-html="addCodeTagsToText(note, '* ')" class="quote-description"></p></em>
|
<em v-else><SanitizedHtmlViewer as="p" :html="addCodeTagsToText(note, '* ')" class="quote-description"/></em>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<br />
|
<br />
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,7 @@
|
||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col cols="12" md="6" class="pa-4">
|
<v-col cols="12" md="6" class="pa-4">
|
||||||
<div
|
<SanitizedHtmlViewer as="div" :html="renderedMarkdown" class="markdown-preview"/>
|
||||||
class="markdown-preview"
|
|
||||||
v-html="renderedMarkdown"
|
|
||||||
/>
|
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
|
|
|
||||||
|
|
@ -218,11 +218,11 @@
|
||||||
>
|
>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</span>
|
</span>
|
||||||
<p v-html="addCodeTagsToText(localPropertyShape[SHACL.description.value])"></p>
|
<SanitizedHtmlViewer as="p" :html="addCodeTagsToText(localPropertyShape[SHACL.description.value])"/>
|
||||||
<span v-if="fieldNotes">
|
<span v-if="fieldNotes">
|
||||||
<span v-for="(note, i) in fieldNotes">
|
<span v-for="(note, i) in fieldNotes">
|
||||||
<em v-if="i == 0"><p v-html="addCodeTagsToText(note, '<br/>Notes: <br/>* ')"></p></em>
|
<em v-if="i == 0"><SanitizedHtmlViewer as="p" :html="addCodeTagsToText(note, 'Notes: <br/>* ')"/></em>
|
||||||
<em v-else><p v-html="addCodeTagsToText(note, '* ')"></p></em>
|
<em v-else><SanitizedHtmlViewer as="p" :html="addCodeTagsToText(note, '* ')"/></em>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<v-icon :size="size">
|
<v-icon :size="size">
|
||||||
<span
|
<SanitizedHtmlViewer as="span" :html="icon" class="custom-svg"/>
|
||||||
class="custom-svg"
|
|
||||||
v-html="icon"
|
|
||||||
/>
|
|
||||||
</v-icon>
|
</v-icon>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
40
src/components/SanitizedHtmlViewer.vue
Normal file
40
src/components/SanitizedHtmlViewer.vue
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<component
|
||||||
|
:is="as"
|
||||||
|
v-bind="$attrs"
|
||||||
|
v-html="sanitizedHtml"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import DOMPurify from 'dompurify'
|
||||||
|
|
||||||
|
const config = import.meta.env.DOMPURIFY || {
|
||||||
|
WHOLE_DOCUMENT: true,
|
||||||
|
USE_PROFILES: {
|
||||||
|
html: true,
|
||||||
|
svg: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
inheritAttrs: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
html: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
as: {
|
||||||
|
type: String,
|
||||||
|
default: 'div',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const sanitizedHtml = computed(() =>
|
||||||
|
DOMPurify.sanitize(props.html, config)
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
@ -151,7 +151,7 @@
|
||||||
</span>
|
</span>
|
||||||
<!-- If no class is selected, and there is HTML frontpage specified, show it -->
|
<!-- If no class is selected, and there is HTML frontpage specified, show it -->
|
||||||
<span v-else-if="frontPageHTML" style="margin-top: 1em; margin-left: 1em;">
|
<span v-else-if="frontPageHTML" style="margin-top: 1em; margin-left: 1em;">
|
||||||
<div v-html="frontPageHTML"></div>
|
<SanitizedHtmlViewer as="div" :html="frontPageHTML"/>
|
||||||
</span>
|
</span>
|
||||||
<!-- If no class is selected and no frontpage specified, show simple sentence -->
|
<!-- If no class is selected and no frontpage specified, show simple sentence -->
|
||||||
<span v-else style="margin-top: 1em; margin-left: 1em;">
|
<span v-else style="margin-top: 1em; margin-left: 1em;">
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue