@jwilleke/ngdpbase-types 5.42.0 → 5.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/src/context/ApiContext.d.ts +10 -3
- package/lib/src/context/ApiContext.js +37 -4
- package/lib/src/context/BaseContext.d.ts +20 -20
- package/lib/src/context/BaseContext.js +41 -24
- package/lib/src/context/JobContext.d.ts +31 -0
- package/lib/src/context/JobContext.js +34 -1
- package/lib/src/ice/runExport.d.ts +8 -3
- package/lib/src/ice/searchExportSource.d.ts +44 -0
- package/lib/src/ice/types.d.ts +6 -0
- package/lib/src/managers/AddonsManager.d.ts +0 -28
- package/lib/src/managers/AgentTokenManager.d.ts +8 -0
- package/lib/src/managers/AttachmentManager.d.ts +11 -0
- package/lib/src/managers/AuditManager.d.ts +0 -1
- package/lib/src/managers/AuthManager.d.ts +38 -0
- package/lib/src/managers/AuthManager.js +84 -12
- package/lib/src/managers/BackupManager.d.ts +9 -2
- package/lib/src/managers/BackupManager.js +42 -19
- package/lib/src/managers/BaseManager.d.ts +17 -3
- package/lib/src/managers/BaseManager.js +12 -8
- package/lib/src/managers/ConfigurationManager.d.ts +28 -0
- package/lib/src/managers/ConsentManager.d.ts +1 -1
- package/lib/src/managers/DatabaseManager.js +17 -8
- package/lib/src/managers/EmailManager.d.ts +1 -1
- package/lib/src/managers/ExportManager.d.ts +1 -44
- package/lib/src/managers/ExportManager.js +3 -115
- package/lib/src/managers/ImportManager.d.ts +7 -0
- package/lib/src/managers/PageManager.d.ts +194 -23
- package/lib/src/managers/PolicyEvaluator.d.ts +182 -24
- package/lib/src/managers/ShareManager.d.ts +3 -2
- package/lib/src/managers/ThemeManager.d.ts +20 -1
- package/lib/src/managers/UserManager.d.ts +19 -5
- package/lib/src/managers/ValidationManager.d.ts +3 -1
- package/lib/src/providers/AgentTokenAuthProvider.js +1 -1
- package/lib/src/providers/BaseAuthProvider.d.ts +2 -0
- package/lib/src/providers/FileLoggingProvider.d.ts +12 -1
- package/lib/src/providers/FileLoggingProvider.js +37 -4
- package/lib/src/security/PolicyDecisionPoint.d.ts +107 -4
- package/lib/src/security/PolicyInformationPoint.d.ts +113 -7
- package/lib/src/security/ownedRecords.d.ts +69 -0
- package/lib/src/security/permissions.generated.d.ts +8 -0
- package/lib/src/security/signedOutWrites.d.ts +69 -0
- package/lib/src/security/signedOutWrites.js +146 -0
- package/lib/src/types/Page.d.ts +0 -7
- package/lib/src/types/Policy.d.ts +65 -8
- package/lib/src/types/Policy.js +6 -0
- package/lib/src/types/Provider.d.ts +12 -0
- package/lib/src/types/User.d.ts +6 -0
- package/lib/src/utils/addonConfigLayer.d.ts +6 -3
- package/lib/src/utils/addonConfigLayer.js +61 -3
- package/lib/src/utils/addonHost.d.ts +25 -0
- package/lib/src/utils/addonHost.js +29 -1
- package/lib/src/utils/addonPageSync.d.ts +0 -12
- package/lib/src/utils/auditEventNames.generated.d.ts +2 -0
- package/lib/src/utils/auditEventNames.generated.js +2 -0
- package/lib/src/utils/auditEvents.d.ts +2 -0
- package/lib/src/utils/auditEvents.js +3 -1
- package/lib/src/utils/availability.d.ts +15 -0
- package/lib/src/utils/availability.js +88 -0
- package/lib/src/utils/frontmatterAccess.d.ts +15 -24
- package/lib/src/utils/legacyStoreKeys.d.ts +16 -0
- package/lib/src/utils/pageTitleConflict.d.ts +32 -0
- package/lib/src/utils/pageWritePolicies.d.ts +74 -0
- package/lib/src/utils/permissionCatalog.d.ts +2 -0
- package/lib/src/utils/permissionCatalog.js +19 -0
- package/lib/src/utils/plainAttention.d.ts +19 -0
- package/lib/src/utils/plainAttention.js +18 -0
- package/lib/src/utils/policyAttributes.d.ts +232 -0
- package/lib/src/utils/policyAttributes.js +404 -0
- package/lib/src/utils/privateStoreAccess.d.ts +24 -4
- package/lib/src/utils/privateStoreAccess.js +19 -4
- package/lib/src/utils/roleGrants.d.ts +1 -1
- package/lib/src/utils/username.d.ts +13 -2
- package/lib/src/utils/username.js +18 -3
- package/package.json +7 -7
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A save refused because another public page already has the title (#2371),
|
|
3
|
+
* or a name whose slug is the same as that page's (#2376).
|
|
4
|
+
*
|
|
5
|
+
* The message keeps the other page's id, for the log. What the reader sees is
|
|
6
|
+
* {@link pageTitleConflictText} and the link in {@link pageTitleConflictLink}:
|
|
7
|
+
* the title, never the id. A private-store clash is a plain Error that names
|
|
8
|
+
* nothing (#1461), so it is not this class.
|
|
9
|
+
*/
|
|
10
|
+
/** The page that has the name, as the error page and the editor's JSON carry it. */
|
|
11
|
+
export interface ConflictingPage {
|
|
12
|
+
title: string;
|
|
13
|
+
url: string;
|
|
14
|
+
/** Only the slugs match: the view says the name is too close, not taken. */
|
|
15
|
+
tooClose?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare class PageTitleConflictError extends Error {
|
|
18
|
+
readonly title: string;
|
|
19
|
+
readonly tooClose: boolean;
|
|
20
|
+
readonly code = "page-title-conflict";
|
|
21
|
+
/**
|
|
22
|
+
* @param title the title of the page that already has it
|
|
23
|
+
* @param pageId that page's id, for the message only
|
|
24
|
+
* @param requested the title the save asked for, when it differs only by case
|
|
25
|
+
* @param tooClose the titles differ and only their slugs match
|
|
26
|
+
*/
|
|
27
|
+
constructor(title: string, pageId: string, requested?: string, tooClose?: boolean);
|
|
28
|
+
}
|
|
29
|
+
/** What the reader is told. */
|
|
30
|
+
export declare function pageTitleConflictText(err: PageTitleConflictError): string;
|
|
31
|
+
/** Where the title links to: the other page's title and its `/view/…` URL. */
|
|
32
|
+
export declare function pageTitleConflictLink(err: PageTitleConflictError): ConflictingPage;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Policy } from '../types/Policy.js';
|
|
2
|
+
/**
|
|
3
|
+
* Where the denies an administrator marked as checked are kept (#2355): rule id to the fingerprint of
|
|
4
|
+
* the rule as it was then. A mark hides the dashboard item and is read by nothing that decides access.
|
|
5
|
+
*/
|
|
6
|
+
export declare const CHECKED_DENIES_KEY = "ngdpbase.access.checked-denies";
|
|
7
|
+
/** Where the "Mark as checked" button on the dashboard item posts (#2355). */
|
|
8
|
+
export declare const DENY_CHECKED_ACTION = "/admin/access-policies/deny-checked";
|
|
9
|
+
/** A stable hash of a whole rule, its id included, so a changed rule (or the same content under another name) is a different one (#2355). */
|
|
10
|
+
export declare function policyFingerprint(policy: Policy): string;
|
|
11
|
+
/** What the migration did and found, one sentence each. */
|
|
12
|
+
export interface PageWritePolicyReport {
|
|
13
|
+
/** Stored shipped policies rewritten in memory. */
|
|
14
|
+
rewritten: string[];
|
|
15
|
+
/** Policies left alone that now decide differently, or reopen pushed pages. */
|
|
16
|
+
review: string[];
|
|
17
|
+
/** Each `rewritten` line, in plain words, for the needs-attention entry (no permission ids, issue numbers or setting names). */
|
|
18
|
+
shown: Record<string, string>;
|
|
19
|
+
}
|
|
20
|
+
/** One finding for the start-up log (`log`, in full) and for the needs-attention entry (`plain`, in plain words). */
|
|
21
|
+
export interface PolicyFinding {
|
|
22
|
+
log: string;
|
|
23
|
+
plain: string;
|
|
24
|
+
/** Set when the finding is an allow rule the upgrade notice already lists (`openWriteRules`); the needs-attention item leaves it out. */
|
|
25
|
+
coveredByUpgradeNotice?: boolean;
|
|
26
|
+
/** Set on a deny (#2355): the rule, its fingerprint now, and whether an administrator marked exactly this content as checked. */
|
|
27
|
+
deny?: {
|
|
28
|
+
id: string;
|
|
29
|
+
fingerprint: string;
|
|
30
|
+
checked: boolean;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Rewrite the stored copies of the moved shipped policies, in `policies` (the
|
|
35
|
+
* custom layer's `ngdpbase.access.policies`), and return what was done and
|
|
36
|
+
* what an administrator should review. Returns the list to store in place of
|
|
37
|
+
* the input; the input is not changed.
|
|
38
|
+
*/
|
|
39
|
+
export declare function migrateStoredPageWritePolicies(policies: unknown): {
|
|
40
|
+
policies: unknown;
|
|
41
|
+
report: PageWritePolicyReport;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Policies in force that an administrator should review after #2255: an
|
|
45
|
+
* allow that grants a page write on a `page` resource to a role other than
|
|
46
|
+
* admin (it reaches pushed pages), an allow that grants anything but
|
|
47
|
+
* page-read to `anyone` or `authenticated` (#2261, #2283), and every deny (a deny now overrides any
|
|
48
|
+
* allow; one an administrator marked as checked is still reported, with `deny.checked` set, #2355). Each is a log line in full and the same finding in plain words.
|
|
49
|
+
*/
|
|
50
|
+
export declare function pageWritePolicyFindings(policies: readonly Policy[], checked?: Readonly<Record<string, string>>): PolicyFinding[];
|
|
51
|
+
/** The log lines of {@link pageWritePolicyFindings}. */
|
|
52
|
+
export declare function pageWritePoliciesToReview(policies: readonly Policy[]): string[];
|
|
53
|
+
/** An allow rule in force that lets more people write than the shipped rules do (#2355 handles denies, not this). */
|
|
54
|
+
export interface OpenWriteRule {
|
|
55
|
+
id: string;
|
|
56
|
+
/** Who: everyone including signed-out visitors, every signed-in user, or the named roles other than admin. */
|
|
57
|
+
who: {
|
|
58
|
+
kind: 'anyone';
|
|
59
|
+
} | {
|
|
60
|
+
kind: 'authenticated';
|
|
61
|
+
} | {
|
|
62
|
+
kind: 'roles';
|
|
63
|
+
roles: string[];
|
|
64
|
+
};
|
|
65
|
+
/** The actions it grants; for `anyone` and `authenticated`, without page-read. `*` means everything. */
|
|
66
|
+
actions: string[];
|
|
67
|
+
resources: NonNullable<Policy['resources']>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The allow rules in force that let `anyone` (signed-out visitors) or `authenticated` (every signed-in user)
|
|
71
|
+
* do more than page-read, or give page writes to a role other than admin. Deny rules are left out.
|
|
72
|
+
* Computed from the policies it is given, so what it returns follows the current policies.
|
|
73
|
+
*/
|
|
74
|
+
export declare function openWriteRules(policies: readonly Policy[]): OpenWriteRule[];
|
|
@@ -25,6 +25,8 @@ export declare function grantablePermissions<T>(definitions: Record<string, T> |
|
|
|
25
25
|
export declare const RETIRED_PERMISSIONS: ReadonlyMap<string, readonly string[]>;
|
|
26
26
|
/** The names with every retired permission replaced by what it stood for, de-duplicated, order kept. */
|
|
27
27
|
export declare function withRetiredExpanded(names: readonly string[]): string[];
|
|
28
|
+
/** The names a policy may grant `action` under (#2255): a page write and its pushed-pages twin, else the action alone. */
|
|
29
|
+
export declare function pageWriteAlternatives(action: string): string[];
|
|
28
30
|
/**
|
|
29
31
|
* What the standard OpenID Connect sign-in scopes let an app see, in plain
|
|
30
32
|
* words (#1572). They are not permissions, so they are not in the catalog;
|
|
@@ -50,6 +50,25 @@ export function withRetiredExpanded(names) {
|
|
|
50
50
|
}
|
|
51
51
|
return out;
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* The pushed-pages permission for each page write (#2255). A page in a
|
|
55
|
+
* pushed category (shipped by the system or an add-on: `system`,
|
|
56
|
+
* `documentation`, `addon` as shipped) is changed by holders of
|
|
57
|
+
* `pushed-pages-<verb>`; any other page by holders of `page-<verb>`. Which
|
|
58
|
+
* categories are which is the policies' to say — each grants one or the
|
|
59
|
+
* other on `system-category` resources — so a page write is asked as either
|
|
60
|
+
* name, and the policies on the page's category decide.
|
|
61
|
+
*/
|
|
62
|
+
const PUSHED_PAGE_WRITES = {
|
|
63
|
+
'page-edit': 'pushed-pages-edit',
|
|
64
|
+
'page-delete': 'pushed-pages-delete',
|
|
65
|
+
'page-rename': 'pushed-pages-rename'
|
|
66
|
+
};
|
|
67
|
+
/** The names a policy may grant `action` under (#2255): a page write and its pushed-pages twin, else the action alone. */
|
|
68
|
+
export function pageWriteAlternatives(action) {
|
|
69
|
+
const pushed = PUSHED_PAGE_WRITES[action];
|
|
70
|
+
return pushed ? [action, pushed] : [action];
|
|
71
|
+
}
|
|
53
72
|
/**
|
|
54
73
|
* What the standard OpenID Connect sign-in scopes let an app see, in plain
|
|
55
74
|
* words (#1572). They are not permissions, so they are not in the catalog;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plain wording for dashboard items that more than one manager raises (#2354).
|
|
3
|
+
*
|
|
4
|
+
* The dashboard's "needs attention" and "not working" items are read by home
|
|
5
|
+
* users. Each says what is wrong and one thing to do, with no issue numbers,
|
|
6
|
+
* setting names, environment variable names, file paths or "see the log". The
|
|
7
|
+
* developer detail goes to the log, beside the call that marks the item.
|
|
8
|
+
*/
|
|
9
|
+
/** Where a staged restore is looked at and cancelled: the Backup page. */
|
|
10
|
+
export declare const STAGED_RESTORE_FIX: {
|
|
11
|
+
fixUrl: string;
|
|
12
|
+
fixLabel: string;
|
|
13
|
+
};
|
|
14
|
+
/** A staged restore that was set aside at start-up instead of put back (#1876, #1985). */
|
|
15
|
+
export declare function stagedRestoreNotApplied(what: string): string;
|
|
16
|
+
/** Said where the fix is a setting only the server can change: the app refuses to save it. */
|
|
17
|
+
export declare const IN_SERVER_SETTINGS = "This is set in the server's settings, outside this page.";
|
|
18
|
+
/** A configured folder on a drive that is not connected (`preflightConfiguredPath`). */
|
|
19
|
+
export declare const UNUSABLE_FOLDER_REASON = "The drive or folder this feature keeps its files on is not connected, so it is switched off. Connect the drive again, or choose another folder, then restart the site.";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plain wording for dashboard items that more than one manager raises (#2354).
|
|
3
|
+
*
|
|
4
|
+
* The dashboard's "needs attention" and "not working" items are read by home
|
|
5
|
+
* users. Each says what is wrong and one thing to do, with no issue numbers,
|
|
6
|
+
* setting names, environment variable names, file paths or "see the log". The
|
|
7
|
+
* developer detail goes to the log, beside the call that marks the item.
|
|
8
|
+
*/
|
|
9
|
+
/** Where a staged restore is looked at and cancelled: the Backup page. */
|
|
10
|
+
export const STAGED_RESTORE_FIX = { fixUrl: '/admin/backup', fixLabel: 'Open Admin → Backup' };
|
|
11
|
+
/** A staged restore that was set aside at start-up instead of put back (#1876, #1985). */
|
|
12
|
+
export function stagedRestoreNotApplied(what) {
|
|
13
|
+
return `A saved copy of ${what} was not put back when the site started, so what was there before is still in use. Open the Backup page to see what to do next.`;
|
|
14
|
+
}
|
|
15
|
+
/** Said where the fix is a setting only the server can change: the app refuses to save it. */
|
|
16
|
+
export const IN_SERVER_SETTINGS = "This is set in the server's settings, outside this page.";
|
|
17
|
+
/** A configured folder on a drive that is not connected (`preflightConfiguredPath`). */
|
|
18
|
+
export const UNUSABLE_FOLDER_REASON = 'The drive or folder this feature keeps its files on is not connected, so it is switched off. Connect the drive again, or choose another folder, then restart the site.';
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The vocabulary of a policy `condition` (#2261, #2330): attribute types, the
|
|
3
|
+
* function table, the nesting limit, and how one comparison is decided.
|
|
4
|
+
* Pure: no I/O, no manager. The evaluator and the validator both import it,
|
|
5
|
+
* so the set of functions lives here and nowhere else.
|
|
6
|
+
*
|
|
7
|
+
* A condition follows XACML 3.0 in lowercase (#2330). A function is a key
|
|
8
|
+
* named for its XACML function, `string-equal`, whose value is the array of its
|
|
9
|
+
* arguments. An argument is an attribute, `{ "attributeid": "subject:id",
|
|
10
|
+
* "datatype": "string" }`, or a literal, `{ "value": "sales", "datatype":
|
|
11
|
+
* "string" }`. `datatype` is required on both.
|
|
12
|
+
*/
|
|
13
|
+
import type { PolicyFinding } from './pageWritePolicies.js';
|
|
14
|
+
/** The types an attribute can be declared with. */
|
|
15
|
+
export declare const ATTRIBUTE_TYPES: readonly ["string", "integer", "boolean", "identity", "list"];
|
|
16
|
+
export type AttributeType = (typeof ATTRIBUTE_TYPES)[number];
|
|
17
|
+
/**
|
|
18
|
+
* The datatypes a condition may name: the XACML 3.0 JSON profile's short
|
|
19
|
+
* names. Only `string`, `integer` and `boolean` have a function today, so a
|
|
20
|
+
* condition naming any other is refused as a datatype its function does not take.
|
|
21
|
+
*/
|
|
22
|
+
export declare const DATATYPES: readonly ["string", "integer", "boolean", "double", "date", "time", "dateTime", "anyURI"];
|
|
23
|
+
/** The datatypes some function takes. */
|
|
24
|
+
export type FunctionType = 'string' | 'integer' | 'boolean';
|
|
25
|
+
/**
|
|
26
|
+
* How deep a condition may nest. Every function node counts, arguments that
|
|
27
|
+
* are attributes or values do not, so `or` > `and` > `not` > `string-equal` is 4
|
|
28
|
+
* and one more level is refused.
|
|
29
|
+
*/
|
|
30
|
+
export declare const MAX_CONDITION_DEPTH = 4;
|
|
31
|
+
/**
|
|
32
|
+
* How wide a condition may be (#2261). Depth alone leaves the tree as wide as
|
|
33
|
+
* a config file can make it, and the evaluator walks it for every page a
|
|
34
|
+
* listing or search asks about. A literal `value` list in an `is-in`, the
|
|
35
|
+
* arguments of one `and` or `or`, and the function nodes of the whole condition
|
|
36
|
+
* are each capped.
|
|
37
|
+
*/
|
|
38
|
+
export declare const MAX_IN_ITEMS = 256;
|
|
39
|
+
export declare const MAX_GROUP_CHILDREN = 256;
|
|
40
|
+
export declare const MAX_CONDITION_NODES = 512;
|
|
41
|
+
/** What a comparison does once both arguments are read. */
|
|
42
|
+
export type ComparisonKind = 'equal' | 'is-in' | 'greater-than' | 'greater-than-or-equal' | 'less-than' | 'less-than-or-equal';
|
|
43
|
+
/** One function that compares two arguments: the datatype it takes and what it does. */
|
|
44
|
+
export interface ConditionFunction {
|
|
45
|
+
type: FunctionType;
|
|
46
|
+
kind: ComparisonKind;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The functions that compare two arguments, by XACML 3.0 name (core spec,
|
|
50
|
+
* appendix A.3), in lowercase. `X-is-in` takes a value, then a bag: an attribute
|
|
51
|
+
* that is a list, or a literal whose `value` is an array.
|
|
52
|
+
*/
|
|
53
|
+
export declare const COMPARISON_FUNCTIONS: Readonly<Record<string, ConditionFunction>>;
|
|
54
|
+
/** The functions that combine conditions: XACML's logical functions. `not` takes one condition, these take a list. */
|
|
55
|
+
export declare const GROUP_FUNCTIONS: readonly ["and", "or"];
|
|
56
|
+
export declare const NOT_FUNCTION = "not";
|
|
57
|
+
/** Every function, in the order the validator lists them. */
|
|
58
|
+
export declare const CONDITION_FUNCTIONS: readonly string[];
|
|
59
|
+
/** The keys of an argument: an attribute or a literal, and its datatype. */
|
|
60
|
+
export declare const OPERAND_KEYS: readonly ["attributeid", "value", "datatype"];
|
|
61
|
+
/**
|
|
62
|
+
* The shape before #2330, key by key, and what replaces it, so the validator
|
|
63
|
+
* can say what to write. Not read by the evaluator: an old condition never holds.
|
|
64
|
+
*/
|
|
65
|
+
export declare const LEGACY_CONDITION_KEYS: Readonly<Record<string, string>>;
|
|
66
|
+
/** The one example the validator shows for the old shape. */
|
|
67
|
+
export declare const CONDITION_EXAMPLE = "{ \"string-equal\": [ { \"attributeid\": \"subject:department-id\", \"datatype\": \"string\" }, { \"value\": \"sales\", \"datatype\": \"string\" } ] }";
|
|
68
|
+
/** The datatype an attribute of a declared type is referenced with: an identity is a string. A list has the datatype of its entries. */
|
|
69
|
+
export declare function datatypeOf(attributeType: string): string | null;
|
|
70
|
+
/** The type a literal value has, or `null` when it is not a usable literal. */
|
|
71
|
+
export declare function literalType(value: unknown): 'string' | 'integer' | 'boolean' | null;
|
|
72
|
+
/** Can a literal be compared with an attribute of this type? An identity is a string. */
|
|
73
|
+
export declare function literalFits(attributeType: string, value: unknown): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Does a value read for an attribute fit the type it is declared with? A
|
|
76
|
+
* value that does not is treated as missing by the reader, so a comparison on
|
|
77
|
+
* it is unknown and fails closed, not a definite false or true (#2261). Never
|
|
78
|
+
* coerces: "5" is not an integer. An empty string is a string, a value and not
|
|
79
|
+
* a missing one.
|
|
80
|
+
*/
|
|
81
|
+
export declare function valueFits(attributeType: string, value: unknown): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Decides one comparison once both sides are read. `undefined` is unknown: a
|
|
84
|
+
* side that is missing, or not of a type the function can compare. Both sides
|
|
85
|
+
* must be the same kind of value (a string, a boolean or a whole number), so
|
|
86
|
+
* "5" never equals 5 and NaN never compares. `is-in` takes an array, or a Set the
|
|
87
|
+
* evaluator built from a literal list; every entry of an array must be the
|
|
88
|
+
* kind of value on the left. An empty string is a value, not a missing one.
|
|
89
|
+
*/
|
|
90
|
+
export declare function compareLeaf(kind: ComparisonKind, left: unknown, right: unknown): boolean | undefined;
|
|
91
|
+
/** The key that names how rules are combined (#2330). */
|
|
92
|
+
export declare const RULE_COMBINING_ALGORITHM_KEY = "ngdpbase.access.rule-combining-algorithm";
|
|
93
|
+
/** The only algorithm the evaluator implements; XACML's name for it. */
|
|
94
|
+
export declare const SUPPORTED_COMBINING_ALGORITHMS: readonly string[];
|
|
95
|
+
/** What Admin → Configuration says about the algorithm. */
|
|
96
|
+
export declare const DENY_OVERRIDES_EXPLANATION = "Any matching deny wins. Order and priority don't matter.";
|
|
97
|
+
/** What is wrong with the value of `ngdpbase.access.rule-combining-algorithm`, or `null`. Used on save, on load and at boot. */
|
|
98
|
+
export declare function combiningAlgorithmProblem(value: unknown): string | null;
|
|
99
|
+
/** The assurance level a sign-in reached: NIST SP 800-63B, 1 to 3. */
|
|
100
|
+
export type SubjectAal = 1 | 2 | 3;
|
|
101
|
+
/** `value` as an assurance level, or `undefined` when it is not 1, 2 or 3. Never coerces. */
|
|
102
|
+
export declare function toAal(value: unknown): SubjectAal | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* What a subject carries that bears on its assurance level (#2261 slice 3).
|
|
105
|
+
* Read from the request's subject, never from a request field: a caller
|
|
106
|
+
* cannot send an `aal` and have it believed.
|
|
107
|
+
*/
|
|
108
|
+
export interface AalFacts {
|
|
109
|
+
isAuthenticated?: boolean;
|
|
110
|
+
/** The session's sign-in record; absent on a session from before #1523. */
|
|
111
|
+
signIn?: {
|
|
112
|
+
aal?: unknown;
|
|
113
|
+
} | null;
|
|
114
|
+
/** The highest level the account's methods can reach; the level never exceeds it. */
|
|
115
|
+
aalCap?: number;
|
|
116
|
+
/** A token request: the level stored when the token was made. */
|
|
117
|
+
viaToken?: {
|
|
118
|
+
aal?: unknown;
|
|
119
|
+
} | null;
|
|
120
|
+
/** A share visitor has no sign-in. */
|
|
121
|
+
viaShare?: unknown;
|
|
122
|
+
/** A bearer JWT (Authentik): verified, but it records no sign-in level, so the subject has none (#2287). */
|
|
123
|
+
bearerWithoutLevel?: unknown;
|
|
124
|
+
/** A background job: the level stored when the job was requested. */
|
|
125
|
+
grantedAal?: unknown;
|
|
126
|
+
/** A background job (`JobSubject`): it has no session to read. */
|
|
127
|
+
resolveRolesNow?: unknown;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The subject's `subject:aal`, or `undefined` when it has none (#2261).
|
|
131
|
+
*
|
|
132
|
+
* - Not signed in, or a share visitor: none.
|
|
133
|
+
* - An agent token: the level stored with the token. A token made before this
|
|
134
|
+
* stored one has none.
|
|
135
|
+
* - A background job: the level stored with the job's request. A job with
|
|
136
|
+
* none (a schedule, boot, a request from before this) has none.
|
|
137
|
+
* - A bearer JWT that records no level (Authentik): none. It is not a session
|
|
138
|
+
* from before sign-ins were recorded, so the AAL 1 rule below does not apply.
|
|
139
|
+
* - A session: its sign-in record's level; a session from before sign-ins
|
|
140
|
+
* were recorded (#1523) is AAL 1, as `AuthManager` treats it.
|
|
141
|
+
*
|
|
142
|
+
* Capped at `aalCap`, as a role is. Reads the record; it never works the level
|
|
143
|
+
* out from factors.
|
|
144
|
+
*/
|
|
145
|
+
export declare function effectiveAal(subject: AalFacts | null | undefined): SubjectAal | undefined;
|
|
146
|
+
/**
|
|
147
|
+
* The fields of a request's subject that bear on its level, copied by name so
|
|
148
|
+
* a subject rebuilt for a decision keeps them (the #1164 lesson: a field not
|
|
149
|
+
* forwarded is silently lost). Reads nothing else from it.
|
|
150
|
+
*/
|
|
151
|
+
export declare function aalFactsOf(subject: object | null | undefined): AalFacts;
|
|
152
|
+
/** Where a subject attribute may be read from: `account:<field>`, `profile:<field>` or `sign-in`. */
|
|
153
|
+
export declare const SUBJECT_SOURCES: readonly ["account:", "profile:", "sign-in"];
|
|
154
|
+
/** One declared subject attribute, as `ngdpbase.access.subject-attributes` holds it. */
|
|
155
|
+
export interface DeclaredSubjectAttribute {
|
|
156
|
+
type?: string;
|
|
157
|
+
from?: string;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* `id` and `aal` mean what they mean here, whatever the configuration (or an
|
|
161
|
+
* add-on's default-config.json) says (#2287). `aal` is read from the sign-in
|
|
162
|
+
* record and `id` from the account; a site that could redefine either could
|
|
163
|
+
* make `subject:aal` read a field it controls and pass a "second factor" rule.
|
|
164
|
+
*/
|
|
165
|
+
export declare const PINNED_SUBJECT_ATTRIBUTES: Readonly<Record<string, DeclaredSubjectAttribute>>;
|
|
166
|
+
/** The subject attributes a site declares, with `id` and `aal` pinned to their built-in meaning. Anything not an object is ignored. */
|
|
167
|
+
export declare function declaredSubjectAttributes(raw: unknown): Record<string, DeclaredSubjectAttribute>;
|
|
168
|
+
/**
|
|
169
|
+
* What is wrong with the value of `ngdpbase.access.subject-attributes` itself
|
|
170
|
+
* (#2287), one message each: not an object; `id` or `aal` declared with any
|
|
171
|
+
* meaning but the built-in one (the built-in is kept regardless; the same
|
|
172
|
+
* declaration as the built-in is harmless and not reported); and any other
|
|
173
|
+
* declaration `subjectDeclarationProblem` refuses. Used on save, on load and at boot.
|
|
174
|
+
*/
|
|
175
|
+
export declare function subjectAttributesProblems(raw: unknown, sensitive: readonly string[]): string[];
|
|
176
|
+
/** {@link subjectAttributesProblems}, each also in plain words for the needs-attention entry. */
|
|
177
|
+
export declare function subjectAttributesFindings(raw: unknown, sensitive: readonly string[]): PolicyFinding[];
|
|
178
|
+
/**
|
|
179
|
+
* What is wrong with a subject attribute's declaration, or `null`: a `type`
|
|
180
|
+
* that is not known, a `from` that is not a subject source, or an account field
|
|
181
|
+
* that must never be read (`sensitive`, the password, email, roles and the
|
|
182
|
+
* like). Said so a condition naming it is refused rather than silently unknown.
|
|
183
|
+
*/
|
|
184
|
+
export declare function subjectDeclarationProblem(name: string, decl: DeclaredSubjectAttribute | undefined, sensitive: readonly string[]): string | null;
|
|
185
|
+
/**
|
|
186
|
+
* A declaration map as written, every `$NAME` left unresolved, or `null` when
|
|
187
|
+
* it cannot be read. Declarations are read this way so a `$NAME` in one is
|
|
188
|
+
* judged and reported as written and an environment variable's value never
|
|
189
|
+
* reaches a message or a log line; a throwing read (an unset variable) is
|
|
190
|
+
* `null`, not an exception.
|
|
191
|
+
*/
|
|
192
|
+
export declare function readDeclaredAsWritten(config: {
|
|
193
|
+
getUnresolvedProperty?: (key: string, def?: unknown) => unknown;
|
|
194
|
+
getProperty: (key: string, def?: unknown) => unknown;
|
|
195
|
+
} | null | undefined, key: string): unknown;
|
|
196
|
+
/** Where an environment attribute may be read from: `schedule:<name>` or `config:<key>` (#2261 slice 4). */
|
|
197
|
+
export declare const ENVIRONMENT_SOURCES: readonly ["schedule:", "config:"];
|
|
198
|
+
/** One declared environment attribute, as `ngdpbase.access.environment-attributes` holds it. */
|
|
199
|
+
export interface DeclaredEnvironmentAttribute {
|
|
200
|
+
type?: string;
|
|
201
|
+
from?: string;
|
|
202
|
+
}
|
|
203
|
+
/** The environment attributes a site declares. Anything not an object is ignored. */
|
|
204
|
+
export declare function declaredEnvironmentAttributes(raw: unknown): Record<string, DeclaredEnvironmentAttribute>;
|
|
205
|
+
/**
|
|
206
|
+
* What is wrong with an environment attribute's declaration, or `null`: a
|
|
207
|
+
* `type` that is not `boolean` (both sources yield a boolean and nothing
|
|
208
|
+
* else), a `from` that is not `schedule:<name>` or `config:<key>`, or one with
|
|
209
|
+
* no name or key after the prefix. Any configuration key may be read, secrets
|
|
210
|
+
* included (#2261): a condition can only compare the value, and the value is
|
|
211
|
+
* never written to a log, an audit record or a message.
|
|
212
|
+
*/
|
|
213
|
+
export declare function environmentDeclarationProblem(name: string, decl: DeclaredEnvironmentAttribute | undefined): string | null;
|
|
214
|
+
/**
|
|
215
|
+
* What is wrong with the value of `ngdpbase.access.environment-attributes`
|
|
216
|
+
* itself, one message each: not an object, or a declaration
|
|
217
|
+
* {@link environmentDeclarationProblem} refuses. Used on save, on load and at boot.
|
|
218
|
+
*/
|
|
219
|
+
export declare function environmentAttributesProblems(raw: unknown): string[];
|
|
220
|
+
/** {@link environmentAttributesProblems}, each also in plain words for the needs-attention entry. */
|
|
221
|
+
export declare function environmentAttributesFindings(raw: unknown): PolicyFinding[];
|
|
222
|
+
/**
|
|
223
|
+
* The words an administrator sees (the needs-attention entry and the save message) when a policy carries
|
|
224
|
+
* the old plural `conditions` array, or null when none does (#2334). Plain words: no issue number, no JSON.
|
|
225
|
+
*/
|
|
226
|
+
export declare function unenforcedConditionsNotice(policies: unknown): string | null;
|
|
227
|
+
/**
|
|
228
|
+
* The start-up log line for the same policies, in full: the condition to write, the attribute
|
|
229
|
+
* declaration it needs, and the entry types with no equivalent (#2334). Null when none has one.
|
|
230
|
+
* Nothing in the decision path reads that array, so a rule written there limits no access.
|
|
231
|
+
*/
|
|
232
|
+
export declare function unenforcedConditionsLine(policies: unknown): string | null;
|