@jwilleke/ngdpbase-types 0.0.0 → 5.18.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/LICENSE +201 -0
- package/README.md +16 -2
- package/lib/packages/ngdpbase-types/index.d.ts +32 -0
- package/lib/packages/ngdpbase-types/testing.d.ts +43 -0
- package/lib/packages/ngdpbase-types/testing.js +53 -0
- package/lib/src/cache/CacheDependencies.d.ts +50 -0
- package/lib/src/cache/CacheDependencies.js +50 -0
- package/lib/src/cache/ICacheAdapter.d.ts +86 -0
- package/lib/src/cache/RegionCache.d.ts +171 -0
- package/lib/src/context/ActorContext.d.ts +48 -0
- package/lib/src/context/ActorContext.js +33 -0
- package/lib/src/context/ApiContext.d.ts +194 -0
- package/lib/src/context/ApiContext.js +273 -0
- package/lib/src/context/BaseContext.d.ts +110 -0
- package/lib/src/context/BaseContext.js +143 -0
- package/lib/src/context/JobContext.d.ts +153 -0
- package/lib/src/context/JobContext.js +144 -0
- package/lib/src/context/WikiContext.d.ts +404 -0
- package/lib/src/context/bootActions.d.ts +64 -0
- package/lib/src/context/bootActions.js +111 -0
- package/lib/src/converters/HtmlConverter.d.ts +70 -0
- package/lib/src/converters/IContentConverter.d.ts +94 -0
- package/lib/src/converters/JSPWikiConverter.d.ts +117 -0
- package/lib/src/converters/conversionWarning.d.ts +15 -0
- package/lib/src/converters/ncm/bridge.d.ts +22 -0
- package/lib/src/converters/ncm/existing.d.ts +23 -0
- package/lib/src/converters/ncm/fix/blocks.d.ts +89 -0
- package/lib/src/converters/ncm/fix/bulletMarkers.d.ts +21 -0
- package/lib/src/converters/ncm/fix/index.d.ts +36 -0
- package/lib/src/converters/ncm/fix/jspwikiBullets.d.ts +20 -0
- package/lib/src/converters/ncm/fix/jspwikiCodeMarkers.d.ts +38 -0
- package/lib/src/converters/ncm/fix/jspwikiHeadings.d.ts +25 -0
- package/lib/src/converters/ncm/fix/jspwikiIndent.d.ts +24 -0
- package/lib/src/converters/ncm/fix/jspwikiInsert.d.ts +21 -0
- package/lib/src/converters/ncm/fix/jspwikiItalic.d.ts +29 -0
- package/lib/src/converters/ncm/fix/jspwikiLinkLeftovers.d.ts +27 -0
- package/lib/src/converters/ncm/fix/moreInformationFooter.d.ts +25 -0
- package/lib/src/converters/ncm/fix/styleClosers.d.ts +25 -0
- package/lib/src/converters/ncm/fix/tightenLists.d.ts +30 -0
- package/lib/src/converters/ncm/fix/types.d.ts +33 -0
- package/lib/src/converters/ncm/footnotes.d.ts +39 -0
- package/lib/src/converters/ncm/images.d.ts +49 -0
- package/lib/src/converters/ncm/index.d.ts +20 -0
- package/lib/src/converters/ncm/links.d.ts +21 -0
- package/lib/src/converters/ncm/normalize.d.ts +39 -0
- package/lib/src/converters/ncm/placeholder.d.ts +25 -0
- package/lib/src/converters/ncm/tables.d.ts +36 -0
- package/lib/src/converters/ncm/types.d.ts +42 -0
- package/lib/src/http/egressPolicy.d.ts +52 -0
- package/lib/src/http/guardedFetch.d.ts +89 -0
- package/lib/src/http/guardedFetch.js +113 -0
- package/lib/src/http/guardedLookup.d.ts +48 -0
- package/lib/src/http/guardedLookup.js +73 -0
- package/lib/src/http/ssrf.d.ts +83 -0
- package/lib/src/http/ssrf.js +311 -0
- package/lib/src/mail/MailProvider.d.ts +36 -0
- package/lib/src/mail/NodemailerMailProvider.d.ts +26 -0
- package/lib/src/managers/AddonsManager.d.ts +691 -0
- package/lib/src/managers/AgentTokenManager.d.ts +269 -0
- package/lib/src/managers/AssetManager.d.ts +116 -0
- package/lib/src/managers/AttachmentManager.d.ts +1032 -0
- package/lib/src/managers/AuthManager.d.ts +1257 -0
- package/lib/src/managers/BackgroundJobManager.d.ts +434 -0
- package/lib/src/managers/BaseManager.d.ts +391 -0
- package/lib/src/managers/BaseManager.js +415 -0
- package/lib/src/managers/CacheManager.d.ts +159 -0
- package/lib/src/managers/CatalogManager.d.ts +235 -0
- package/lib/src/managers/CommentManager.d.ts +75 -0
- package/lib/src/managers/ConfigurationManager.d.ts +747 -0
- package/lib/src/managers/DatabaseManager.d.ts +89 -0
- package/lib/src/managers/DatabaseManager.js +236 -0
- package/lib/src/managers/EmailManager.d.ts +47 -0
- package/lib/src/managers/ExportManager.d.ts +129 -0
- package/lib/src/managers/ExportManager.js +420 -0
- package/lib/src/managers/FootnoteManager.d.ts +118 -0
- package/lib/src/managers/MediaManager.d.ts +279 -0
- package/lib/src/managers/MetricsManager.d.ts +89 -0
- package/lib/src/managers/NotificationManager.d.ts +165 -0
- package/lib/src/managers/OidcManager.d.ts +210 -0
- package/lib/src/managers/OrganizationManager.d.ts +107 -0
- package/lib/src/managers/PageManager.d.ts +1645 -0
- package/lib/src/managers/PersonManager.d.ts +48 -0
- package/lib/src/managers/PluginManager.d.ts +179 -0
- package/lib/src/managers/PluginManager.js +393 -0
- package/lib/src/managers/PolicyEvaluator.d.ts +213 -0
- package/lib/src/managers/RenderingManager.d.ts +358 -0
- package/lib/src/managers/RoleManager.d.ts +134 -0
- package/lib/src/managers/SearchManager.d.ts +402 -0
- package/lib/src/managers/ShareManager.d.ts +251 -0
- package/lib/src/managers/TemplateManager.d.ts +176 -0
- package/lib/src/managers/ThemeManager.d.ts +56 -0
- package/lib/src/managers/UserManager.d.ts +480 -0
- package/lib/src/managers/ValidationManager.d.ts +426 -0
- package/lib/src/managers/VariableManager.d.ts +145 -0
- package/lib/src/middleware/csrf.d.ts +3 -0
- package/lib/src/parsers/LinkParser.d.ts +457 -0
- package/lib/src/parsers/MarkupParser.d.ts +769 -0
- package/lib/src/parsers/context/ParseContext.d.ts +314 -0
- package/lib/src/parsers/data/emoji-map.d.ts +18 -0
- package/lib/src/parsers/dom/DOMBuilder.d.ts +210 -0
- package/lib/src/parsers/dom/DOMParser.d.ts +252 -0
- package/lib/src/parsers/dom/Tokenizer.d.ts +358 -0
- package/lib/src/parsers/dom/WikiDocument.d.ts +272 -0
- package/lib/src/parsers/dom/handlers/DOMLinkHandler.d.ts +260 -0
- package/lib/src/parsers/dom/handlers/DOMPluginHandler.d.ts +212 -0
- package/lib/src/parsers/dom/handlers/DOMVariableHandler.d.ts +171 -0
- package/lib/src/parsers/filters/BaseFilter.d.ts +269 -0
- package/lib/src/parsers/filters/FilterChain.d.ts +320 -0
- package/lib/src/parsers/handlers/BaseSyntaxHandler.d.ts +331 -0
- package/lib/src/parsers/handlers/HandlerRegistry.d.ts +225 -0
- package/lib/src/parsers/handlers/JSPWikiPreprocessor.d.ts +89 -0
- package/lib/src/parsers/handlers/LinkParserHandler.d.ts +80 -0
- package/lib/src/parsers/handlers/PluginSyntaxHandler.d.ts +78 -0
- package/lib/src/parsers/handlers/WikiFormHandler.d.ts +149 -0
- package/lib/src/parsers/handlers/WikiTagHandler.d.ts +125 -0
- package/lib/src/parsers/jspwikiTableRow.d.ts +39 -0
- package/lib/src/parsers/styleBlockSyntax.d.ts +14 -0
- package/lib/src/plugins/types.d.ts +79 -0
- package/lib/src/providers/AgentTokenAuthProvider.d.ts +40 -0
- package/lib/src/providers/AuthentikBearerAuthProvider.d.ts +75 -0
- package/lib/src/providers/BaseAttachmentProvider.d.ts +197 -0
- package/lib/src/providers/BaseAuthProvider.d.ts +220 -0
- package/lib/src/providers/BaseCacheProvider.d.ts +140 -0
- package/lib/src/providers/BaseCredentialsProvider.d.ts +84 -0
- package/lib/src/providers/BaseDatabaseProvider.d.ts +22 -0
- package/lib/src/providers/BaseDatabaseProvider.js +12 -0
- package/lib/src/providers/BaseLoggingProvider.d.ts +68 -0
- package/lib/src/providers/BaseLoggingProvider.js +37 -0
- package/lib/src/providers/BaseMediaProvider.d.ts +308 -0
- package/lib/src/providers/BasePageProvider.d.ts +337 -0
- package/lib/src/providers/BaseProvider.d.ts +98 -0
- package/lib/src/providers/BaseProvider.js +74 -0
- package/lib/src/providers/BaseSearchProvider.d.ts +362 -0
- package/lib/src/providers/BasicAttachmentProvider.d.ts +599 -0
- package/lib/src/providers/CloudflareAccessAuthProvider.d.ts +72 -0
- package/lib/src/providers/FileCredentialsProvider.d.ts +33 -0
- package/lib/src/providers/FileJobStateProvider.d.ts +58 -0
- package/lib/src/providers/FileLoggingProvider.d.ts +43 -0
- package/lib/src/providers/FileLoggingProvider.js +120 -0
- package/lib/src/providers/FileOidcAdapter.d.ts +25 -0
- package/lib/src/providers/FileSystemMediaProvider.d.ts +403 -0
- package/lib/src/providers/LunrSearchProvider.d.ts +280 -0
- package/lib/src/providers/MagicLinkAuthProvider.d.ts +125 -0
- package/lib/src/providers/NullCacheProvider.d.ts +72 -0
- package/lib/src/providers/OidcAuthProvider.d.ts +180 -0
- package/lib/src/providers/OidcBearerAuthProvider.d.ts +30 -0
- package/lib/src/providers/PasskeyAuthProvider.d.ts +58 -0
- package/lib/src/providers/PasswordAuthProvider.d.ts +20 -0
- package/lib/src/providers/SqliteDatabaseProvider.d.ts +55 -0
- package/lib/src/providers/SqliteDatabaseProvider.js +90 -0
- package/lib/src/providers/SqliteJobStateProvider.d.ts +41 -0
- package/lib/src/providers/databaseMigrations.d.ts +8 -0
- package/lib/src/providers/databaseMigrations.js +47 -0
- package/lib/src/providers/jobState.d.ts +99 -0
- package/lib/src/providers/lunrQueryToMiniSearch.d.ts +32 -0
- package/lib/src/providers/mediaFilenameDate.d.ts +22 -0
- package/lib/src/providers/sqliteLocation.d.ts +17 -0
- package/lib/src/providers/sqliteLocation.js +55 -0
- package/lib/src/providers/sqliteMigrations.d.ts +48 -0
- package/lib/src/providers/sqliteMigrations.js +72 -0
- package/lib/src/rendering/githubAlerts.d.ts +22 -0
- package/lib/src/rendering/htmlPolicy.d.ts +76 -0
- package/lib/src/rendering/markdownConverter.d.ts +73 -0
- package/lib/src/security/PolicyDecisionPoint.d.ts +245 -0
- package/lib/src/security/PolicyInformationPoint.d.ts +448 -0
- package/lib/src/security/pageActions.d.ts +40 -0
- package/lib/src/security/permissions.generated.d.ts +78 -0
- package/lib/src/types/Asset.d.ts +414 -0
- package/lib/src/types/Catalog.d.ts +61 -0
- package/lib/src/types/Comment.d.ts +11 -0
- package/lib/src/types/Config.d.ts +388 -0
- package/lib/src/types/Organization.d.ts +78 -0
- package/lib/src/types/OrganizationProvider.d.ts +38 -0
- package/lib/src/types/Page.d.ts +220 -0
- package/lib/src/types/Person.d.ts +56 -0
- package/lib/src/types/PersonProvider.d.ts +25 -0
- package/lib/src/types/Policy.d.ts +139 -0
- package/lib/src/types/Policy.js +17 -0
- package/lib/src/types/Provider.d.ts +810 -0
- package/lib/src/types/Role.d.ts +84 -0
- package/lib/src/types/RoleProvider.d.ts +35 -0
- package/lib/src/types/Schema.d.ts +425 -0
- package/lib/src/types/Share.d.ts +172 -0
- package/lib/src/types/Share.js +81 -0
- package/lib/src/types/User.d.ts +304 -0
- package/lib/src/types/Version.d.ts +189 -0
- package/lib/src/types/WikiEngine.d.ts +128 -0
- package/lib/src/types/express.d.ts +120 -0
- package/lib/src/types/express.js +1 -0
- package/lib/src/types/guards.d.ts +78 -0
- package/lib/src/types/heic-decode.d.ts +16 -0
- package/lib/src/types/index.d.ts +19 -0
- package/lib/src/types/linkedom.d.ts +77 -0
- package/lib/src/types/markdown-it-plugins.d.ts +21 -0
- package/lib/src/utils/DeltaStorage.d.ts +118 -0
- package/lib/src/utils/LocaleUtils.d.ts +105 -0
- package/lib/src/utils/LocaleUtils.js +294 -0
- package/lib/src/utils/PageNameMatcher.d.ts +98 -0
- package/lib/src/utils/PathPreflight.d.ts +38 -0
- package/lib/src/utils/PathPreflight.js +50 -0
- package/lib/src/utils/SectionUtils.d.ts +40 -0
- package/lib/src/utils/addonConfigLayer.d.ts +144 -0
- package/lib/src/utils/addonConfigLayer.js +382 -0
- package/lib/src/utils/addonDatabaseRules.d.ts +25 -0
- package/lib/src/utils/addonDatabaseRules.js +57 -0
- package/lib/src/utils/addonHost.d.ts +51 -0
- package/lib/src/utils/addonHost.js +72 -0
- package/lib/src/utils/addonInstaller.d.ts +109 -0
- package/lib/src/utils/addonLock.d.ts +37 -0
- package/lib/src/utils/addonLock.js +48 -0
- package/lib/src/utils/addonPageSync.d.ts +45 -0
- package/lib/src/utils/addonProvenance.d.ts +48 -0
- package/lib/src/utils/addonTarball.d.ts +41 -0
- package/lib/src/utils/addonsPathResolver.d.ts +76 -0
- package/lib/src/utils/addonsPathResolver.js +129 -0
- package/lib/src/utils/assetMetadataTags.d.ts +66 -0
- package/lib/src/utils/atomicWrite.d.ts +28 -0
- package/lib/src/utils/auditConfigChange.d.ts +57 -0
- package/lib/src/utils/auditEventNames.d.ts +50 -0
- package/lib/src/utils/auditEventNames.generated.d.ts +163 -0
- package/lib/src/utils/auditEventNames.generated.js +168 -0
- package/lib/src/utils/auditEventNames.js +49 -0
- package/lib/src/utils/auditEvents.d.ts +265 -0
- package/lib/src/utils/auditEvents.js +309 -0
- package/lib/src/utils/auditRegistry.d.ts +102 -0
- package/lib/src/utils/auditRegistry.js +168 -0
- package/lib/src/utils/bip39English.d.ts +2 -0
- package/lib/src/utils/configEnvKeys.d.ts +68 -0
- package/lib/src/utils/configFiles.d.ts +74 -0
- package/lib/src/utils/configFiles.js +150 -0
- package/lib/src/utils/delegation.d.ts +48 -0
- package/lib/src/utils/deriveUsername.d.ts +21 -0
- package/lib/src/utils/explainMediaPath.d.ts +123 -0
- package/lib/src/utils/formerTitles.d.ts +69 -0
- package/lib/src/utils/frontmatterAccess.d.ts +54 -0
- package/lib/src/utils/headlessAdminPassword.d.ts +55 -0
- package/lib/src/utils/imageTransform.d.ts +52 -0
- package/lib/src/utils/instanceEnvSecret.d.ts +51 -0
- package/lib/src/utils/jobSlots.d.ts +43 -0
- package/lib/src/utils/keywordNormalizer.d.ts +127 -0
- package/lib/src/utils/logger.d.ts +70 -0
- package/lib/src/utils/logger.js +106 -0
- package/lib/src/utils/magicLinkDeviceState.d.ts +95 -0
- package/lib/src/utils/managerUtils.d.ts +40 -0
- package/lib/src/utils/migrateLegacyPrivateAttachments.d.ts +15 -0
- package/lib/src/utils/orgFilename.d.ts +22 -0
- package/lib/src/utils/pageFeature.d.ts +27 -0
- package/lib/src/utils/pageFrontmatter.d.ts +21 -0
- package/lib/src/utils/pageNotes.d.ts +150 -0
- package/lib/src/utils/pageTitleRule.d.ts +37 -0
- package/lib/src/utils/pageToArticle.d.ts +59 -0
- package/lib/src/utils/pageUrl.d.ts +18 -0
- package/lib/src/utils/passwordChange.d.ts +12 -0
- package/lib/src/utils/passwordHash.d.ts +60 -0
- package/lib/src/utils/permissionCatalog.d.ts +52 -0
- package/lib/src/utils/pluginFormatters.d.ts +452 -0
- package/lib/src/utils/pluginFormatters.js +714 -0
- package/lib/src/utils/privateLinkRewrite.d.ts +42 -0
- package/lib/src/utils/privateStoreAccess.d.ts +57 -0
- package/lib/src/utils/privateStoreAccess.js +65 -0
- package/lib/src/utils/privateStoreCatalogs.d.ts +40 -0
- package/lib/src/utils/privateStoreCrypto.d.ts +127 -0
- package/lib/src/utils/privateStoreDoor.d.ts +181 -0
- package/lib/src/utils/privateStoreExport.d.ts +72 -0
- package/lib/src/utils/privateStoreFiles.d.ts +120 -0
- package/lib/src/utils/privateStoreMeta.d.ts +64 -0
- package/lib/src/utils/privateStoreMigrations.d.ts +37 -0
- package/lib/src/utils/privateStorePath.d.ts +259 -0
- package/lib/src/utils/privateStorePath.js +436 -0
- package/lib/src/utils/privateStoreTakeout.d.ts +76 -0
- package/lib/src/utils/privateStoreUnlock.d.ts +175 -0
- package/lib/src/utils/proxyClaim.d.ts +59 -0
- package/lib/src/utils/proxyClaim.js +30 -0
- package/lib/src/utils/redactPrivateNames.d.ts +21 -0
- package/lib/src/utils/redactPrivateNames.js +89 -0
- package/lib/src/utils/redactSecrets.d.ts +58 -0
- package/lib/src/utils/redactSecrets.js +171 -0
- package/lib/src/utils/renameLinkRewrite.d.ts +112 -0
- package/lib/src/utils/roleGrants.d.ts +35 -0
- package/lib/src/utils/safeRedirect.d.ts +32 -0
- package/lib/src/utils/schedule.d.ts +54 -0
- package/lib/src/utils/secretFileMode.d.ts +17 -0
- package/lib/src/utils/seededShippedPages.d.ts +45 -0
- package/lib/src/utils/sensitiveValues.d.ts +59 -0
- package/lib/src/utils/sensitiveValues.js +106 -0
- package/lib/src/utils/sessionEnd.d.ts +12 -0
- package/lib/src/utils/sessionGeneration.d.ts +24 -0
- package/lib/src/utils/sessionIdle.d.ts +41 -0
- package/lib/src/utils/sessionLimits.d.ts +68 -0
- package/lib/src/utils/shareLockbox.d.ts +64 -0
- package/lib/src/utils/sigstoreTrustedRoot.d.ts +33 -0
- package/lib/src/utils/sniffMime.d.ts +21 -0
- package/lib/src/utils/storeSearchIndex.d.ts +75 -0
- package/lib/src/utils/subjectMayDo.d.ts +21 -0
- package/lib/src/utils/systemCategoryRules.d.ts +30 -0
- package/lib/src/utils/systemCategoryRules.js +41 -0
- package/lib/src/utils/userCreateError.d.ts +62 -0
- package/lib/src/utils/username.d.ts +53 -0
- package/lib/src/utils/vaultUrlRewrite.d.ts +27 -0
- package/lib/src/utils/version.d.ts +84 -0
- package/lib/src/utils/videoFrame.d.ts +21 -0
- package/package.json +54 -3
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
import BaseManager from '../managers/BaseManager.js';
|
|
2
|
+
import { WikiEngine } from '../types/WikiEngine.js';
|
|
3
|
+
import type { AgentTokenGrant, ProxyClaim } from '../managers/UserManager.js';
|
|
4
|
+
import type { Request } from 'express';
|
|
5
|
+
import type { PageFrontmatter } from '../types/Page.js';
|
|
6
|
+
import { type ShareGrant } from '../types/Share.js';
|
|
7
|
+
import type { MediaItem } from '../providers/BaseMediaProvider.js';
|
|
8
|
+
/**
|
|
9
|
+
* Minimal WikiContext interface for type safety
|
|
10
|
+
* TODO: Convert WikiContext.js to TypeScript and import proper type
|
|
11
|
+
*/
|
|
12
|
+
interface WikiContext {
|
|
13
|
+
pageName: string;
|
|
14
|
+
content: string;
|
|
15
|
+
context?: Record<string, unknown>;
|
|
16
|
+
userContext?: UserContext;
|
|
17
|
+
pageMetadata?: PageFrontmatter | null;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* User context for permission checks
|
|
21
|
+
* Note: Index signature required for PolicyEvaluator compatibility
|
|
22
|
+
*/
|
|
23
|
+
interface UserContext {
|
|
24
|
+
/** #1212: the three authorisation fields are required; `null` is the anonymous visitor. */
|
|
25
|
+
username: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
roles: string[];
|
|
28
|
+
isAuthenticated: boolean;
|
|
29
|
+
/** The delegations a request carries; declared so the index signature does not erase their type. */
|
|
30
|
+
viaToken?: AgentTokenGrant;
|
|
31
|
+
viaShare?: ShareGrant;
|
|
32
|
+
viaProxy?: ProxyClaim;
|
|
33
|
+
[key: string]: unknown;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Access decision log entry
|
|
37
|
+
*/
|
|
38
|
+
interface AccessDecisionLog {
|
|
39
|
+
user?: UserContext;
|
|
40
|
+
pageName?: string;
|
|
41
|
+
action?: string;
|
|
42
|
+
allowed?: boolean;
|
|
43
|
+
reason?: string;
|
|
44
|
+
context?: Record<string, unknown>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* PolicyInformationPoint — what a page decision needs to know about the page
|
|
48
|
+
* (#1431; was ACLManager until step 8).
|
|
49
|
+
*
|
|
50
|
+
* In the model the access subject follows (docs/managers/Manager-SOT.md):
|
|
51
|
+
*
|
|
52
|
+
* - the __PEPs__ are the doors — routes, manager doors, the availability gate;
|
|
53
|
+
* - the __PDP__ (`PolicyDecisionPoint`) answers "may this subject do this", with
|
|
54
|
+
* the delegation ceilings, over the policies;
|
|
55
|
+
* - __this__ supplies the page's own attributes and walks the page's own rules
|
|
56
|
+
* in order, asking the PDP where global policy decides;
|
|
57
|
+
* - the __PAP__ is ConfigurationManager plus the admin screens.
|
|
58
|
+
*
|
|
59
|
+
* What it holds, all of it about a PAGE (or a private container, or media
|
|
60
|
+
* linked to one):
|
|
61
|
+
*
|
|
62
|
+
* - `walkPageTiers` — the one implementation of the page's rules: private
|
|
63
|
+
* (owner or delegate, never a role), author-lock (`edit` only; the override
|
|
64
|
+
* is the `admin-system` permission), frontmatter `audience` / `access`, then
|
|
65
|
+
* the share or global policy. Shared by every entry point below (#1431 7c).
|
|
66
|
+
* - `checkPagePermissionWithContext` / `evaluatePagePermission` — one page, for
|
|
67
|
+
* a request that already holds it; the latter returns the reason. These are
|
|
68
|
+
* the doors: asked before acting, and every decision is recorded.
|
|
69
|
+
* - `pageAffordance` / `pageAffordanceFor` — the same evaluator (this page /
|
|
70
|
+
* another page), asked only to decide whether to show a control; records
|
|
71
|
+
* nothing (#1668).
|
|
72
|
+
* - `canUserAccessPage` — another page, loaded as this subject (cross-page:
|
|
73
|
+
* inserts, includes, attachments).
|
|
74
|
+
* - `filterAccessiblePages` — many pages, over the index, with no per-page
|
|
75
|
+
* disk read, log line or audit record; agrees with the single-page answer in
|
|
76
|
+
* both directions (#1219).
|
|
77
|
+
* - `canUserAccessMediaItem` / `canAccessPrivateContainer` — media and store
|
|
78
|
+
* files, by the same rules.
|
|
79
|
+
* - `logAccessDecision` — every single-page door decision is recorded; a
|
|
80
|
+
* denial becomes an `authorization-deny` record carrying the request's
|
|
81
|
+
* address. An affordance is not recorded.
|
|
82
|
+
*
|
|
83
|
+
* What it no longer holds, so nobody goes looking: JSPWiki's page-body ACL
|
|
84
|
+
* markup (#1431 7a — imports convert it to audience terms, #1446); the
|
|
85
|
+
* availability checks (#1432); a policy cache (#1431 step 4); any role-name
|
|
86
|
+
* gate (#1431 7b).
|
|
87
|
+
*
|
|
88
|
+
* @class PolicyInformationPoint
|
|
89
|
+
* @extends BaseManager
|
|
90
|
+
*
|
|
91
|
+
* @see {@link PolicyDecisionPoint} for the decision over the policies
|
|
92
|
+
* @see {@link PolicyEvaluator} for policy matching
|
|
93
|
+
* @see {@link AuditManager} for the access record
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* const pip = engine.getManager('PolicyInformationPoint');
|
|
97
|
+
* if (await pip.checkPagePermissionWithContext(wikiContext, 'edit')) { ... }
|
|
98
|
+
*/
|
|
99
|
+
declare class PolicyInformationPoint extends BaseManager {
|
|
100
|
+
/** Read at the moment of use: this manager starts before PolicyEvaluator (#1431 step 13). */
|
|
101
|
+
private get policyEvaluator();
|
|
102
|
+
/**
|
|
103
|
+
* Creates a new PolicyInformationPoint instance
|
|
104
|
+
*
|
|
105
|
+
* @constructor
|
|
106
|
+
* @param {WikiEngine} engine - The wiki engine instance
|
|
107
|
+
*/
|
|
108
|
+
constructor(engine: WikiEngine);
|
|
109
|
+
/**
|
|
110
|
+
* Initializes the PolicyInformationPoint by loading policies and configurations
|
|
111
|
+
*
|
|
112
|
+
* Loads access policies from configuration and initializes the policy
|
|
113
|
+
* evaluator for context-aware permission evaluation.
|
|
114
|
+
*
|
|
115
|
+
* @async
|
|
116
|
+
* @returns {Promise<void>}
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* await policyInformationPoint.initialize();
|
|
120
|
+
* console.log('ACL system ready');
|
|
121
|
+
*/
|
|
122
|
+
initialize(): Promise<void>;
|
|
123
|
+
/** The anonymous visitor. Lowercase `anonymous` is the role the policies name (#1059). */
|
|
124
|
+
anonymousSubject(): UserContext;
|
|
125
|
+
/**
|
|
126
|
+
* The name of the system principal — the server acting for itself at boot
|
|
127
|
+
* and from timers (#631).
|
|
128
|
+
*
|
|
129
|
+
* Owned by the environment: `ngdpbase.system.principal` ships as the bare
|
|
130
|
+
* env-ref `$NGDPBASE_SYSTEM_USER`, which THROWS when the variable is unset,
|
|
131
|
+
* so an instance with no named principal refuses to boot rather than
|
|
132
|
+
* acting as a default nobody chose. `.env` is not reachable from the admin
|
|
133
|
+
* UI, so the identity cannot be renamed through a form.
|
|
134
|
+
*/
|
|
135
|
+
systemPrincipalName(): string;
|
|
136
|
+
/** Whether `username` names the system principal. Case-insensitive, like the user store. */
|
|
137
|
+
isSystemPrincipal(username: string): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* The system principal as a permission subject (#631).
|
|
140
|
+
*
|
|
141
|
+
* Identity from `.env`; authority from the role catalog — `ngdpbase.system.roles`,
|
|
142
|
+
* `["admin"]` by default — evaluated by policy through the same door as any
|
|
143
|
+
* request (P2). Nothing here is a grant: the roles are read, not asserted.
|
|
144
|
+
* The name is reserved in `UserManager.createUser`, so no person can hold it.
|
|
145
|
+
*/
|
|
146
|
+
systemSubject(): UserContext;
|
|
147
|
+
/**
|
|
148
|
+
* An active account as a subject: its record, and the roles it holds NOW.
|
|
149
|
+
* `null` when there is no such account or it is inactive — the caller
|
|
150
|
+
* decides what that means (usually the anonymous subject).
|
|
151
|
+
*/
|
|
152
|
+
subjectFor(username: string): Promise<UserContext | null>;
|
|
153
|
+
/**
|
|
154
|
+
* Resolve a named user's CURRENT roles for a permission decision (#631).
|
|
155
|
+
*
|
|
156
|
+
* Used when a subject arrives without roles — a background job asking
|
|
157
|
+
* "what may my requester do, now?". An unknown, inactive or absent user
|
|
158
|
+
* resolves to the anonymous subject: the job then holds exactly what a
|
|
159
|
+
* visitor holds, which is the safe answer for someone who no longer exists.
|
|
160
|
+
*/
|
|
161
|
+
resolveSubjectNow(username: string | undefined): Promise<UserContext>;
|
|
162
|
+
/**
|
|
163
|
+
* Who is making this request: the subject the session middleware resolved,
|
|
164
|
+
* else the session's account resolved now, else the anonymous visitor.
|
|
165
|
+
* It was `UserManager.getCurrentUser` until #1431 step 13.
|
|
166
|
+
*
|
|
167
|
+
* __This returned Anonymous for every authenticated user, always (#1165).__
|
|
168
|
+
* It read `req.session.user.isAuthenticated`, and nothing in the codebase
|
|
169
|
+
* ever writes `req.session.user` — every login path writes the flat
|
|
170
|
+
* `req.session.username` + `req.session.isAuthenticated`
|
|
171
|
+
* (`WikiRoutes.ts:6786`, `:7002`, `:7081`, `app.ts:657`), which is also what
|
|
172
|
+
* the session middleware reads. `session.user` is a declared field with no
|
|
173
|
+
* writer, so the condition was never true.
|
|
174
|
+
*
|
|
175
|
+
* It went unnoticed because the one hot caller guards against it:
|
|
176
|
+
* `getCommonTemplateData` uses `req.userContext || getCurrentUser(req)`, so
|
|
177
|
+
* every rendered page took the first branch and looked correct. The audit
|
|
178
|
+
* routes call this directly, which is why they were the ones to break —
|
|
179
|
+
* `AuditManager` refused the query as 'Anonymous' on a request the route had
|
|
180
|
+
* just authorised as an admin.
|
|
181
|
+
*
|
|
182
|
+
* __`req.userContext` is preferred over the session now__, rather than only
|
|
183
|
+
* repairing the field name. It is the identity the middleware already
|
|
184
|
+
* resolved and validated, enriched with roles from RoleManager, and it is
|
|
185
|
+
* what the policy engine authorises against — so this method and every
|
|
186
|
+
* permission check now answer from the same place instead of two. It is also
|
|
187
|
+
* the only identity a bearer-token request has (#818): those carry no
|
|
188
|
+
* session at all, so the session path alone would still have said Anonymous.
|
|
189
|
+
*/
|
|
190
|
+
currentSubject(req: Request): Promise<UserContext>;
|
|
191
|
+
private userManager;
|
|
192
|
+
private roleManager;
|
|
193
|
+
/**
|
|
194
|
+
* Initialize audit logging system based on configuration.
|
|
195
|
+
*/
|
|
196
|
+
initializeAuditLogging(): Promise<void>;
|
|
197
|
+
/**
|
|
198
|
+
* The PDP this manager asks for the delegation ceilings and, in the next
|
|
199
|
+
* step, for the policy decision itself. Registered on the engine; built here
|
|
200
|
+
* only when it is not, so tests that stand an PolicyInformationPoint up alone still
|
|
201
|
+
* exercise the real ordering rather than skipping it (#1431).
|
|
202
|
+
*/
|
|
203
|
+
private policyDecisionPoint;
|
|
204
|
+
private _pdp?;
|
|
205
|
+
/**
|
|
206
|
+
* Check page permission using WikiContext — rich-return form (#714 Slice F).
|
|
207
|
+
*
|
|
208
|
+
* Same evaluator as {@link checkPagePermissionWithContext} but returns a
|
|
209
|
+
* `{ allowed, reason }` object instead of a bare boolean. Lets callers
|
|
210
|
+
* specialise their 403 response on the reason — e.g. an editPage route
|
|
211
|
+
* handler can detect `reason === 'author_lock_deny'` and render the
|
|
212
|
+
* specific "This page is author-locked" message rather than the generic
|
|
213
|
+
* "no permission to edit" 403.
|
|
214
|
+
*
|
|
215
|
+
* `reason` values currently emitted (from `logAccessDecision` call sites):
|
|
216
|
+
* - `token_scope_deny` (Tier -1, the PDP's ceiling)
|
|
217
|
+
* - `share_action_deny` / `share_expired` / `share_resource_deny` /
|
|
218
|
+
* `share_issuer_deny` (Tier -1, the PDP's ceiling)
|
|
219
|
+
* - `private_match` / `private_deny` (Tier 0)
|
|
220
|
+
* - `author_lock_deny` (Tier 0.5 — Slice A)
|
|
221
|
+
* - `frontmatter_principal_<p>` / `frontmatter_deny` (Tier 1)
|
|
222
|
+
* - `<policyName>` / `global_policy` (Tier 2)
|
|
223
|
+
* - `default_deny` (no tier decided)
|
|
224
|
+
*
|
|
225
|
+
* @async
|
|
226
|
+
* @param {WikiContext} wikiContext - The wiki context containing page and user info
|
|
227
|
+
* @param {string} action - Action to check (view, edit, delete, rename, upload)
|
|
228
|
+
* @returns {Promise<{ allowed: boolean; reason: string }>} Rich decision
|
|
229
|
+
*/
|
|
230
|
+
evaluatePagePermission(wikiContext: WikiContext, action: string): Promise<{
|
|
231
|
+
allowed: boolean;
|
|
232
|
+
reason: string;
|
|
233
|
+
}>;
|
|
234
|
+
/**
|
|
235
|
+
* Check page permission using WikiContext — boolean (back-compat) form.
|
|
236
|
+
*
|
|
237
|
+
* Thin wrapper around {@link evaluatePagePermission} (#714 Slice F) that
|
|
238
|
+
* discards the `reason` and returns just `allowed`. Existing callers
|
|
239
|
+
* (which only care about allow/deny) keep working without change.
|
|
240
|
+
*
|
|
241
|
+
* @async
|
|
242
|
+
* @param {WikiContext} wikiContext - The wiki context containing page and user info
|
|
243
|
+
* @param {string} action - Action to check (view, edit, delete, rename, upload)
|
|
244
|
+
* @returns {Promise<boolean>} True if permission granted
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* const canEdit = await policyInformationPoint.checkPagePermissionWithContext(wikiContext, 'edit');
|
|
248
|
+
* if (canEdit) console.log('User can edit page');
|
|
249
|
+
*/
|
|
250
|
+
checkPagePermissionWithContext(wikiContext: WikiContext, action: string): Promise<boolean>;
|
|
251
|
+
/**
|
|
252
|
+
* Would the page door allow this action — asked only to decide whether to
|
|
253
|
+
* SHOW a control (the view's Edit button), never before performing it
|
|
254
|
+
* (#1668). The page analogue of `holdsPermission` / `pdp.holds`: an
|
|
255
|
+
* affordance, which a door never asks.
|
|
256
|
+
*
|
|
257
|
+
* The same evaluator as {@link checkPagePermissionWithContext}, so the two
|
|
258
|
+
* always agree on allow/deny for the same subject and page. What it does not
|
|
259
|
+
* do is record: no audit record and no info log line. Showing a control is
|
|
260
|
+
* not an attempt, and recording it wrote an `authorization-deny` for every
|
|
261
|
+
* anonymous page view. Acting on the control goes through the door, which
|
|
262
|
+
* records a refusal.
|
|
263
|
+
*
|
|
264
|
+
* @param wikiContext - The request's context, holding the page and its metadata
|
|
265
|
+
* @param action - Page action (view, edit, delete, rename, upload)
|
|
266
|
+
* @returns True if the door would allow the action
|
|
267
|
+
*/
|
|
268
|
+
pageAffordance(wikiContext: WikiContext, action: string): Promise<boolean>;
|
|
269
|
+
/**
|
|
270
|
+
* Internal evaluator — walks the tiers in order (Tier -1 delegation
|
|
271
|
+
* ceilings → Tier 0 private → Tier 0.5 author-lock → Tier 1
|
|
272
|
+
* audience/access → Tier 2 global policies → default deny) and returns the
|
|
273
|
+
* rich `{ allowed, reason }` decision. First tier to answer wins.
|
|
274
|
+
*
|
|
275
|
+
* `evaluatePagePermission` (rich) and `checkPagePermissionWithContext`
|
|
276
|
+
* (boolean) both delegate here — the doors, which record every decision.
|
|
277
|
+
* `pageAffordance` delegates here with `record` false (#1668): the same
|
|
278
|
+
* walk, with no audit record and its trace at debug, because it only decides
|
|
279
|
+
* whether to show a control.
|
|
280
|
+
*/
|
|
281
|
+
private _runEvaluator;
|
|
282
|
+
/**
|
|
283
|
+
* The page's own tiers, walked in order, for ONE page (#1431 step 7c).
|
|
284
|
+
*
|
|
285
|
+
* The single implementation of the sequence. The decider and the list filter
|
|
286
|
+
* each used to carry their own copy of it, and "a listing can never name a
|
|
287
|
+
* page its reader cannot open, nor hide one they can" (#1219) held only for
|
|
288
|
+
* as long as someone remembered to change both. Now there is one to change.
|
|
289
|
+
*
|
|
290
|
+
* It decides and does nothing else — no log line, no audit record — because
|
|
291
|
+
* the filter runs it over thousands of pages. Each caller supplies what it
|
|
292
|
+
* can afford: how to ask policy (per page, or compiled once), and how to ask
|
|
293
|
+
* the author-lock override (lazily, or once per subject).
|
|
294
|
+
*
|
|
295
|
+
* Runs AFTER the delegation ceilings, which bound the subject rather than
|
|
296
|
+
* the page and so are each caller's to ask first. First tier to answer wins:
|
|
297
|
+
*
|
|
298
|
+
* - __Tier 0, private.__ Through `PageManager.checkPrivatePageAccess` — the
|
|
299
|
+
* page-index creator, owner or delegate, never a role (#711). Frontmatter
|
|
300
|
+
* `private` + `author` is the fallback where there is no PageManager.
|
|
301
|
+
* It only REFUSES (#1539): a subject it admits still faces policy, asked
|
|
302
|
+
* with the page's `vault`, so the owner's rights in their own vaults come
|
|
303
|
+
* from a policy on the `vault` resource type — the same door as any page.
|
|
304
|
+
* Tier 1 is skipped for a vault page: `audience` grants nothing there.
|
|
305
|
+
* - __Tier 0.5, author-lock__, `edit` only. It only denies: an author, or a
|
|
306
|
+
* subject holding `admin-system` (#1431 7b), falls through to Tier 1+.
|
|
307
|
+
* - __Tier 1, frontmatter__ `access[action]` / `audience`. Page-level, and
|
|
308
|
+
* overrides global policy when it states a rule (#1054).
|
|
309
|
+
* - __Tier 2.__ For a share visitor the share IS the policy (#1222); for
|
|
310
|
+
* anyone else, global policy.
|
|
311
|
+
* - __Default deny.__ Nothing below Tier 2 grants — JSPWiki's page-body ACL
|
|
312
|
+
* markup was removed (#1431 7a); an imported page's ACL is converted to
|
|
313
|
+
* audience terms by the NCM funnel (#1446).
|
|
314
|
+
*/
|
|
315
|
+
private walkPageTiers;
|
|
316
|
+
/**
|
|
317
|
+
* The private-container decision for something that is not a page — a file
|
|
318
|
+
* in a store (docs/private-stores.md, Access). The same rule a
|
|
319
|
+
* private page gets at Tier 0: the owner, or a delegate of the owner; never
|
|
320
|
+
* a role. A refusal is recorded like any page refusal (`authorization-deny`).
|
|
321
|
+
*
|
|
322
|
+
* @param userContext - the request's subject, as given (null = anonymous)
|
|
323
|
+
* @param owner - the container's owner (a private file's `creator`)
|
|
324
|
+
* @param resource - what is being reached, for the record (e.g. `attachment:<id>`)
|
|
325
|
+
* @param action - the action asked for (e.g. `view`)
|
|
326
|
+
* @param vault - the vault inside the container, when the question is about one:
|
|
327
|
+
* a share link the owner issued gets in only for a vault it names (#1388)
|
|
328
|
+
*/
|
|
329
|
+
canAccessPrivateContainer(userContext: UserContext | null | undefined, owner: string, resource: string, action: string, vault?: string): boolean;
|
|
330
|
+
/**
|
|
331
|
+
* Check whether a user can access a given page — for cross-page checks where
|
|
332
|
+
* the current WikiContext describes a DIFFERENT page than the one being
|
|
333
|
+
* checked (#714 Slice B).
|
|
334
|
+
*
|
|
335
|
+
* Loads the target page's metadata internally (`PageManager.getPageMetadata`)
|
|
336
|
+
* and constructs a minimal WikiContext shape for the evaluator. This is the
|
|
337
|
+
* implementation that {@link WikiContext.canAccess} delegates to when its
|
|
338
|
+
* `pageNameOverride` parameter is set.
|
|
339
|
+
*
|
|
340
|
+
* Used today by:
|
|
341
|
+
* - linked-page visibility filters (a list page wanting to drop entries
|
|
342
|
+
* the user can't view)
|
|
343
|
+
* - {@link WikiRoutes.serveAttachment}'s owning-page check (the page
|
|
344
|
+
* hosting the attachment may be private; the request URL is the
|
|
345
|
+
* attachment URL, not the page URL).
|
|
346
|
+
*
|
|
347
|
+
* Returns false when:
|
|
348
|
+
* - the target page has no resolvable metadata (deleted, never existed,
|
|
349
|
+
* or PageManager unavailable). This is the **conservative-on-security**
|
|
350
|
+
* default — see #714 EPIC body's "Behavior decision point" for the
|
|
351
|
+
* pre-#714 allow→deny shift for the private-attachment-no-page-name
|
|
352
|
+
* case.
|
|
353
|
+
* - any tier returns deny.
|
|
354
|
+
*
|
|
355
|
+
* @param userContext - The user requesting access (may be null / anonymous).
|
|
356
|
+
* @param pageName - Target page to check.
|
|
357
|
+
* @param action - Action verb (e.g., `'view'`, `'edit'`, `'delete'`).
|
|
358
|
+
* @param knownMetadata - The page's metadata when the caller has just
|
|
359
|
+
* resolved it: the page door (#1622), which reads the page by the same
|
|
360
|
+
* resolution it decides on. Omitted, it is loaded here.
|
|
361
|
+
*/
|
|
362
|
+
canUserAccessPage(userContext: UserContext | null | undefined, pageName: string, action: string, knownMetadata?: PageFrontmatter): Promise<boolean>;
|
|
363
|
+
/**
|
|
364
|
+
* {@link canUserAccessPage} as an affordance (#1668): would the door allow
|
|
365
|
+
* this action on that page — asked only to decide whether to show a control
|
|
366
|
+
* (the journal entry view's Edit link, `<wiki:If exists:>`). The same
|
|
367
|
+
* cross-page path and the same evaluator, so it agrees with the door; it
|
|
368
|
+
* records nothing. Acting on the control asks the door.
|
|
369
|
+
*
|
|
370
|
+
* @param knownMetadata - As for {@link canUserAccessPage}: the page's
|
|
371
|
+
* metadata when the caller has just resolved it (`PageManager.mayShowPage`).
|
|
372
|
+
*/
|
|
373
|
+
pageAffordanceFor(userContext: UserContext | null | undefined, pageName: string, action: string, knownMetadata?: PageFrontmatter): Promise<boolean>;
|
|
374
|
+
/** The cross-page check, for the door (`record`) or an affordance (#1668). */
|
|
375
|
+
private crossPageDecision;
|
|
376
|
+
/**
|
|
377
|
+
* Which of these pages may this user perform `action` on? (#1219)
|
|
378
|
+
*
|
|
379
|
+
* Rule 10's `filter(ctx, action, query)`: the tiers `_runEvaluator` applies
|
|
380
|
+
* to ONE page, applied over the page index — no disk read (metadata comes
|
|
381
|
+
* from the provider's in-memory cache), no log line and no audit record per
|
|
382
|
+
* page. Listing many and deciding one are the same evaluator, so a listing
|
|
383
|
+
* can never name a page its reader cannot open, nor hide one they can.
|
|
384
|
+
*
|
|
385
|
+
* Tier by tier, mirroring `_runEvaluator`: the token and share ceilings
|
|
386
|
+
* (once for the subject, then the share's resource cover per page); tier 0
|
|
387
|
+
* private through `PageManager.checkPrivatePageAccess`; tier 0.5
|
|
388
|
+
* author-lock for `edit`; tier 1 frontmatter audience/access; tier 2 global
|
|
389
|
+
* policy, compiled once through `PolicyEvaluator.compile`, or the share
|
|
390
|
+
* standing in for it. There is no longer a tier below that: the deprecated
|
|
391
|
+
* page-ACL markup was deleted in #1431 step 7, which is what removed the one
|
|
392
|
+
* divergence this filter had from `canUserAccessPage` — it could not read
|
|
393
|
+
* page content, so a page granted only by that markup used to be hidden
|
|
394
|
+
* here and visible there.
|
|
395
|
+
*
|
|
396
|
+
* A candidate without metadata is not listed (#714's convention). Order is
|
|
397
|
+
* preserved. Returns titles.
|
|
398
|
+
*/
|
|
399
|
+
filterAccessiblePages(userContext: UserContext | null | undefined, action: string, candidates: ReadonlyArray<{
|
|
400
|
+
title: string;
|
|
401
|
+
metadata: PageFrontmatter | null | undefined;
|
|
402
|
+
}>): Promise<string[]>;
|
|
403
|
+
/**
|
|
404
|
+
* May this user read this media item? (#1223, epic #1225)
|
|
405
|
+
*
|
|
406
|
+
* The media door's question, asked of the evaluator rather than answered
|
|
407
|
+
* in `MediaManager.getItem` and again in the share routes.
|
|
408
|
+
*
|
|
409
|
+
* __The share ceiling__, for a subject carrying `viaShare` — the twin of
|
|
410
|
+
* the page ceiling in `_runEvaluator`: `asset-read` must be delegated, the
|
|
411
|
+
* share unexpired, the item's keywords covered by the share's media
|
|
412
|
+
* resources (and not `owner-only`), and the issuer still holding
|
|
413
|
+
* `asset-read` live. An ordinary session is allowed: media items carry no
|
|
414
|
+
* per-item privacy and no page link (#1427).
|
|
415
|
+
*
|
|
416
|
+
* A refusal is audited as `authorization-deny` on the media resource, with
|
|
417
|
+
* the share attribution when there is one.
|
|
418
|
+
*/
|
|
419
|
+
canUserAccessMediaItem(userContext: UserContext | null | undefined, item: MediaItem): Promise<boolean>;
|
|
420
|
+
/**
|
|
421
|
+
* Check front matter audience / access fields (Tier 1.5).
|
|
422
|
+
* Returns a decision object; decided=false means no front matter restriction — fall through.
|
|
423
|
+
*/
|
|
424
|
+
private checkFrontmatterAccess;
|
|
425
|
+
/**
|
|
426
|
+
* Record/audit an access decision.
|
|
427
|
+
* Accepts either a single object or positional args for backward compatibility.
|
|
428
|
+
*/
|
|
429
|
+
logAccessDecision(userOrObj: UserContext | AccessDecisionLog, pageName?: string, action?: string, allowed?: boolean, reason?: string, _context?: Record<string, unknown>): void;
|
|
430
|
+
/** The name a decision is recorded under: the subject's, or `anonymous`. */
|
|
431
|
+
private static recordedUser;
|
|
432
|
+
/**
|
|
433
|
+
* Record a denied access decision in the audit trail (#1115).
|
|
434
|
+
*
|
|
435
|
+
* Best-effort and never awaited by the decision path: the answer to "may
|
|
436
|
+
* this user do this" must not depend on the audit backend being healthy, and
|
|
437
|
+
* a slow sink must not delay a page render. `authorization-deny` is standard
|
|
438
|
+
* tier for that reason — the critical tier is destruction and credentials.
|
|
439
|
+
*
|
|
440
|
+
* Everything about who asked — the name, the request's address, a share —
|
|
441
|
+
* is read here from the subject the decision was made for, so every
|
|
442
|
+
* denial this manager records carries the same fields (#1668: the address
|
|
443
|
+
* was dropped, `ipAddress: undefined`, on every page and media denial). The
|
|
444
|
+
* session and bearer middleware put the request's address on the subject.
|
|
445
|
+
*/
|
|
446
|
+
private auditDenial;
|
|
447
|
+
}
|
|
448
|
+
export default PolicyInformationPoint;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One vocabulary for page actions (#1431, step 5).
|
|
3
|
+
*
|
|
4
|
+
* A door asks for a PERMISSION, and every permission name is declared in
|
|
5
|
+
* `ngdpbase.permissions.definitions`. Page-level checks grew their own words
|
|
6
|
+
* anyway — `canAccess('view')`, `canAccess('edit')` — which are declared
|
|
7
|
+
* nowhere, and `PolicyInformationPoint.checkDefaultPermission` invented a third set with
|
|
8
|
+
* colons (`page:read`), declared nowhere either, so that check could only ever
|
|
9
|
+
* deny ([#1174](https://github.com/jwilleke/ngdpbase/issues/1174)).
|
|
10
|
+
*
|
|
11
|
+
* This is the one translation: the short word a caller passes, mapped to the
|
|
12
|
+
* registry name policy is written in. It exists so the mapping is not
|
|
13
|
+
* copied — it was already in `checkPagePermissionWithContext` twice, and in
|
|
14
|
+
* `checkDefaultPermission` in a different and broken form.
|
|
15
|
+
*
|
|
16
|
+
* New code should pass the registry name directly. The short forms stay
|
|
17
|
+
* because they are what a page author writes in `[{ALLOW view …}]` ACL markup,
|
|
18
|
+
* and that is a content syntax, not an internal vocabulary.
|
|
19
|
+
*/
|
|
20
|
+
/** The short words accepted at a page door, and in ACL markup. */
|
|
21
|
+
export declare const PAGE_ACTION_ALIASES: {
|
|
22
|
+
readonly view: "page-read";
|
|
23
|
+
readonly read: "page-read";
|
|
24
|
+
readonly edit: "page-edit";
|
|
25
|
+
readonly delete: "page-delete";
|
|
26
|
+
readonly create: "page-create";
|
|
27
|
+
readonly rename: "page-rename";
|
|
28
|
+
readonly export: "page-export";
|
|
29
|
+
readonly upload: "asset-upload";
|
|
30
|
+
};
|
|
31
|
+
export type PageActionAlias = keyof typeof PAGE_ACTION_ALIASES;
|
|
32
|
+
/**
|
|
33
|
+
* The registry permission a page action means.
|
|
34
|
+
*
|
|
35
|
+
* An unknown word is returned unchanged rather than guessed at: it is either
|
|
36
|
+
* already a registry name — which is what new code passes — or it is a typo,
|
|
37
|
+
* and the permission-registry invariant is what catches a typo, not a silent
|
|
38
|
+
* rewrite into `page:<whatever>` (which is what the deleted code did).
|
|
39
|
+
*/
|
|
40
|
+
export declare function permissionForPageAction(action: string): string;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/** Every permission core declares. Addons generate their own union. */
|
|
2
|
+
export type CorePermission =
|
|
3
|
+
/** Change what protects your own account — password, email, sign-in methods (passkeys), vault takeout and import, approving a device (#1525). Granted wherever profile-manage is; asks for a fresh sign-in when listed in ngdpbase.auth.step-up */
|
|
4
|
+
'account-security'
|
|
5
|
+
/** View administration screens (read-only, no changes) */
|
|
6
|
+
| 'admin-read'
|
|
7
|
+
/** Role management */
|
|
8
|
+
| 'admin-roles'
|
|
9
|
+
/** System administration */
|
|
10
|
+
| 'admin-system'
|
|
11
|
+
/** Delete assets */
|
|
12
|
+
| 'asset-delete'
|
|
13
|
+
/** Edit asset metadata (EXIF/IPTC/XMP) */
|
|
14
|
+
| 'asset-edit'
|
|
15
|
+
/** View assets (attachments) */
|
|
16
|
+
| 'asset-read'
|
|
17
|
+
/** Upload assets */
|
|
18
|
+
| 'asset-upload'
|
|
19
|
+
/** Export the audit trail to a file (#1638) */
|
|
20
|
+
| 'audit-export'
|
|
21
|
+
/** Add a comment, and delete your own; deleting anyone's is admin-system (#1198) */
|
|
22
|
+
| 'comment-create'
|
|
23
|
+
/** Change any configuration setting, and download a backup (#1525). Admin only by default; asks for a fresh sign-in when listed in ngdpbase.auth.step-up */
|
|
24
|
+
| 'config-manage'
|
|
25
|
+
/** Browse and view the media library (not delegated to anonymous visitors) */
|
|
26
|
+
| 'media-read'
|
|
27
|
+
/** Create new pages */
|
|
28
|
+
| 'page-create'
|
|
29
|
+
/** Delete pages */
|
|
30
|
+
| 'page-delete'
|
|
31
|
+
/** Edit pages */
|
|
32
|
+
| 'page-edit'
|
|
33
|
+
/** Export pages */
|
|
34
|
+
| 'page-export'
|
|
35
|
+
/** Make a page public: move it out of its vault (checked by the page's system-category, #1504) */
|
|
36
|
+
| 'page-public'
|
|
37
|
+
/** Edit a page's raw file in the admin raw editor — bypasses the page editor's checks (#1638) */
|
|
38
|
+
| 'page-raw-edit'
|
|
39
|
+
/** View pages */
|
|
40
|
+
| 'page-read'
|
|
41
|
+
/** Rename pages */
|
|
42
|
+
| 'page-rename'
|
|
43
|
+
/** Manage your own account — profile, preferences, display theme, pinned pages and the /my/* pages (#1198). Every signed-in role; never anonymous */
|
|
44
|
+
| 'profile-manage'
|
|
45
|
+
/** Let another person act for you, within permissions you hold, and revoke it (#1762). Every signed-in role except demo-admin; an administrator making or revoking a grant for someone else also needs user-edit, and that grant never carries a copy of the person's vault key. A grant that includes proxy-grant lets the proxy give others access too. Asks for a fresh sign-in */
|
|
46
|
+
| 'proxy-grant'
|
|
47
|
+
/** Search pages */
|
|
48
|
+
| 'search-page'
|
|
49
|
+
/** Search users */
|
|
50
|
+
| 'search-user'
|
|
51
|
+
/** Unmask a configuration secret (#1525). Admin only by default; asks for a fresh sign-in when listed in ngdpbase.auth.step-up. Hashed credentials (agent tokens) and shown-once secrets can never be revealed */
|
|
52
|
+
| 'secret-reveal'
|
|
53
|
+
/** End another person's signed-in session (#1638) */
|
|
54
|
+
| 'session-revoke'
|
|
55
|
+
/** Create share links — hand out anonymous read access to content you may read — and see your own (#1224, #1638) */
|
|
56
|
+
| 'share-create'
|
|
57
|
+
/** Extend your own share links (#1638) */
|
|
58
|
+
| 'share-extend'
|
|
59
|
+
/** Revoke your own share links; revoking anyone's also needs admin-system (#1638) */
|
|
60
|
+
| 'share-revoke'
|
|
61
|
+
/** Walk through a private store's door and create your own copy of it — with a user key and recovery words when the store kind is encrypted (#1414). Every signed-in role; never anonymous. The door also needs a password sign-in, so a token or share cannot use it */
|
|
62
|
+
| 'store-create'
|
|
63
|
+
/** Extend your own live agent tokens instead of minting new ones, to at most max-ttl-hours from now; the token and its scopes stay the same (#1734). Admin only by default. A token can never carry this scope */
|
|
64
|
+
| 'token-extend'
|
|
65
|
+
/** Mint, list and revoke your own agent tokens — a standing credential carrying a slice of your authority (#1198, #1178). Every signed-in role except demo-admin; never anonymous (#1734). A token can never carry this scope */
|
|
66
|
+
| 'token-mint'
|
|
67
|
+
/** Create user accounts */
|
|
68
|
+
| 'user-create'
|
|
69
|
+
/** Delete user accounts */
|
|
70
|
+
| 'user-delete'
|
|
71
|
+
/** Edit user accounts */
|
|
72
|
+
| 'user-edit'
|
|
73
|
+
/** View user list and profiles */
|
|
74
|
+
| 'user-read'
|
|
75
|
+
/** Let a person acting for you into your vaults (#1762). Read only from a proxy grant: a grant that includes it lets the proxy act inside your vaults within the grant's other permissions; without it a proxy never reaches them. Encrypted vaults stay shut to a proxy until a vault key copy is supported (#1762 slice 5). Every signed-in role except demo-admin, beside proxy-grant. Never carried by an agent token or an app */
|
|
76
|
+
| 'vault-proxy';
|
|
77
|
+
/** The same list at runtime, for a check that has to iterate. */
|
|
78
|
+
export declare const CORE_PERMISSIONS: readonly CorePermission[];
|