Commit graph

6 commits

Author SHA1 Message Date
Franciszek Stachura
1762568c85 web: Meta descriptions improvements
* Make source tree descriptions shorter
* Make default title more descriptive
* Add a short summary of results to ident search description
2024-11-05 12:20:02 +01:00
Franciszek Stachura
8c5e12fffd Add support for 'raw' parameter for source files
This parameter makes the server return a response with raw file
contents and headers that cause the browser to show a 'save as' dialog.

Regarding Content-Security-Policy:

https://www.w3.org/TR/CSP2/#sandbox-usage

> For example, a message board or email system might provide downloads of
> arbitrary attachments provided by other users. Attacks that rely on tricking
> a client into rendering one of these attachments could be mitigated by
> requesting that resources only be rendered in a very restrictive sandbox.
> Sending the sandbox directive with an empty value establishes such an
> environment:
>
> Content-Security-Policy: sandbox

https://www.w3.org/TR/CSP2/#directive-default-src

> Given this behavior, one good way of building a policy for a site would be to
> begin with a default-src of 'none', and to build up a policy from there that
> contains only those resource types which are actually in use for the page
> you’d like to protect. If you don’t use webfonts, for instance, there’s no
> reason to specify a source list for font-src; specifying only those resource
> types a page uses ensures that the possible attack surface for that page
> remains as small as possible.

https://cheatsheetseries.owasp.org/cheatsheets/Content_Security_Policy_Cheat_Sheet.html#defense-in-depth

> A strong CSP provides an effective second layer of protection against various
> types of vulnerabilities, especially XSS. Although CSP doesn't prevent web
> applications from containing vulnerabilities, it can make those
> vulnerabilities significantly more difficult for an attacker to exploit.

The idea is to prevent the browser from loading any external resources, if it
turned out it's possible to trick it into interpreting a file as HTML.
2024-09-05 14:12:53 +02:00
Franciszek Stachura
7d629429bf Generate different meta tag descriptions for different views
Added an ability to customize contents of meta description tag in
templates that inherit from layout. This replaces the default
description previously used in all views.
This change could help with SEO and missing descriptions in search
results (#167). It's based on advice from
https://developers.google.com/search/docs/appearance/snippet

> Create unique descriptions for each page on your site
> Programmatically generate descriptions

This is not guaranteed to fix the issue, search engines are opaque.

All custom descriptions start with "Elixir Cross Referencer - ".

Currently customized descriptions:
* source - path to the file, project name and version
* ident - name of the searched identifier, project name and version

Everything else uses the previous, default description.
2024-08-20 10:35:17 +02:00
Franciszek Stachura
decc2680b2 Move title generation to templates 2024-07-30 15:16:11 +02:00
Franciszek Stachura
6e0a1ad64c Move source page generation to templates 2024-07-30 12:49:29 +02:00
Franciszek Stachura
36ae9046f4 Move ident template to a new file 2024-07-30 12:49:29 +02:00