elan-ev / tobira

Video portal for Opencast
https://elan-ev.github.io/tobira/
Apache License 2.0
20 stars 17 forks source link

University/organization-specific adjustments (design or otherwise) #75

Open LukasKalbertodt opened 3 years ago

LukasKalbertodt commented 3 years ago

We expect that organizations (mostly universities) need to adjust the design of their Tobira instance to match their cooperate identity. This issue tracks this general feature and collects ideas and notes about the topic.

What things need to be adjustable?

Potential additional requirements

Some general thoughts

We were tasked to make Tobira rather customizable. However, adding more way to customize Tobira adds complexity and makes everything less robust, potentially even slower. Tobira is not supposed to be a full-blown CMS or even website-builder.

Implementation ideas

Customizing Tobira should not require recompiling/bundling anything. Users should be able to grab a precompiled version, run it and change configuration files to adjust the design.

The other "potential" requirements seem rather difficult to implement. Custom CSS is tricky as we use CSS-in-JS. I don't know how a raw included CSS could best overwrite values set by JS. Two logos or a notably different page layout is also pretty tricky: I wouldn't know how to support that.

JulianKniephoff commented 3 years ago
  • [...] Can CSS variable hold "list" as usually specified for font-family? E.g. font-family: 'Open Sans', 'Arial', sans-serif;

Yes, they can.

lkiesow commented 3 years ago
LukasKalbertodt commented 3 years ago

We don't need to care about how people serve these files.

Mh good point. I guess if we recommend an nginx (or whatever) in front of tobira anyway, they can also add some filter/handler for static files there. However, I think I would still prefer if Tobira would serve that file. And it's really super simple to implement and would be a bit more convenient for users. Will see.

We should avoid generating the style inline (content security policy).

Can you elaborate on that? Inline CSS in the main HTML file shouldn't be a problem, right? But I also don't know a lot about CSP.

We choose the font. [...] I don't think we need this configurable.

I also don't want to make it configurable. Not only would it be more work for us, other fonts could easily break some parts of the design. However, I guess that's not entirely our decision to make, right? If most institutions would strongly require their fonts to be used... ?

lkiesow commented 3 years ago

Can you elaborate on that? Inline CSS in the main HTML file shouldn't be a problem, right? But I also don't know a lot about CSP.

Having inline scripts and/or styles requires script-src/style-src set to unsafe-inline. The basic idea behind avoiding this is that it's way harder for attackers to inject unsafe code if you can't just include it and if – best case – it's even narrowed down further to something like …-src 'self', where you would need to be able to serve a fine from the same domain to include it.

Scripts are obviously more problematic here but even with injected CSS you can do nasty things (e.g. loading trackers, …).

Obviously, the goal should be to avoid injection altogether but the CSP is basically a nice second line of defense.

lkiesow commented 3 years ago

However, I guess that's not entirely our decision to make, right? If most institutions would strongly require their fonts to be used... ?

For now, I think it is and we shouldn't push for it. If you start asking people if they really don't need special fonts they will surely need it. The requirement has never popped up anywhere except for you pushing it here, has it?

LukasKalbertodt commented 3 years ago

Regarding CSP: interesting, but makes sense, we probably want to avoid allowing unsafe-inline.

It's worth noting that we currently already use inline <style> to include the custom fonts. Also note that our main CSS code is defined in JS (CSS-in-JS library), so there is no .css file that we currently serve anywhere. Of course we can push that to an external CSS file. Will see about that.

The requirement has never popped up anywhere except for you pushing it here, has it?

Well, not specifically regarding Tobira, no. But I talked to two people asking about the CI/CD of their university and they both mentioned fonts as something that should be adjustable.

But ok, then let's not implement that for now.

JulianKniephoff commented 3 years ago

Regarding CSP again: There is also possibly a middle ground between unsafe-inline and specifying origins (including self) and thus allowing only files: See the last two options in the sources list here.

We would either have to generate a nonce on every request which we then inject into the inline styles, or we just hash the inline scripts/styles and list these hashes in the CSP.

This is spec'ed in CSP Level 2. Browser support is not perfect, yet, but should suffice for what we want.

I would prefer that to deoptimizing our styles/scripts or otherwise letting this influence our decisions regarding how we use JS/CSS in the app. Plus, certain dynamic styling things just aren't possible or much harder if you are restricted to just static files. I don't know if we need any of those, but thinking about configurable styles -- depending of course on how exactly they will be implemented -- it certainly doesn't sound too absurd to me. :thinking: