Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ version may change things that need attention when updating, and these notes say

### For curators

- An item can be shown as a **record only**: visitors get its title, description, date, place and credit, but no picture, page
image or recording, and search does not find what its PDFs or captions say. Choose "What visitors get" on the item's page;
the item list shows a "Record only" badge. Exports of published items leave out the files of such items; the full export
keeps them (export format version 7).
- The page of an item shows its **earlier texts**: when the title, description, date, credit, original location or reference
number was changed, by whom, and what it said before, shown beside what the field says now. A curator can put an earlier text back with one button; the text it
replaces is kept in turn. Texts from before this version have no history, and the history is not part of the export.
Expand Down Expand Up @@ -51,6 +55,8 @@ Updating needs no picture regeneration. Migrations run by themselves at start.

### For visitors and curators

- A collection with nothing public in it, only drafts or items in the bin, no longer has a page of its own, and the search's
collection filter no longer lists it. Before, anyone who knew or guessed its number could read its title and description.
- A year, decade, month or period typed into the search, such as "Mill Street 1950s", "circa 1960" or "before 1945", also finds
what is dated then. The page says how it read the date. Curators' item list searches the same way.
- The start page shows the archive through the decades, and the search shows the decades of what it found. Each decade opens
Expand Down
2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ queue server and no build step for the front end: pages work without JavaScript,

What is special about it, and easy to break by accident:

- **Only published items are public.** Public pages go through `db.PublishedItems`, and `/media` serves nothing else.
- **Only published items are public.** Public pages go through `db.VisibleItems`, and `/media` serves only `db.VisibleMedia`.
- **Originals are private.** Visitors only ever see generated pictures, which carry no EXIF. So GPS positions stay private.
- **A contributor's personal details stay with curators.** They are never on a public page unless a curator chose so, and never in
the activity log.
Expand Down
2 changes: 1 addition & 1 deletion docs/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ none of them most, and null if never chosen), and `otherContentLanguages`, separ
`rejectedKeptMonths` are how long records are kept (null for always), and each item's `rejectedOrWithdrawnAt` is when that time
started for it.

`archive.json` has `"format": "commonage-export"` and `"version": 6`. Version 6 added `pageCount` to each file (for a PDF, how many pages have a preview; the page pictures and the text read from a PDF for search are left out, because they can be made again from the file). Version 5 added `helpWanted` to each item, also in an export of published items, because the page "Can you help?" shows it. Version 4 added `tags`, each with its `name` and `kind`
`archive.json` has `"format": "commonage-export"` and `"version": 7`. Version 7 added `mediaLevel` to each item (`Everything` or `RecordOnly`). In an export of published items, the files of a record-only item are left out, because visitors never get them. Version 6 added `pageCount` to each file (for a PDF, how many pages have a preview; the page pictures and the text read from a PDF for search are left out, because they can be made again from the file). Version 5 added `helpWanted` to each item, also in an export of published items, because the page "Can you help?" shows it. Version 4 added `tags`, each with its `name` and `kind`
(`Topic`, `Place` or `Person`); items still list their tags by name. Each collection also has its `position` among the others,
the `sort` of its items (`RecentlyAdded`, `OldestFirst` or `NewestFirst`) and `coverFileId`, the `id` of the file chosen as its
cover, or null when none is chosen or that file is not in the export. Items also have `notes`, the messages visitors sent through
Expand Down
2 changes: 2 additions & 0 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,8 @@ shows the years of its published items. M19 is complete.
**M27 Visibility levels**

- The plan is in [plan-m27-visibility.md](plan-m27-visibility.md).
- *Built (part 1):* `VisibleItems` and `VisibleMedia` replace `PublishedItems`; the matrix and guard tests are in. It found two
leaks that were already there (a collection page and the search filter naming a collection with nothing public), now fixed.
- First a record without its media, then an embargo date. `PublishedItems` becomes `VisibleItems(viewer)`. Members-only waits
for a group to ask, because visitor accounts are not planned. A separate plan and an adversarial privacy review come before
any code, and every public page, the feed, the sitemap, link previews and the published-only export get a test with such
Expand Down
2 changes: 1 addition & 1 deletion docs/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ vulnerability, see [SECURITY.md](../SECURITY.md).

| Area | Measure |
|---|---|
| Access | Public pages and public image addresses read only from published items (`PublishedItems`). Admin pages are protected by policy per folder; admin-only pages (accounts, export, activity log) by a second policy. Originals and previews of unpublished items are served only to curators. What a curator chooses ahead of publishing, such as a draft's photo as a collection's cover, is passed over until its item is published. Tested in `PublicationTests`, `MediaTests`, `AccountTests`, `ExportTests`, `CollectionTests`. `EndpointAccessTests` lists every address that is open without a login, so a new one cannot be open by accident. |
| Access | Public pages and public image addresses read only from published items (`VisibleItems`, `VisibleMedia`). Admin pages are protected by policy per folder; admin-only pages (accounts, export, activity log) by a second policy. Originals and previews of unpublished items are served only to curators. An item shown as a record only (`MediaLevel.RecordOnly`) gives visitors no file, thumbnail, cover, link-preview picture or PDF-text match; `VisibleMedia` and `Visibility.ItemWithMedia` are the one place that decides, and `ItemFilter.SearchAllFileText` is off unless a curator searches. What a curator chooses ahead of publishing, such as a draft's photo as a collection's cover, is passed over until its item is published. Tested in `PublicationTests`, `MediaTests`, `AccountTests`, `ExportTests`, `CollectionTests`. `EndpointAccessTests` lists every address that is open without a login, so a new one cannot be open by accident. |
| Accounts | Passwords of at least 12 characters (length over forced symbols, NIST SP 800-63B). Five wrong passwords lock an account for five minutes, and one address can try 100 logins an hour. Accounts are created with one-time setup links, valid seven days. Disabling an account, or a password change, ends its logins within a minute. Admins cannot lock themselves out. An authenticator app (TOTP) can be added to each login, and admins can require it of everyone who manages the archive; wrong codes count towards the lockout like wrong passwords. Ten recovery codes, each usable once. Turning the app off or making new codes asks for the password again, and wrong passwords there and on "Change password" count towards the lockout too. Tested in `TwoFactorTests`. |
| Forms | Every form carries an antiforgery token. Redirects after login and language change only go to addresses on this site. |
| Staff names and last login | `StaffProfiles` holds an optional display name and the time of the last login per account, written after a successful login (password, authenticator code or recovery code). Read only on the admin-only Accounts pages, never on a public page, feed or link preview, and not in the export or the activity log (which keeps the email address). Changing a name is logged. The row goes with the account (cascade). `AccountTests`. |
Expand Down
3 changes: 2 additions & 1 deletion src/Commonage.Web/Audit/AuditText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public static class AuditText
AuditAction.ItemChanged => localizer["Changed the item"],
AuditAction.ItemPublished => localizer["Published the item"],
AuditAction.ItemUnpublished => localizer["Unpublished the item"],
AuditAction.ItemMediaLevelChanged => localizer["Changed what visitors get of the item"],
AuditAction.ItemFieldRestored => localizer["Restored an earlier text of the item"],
AuditAction.ItemDeleted => localizer["Deleted the item for good"],
AuditAction.ItemMovedToBin => localizer["Moved the item to the bin"],
Expand Down Expand Up @@ -82,7 +83,7 @@ public static class AuditText

public static AuditKind KindOf(AuditAction action) => action switch
{
AuditAction.ItemCreated or AuditAction.ItemChanged or AuditAction.ItemFieldRestored or AuditAction.ItemPublished or AuditAction.ItemUnpublished
AuditAction.ItemCreated or AuditAction.ItemChanged or AuditAction.ItemFieldRestored or AuditAction.ItemPublished or AuditAction.ItemUnpublished or AuditAction.ItemMediaLevelChanged
or AuditAction.ItemDeleted or AuditAction.ItemMovedToBin or AuditAction.ItemRestored or AuditAction.ItemPurged
or AuditAction.ItemMovedToBinAfterKeptTime or AuditAction.ItemsImported => AuditKind.Items,
AuditAction.PhotosAdded or AuditAction.PhotosArranged or AuditAction.PhotoDeleted or AuditAction.PhotoMovedToBin
Expand Down
5 changes: 4 additions & 1 deletion src/Commonage.Web/Data/CommonageDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ public class CommonageDbContext(DbContextOptions<CommonageDbContext> options)
public const string FoldFunction = "commonage_fold";

/// <summary>Items the public may see. Every public page must start from this query.</summary>
public IQueryable<ArchiveItem> PublishedItems => ArchiveItems.Where(i => i.Status == ItemStatus.Published);
public IQueryable<ArchiveItem> VisibleItems => ArchiveItems.Where(Visibility.Item);

/// <summary>Files the public may be given. <c>/media</c> and every cover or first photo start from this.</summary>
public IQueryable<MediaFile> VisibleMedia => MediaFiles.Where(Visibility.Media);

/// <summary>Items in the bin. Query filters hide them from every other query, see <see cref="OnModelCreating"/>.</summary>
public IQueryable<ArchiveItem> BinnedItems => ArchiveItems.IgnoreQueryFilters().Where(i => i.DeletedAt != null);
Expand Down
Loading