Skip to content

Commit 75b7b82

Browse files
Merge branch 'master' into unified-install-and-archive
2 parents 273b5b6 + de89315 commit 75b7b82

280 files changed

Lines changed: 9395 additions & 2156 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ci/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# NOTE: This Dockerfile is ONLY used to run certain tasks in CI. It is not used to run Kibana or as a distributable.
22
# If you're looking for the Kibana Docker image distributable, please see: src/dev/build/tasks/os_packages/docker_generator/templates/dockerfile.template.ts
33

4-
ARG NODE_VERSION=12.19.0
4+
ARG NODE_VERSION=12.19.1
55

66
FROM node:${NODE_VERSION} AS base
77

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
12.19.0
1+
12.19.1

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
12.19.0
1+
12.19.1

docs/developer/architecture/security/feature-registration.asciidoc

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,10 @@ server.route({
198198
=== Example 3: Discover
199199

200200
Discover takes advantage of subfeature privileges to allow fine-grained access control. In this example,
201-
a single "Create Short URLs" subfeature privilege is defined, which allows users to grant access to this feature without having to grant the `all` privilege to Discover. In other words, you can grant `read` access to Discover, and also grant the ability to create short URLs.
201+
two subfeature privileges are defined: "Create Short URLs", and "Generate PDF Reports". These allow users to grant access to this feature without having to grant the `all` privilege to Discover. In other words, you can grant `read` access to Discover, and also grant the ability to create short URLs or generate PDF reports.
202+
203+
Notice the "Generate PDF Reports" subfeature privilege has an additional `minimumPrivilege` option. Kibana will only offer this subfeature privilege if the
204+
license requirement is satisfied.
202205

203206
["source","javascript"]
204207
-----------
@@ -259,6 +262,28 @@ public setup(core, { features }) {
259262
},
260263
],
261264
},
265+
{
266+
groupType: 'independent',
267+
privileges: [
268+
{
269+
id: 'pdf_generate',
270+
name: i18n.translate(
271+
'xpack.features.ossFeatures.discoverGeneratePDFReportsPrivilegeName',
272+
{
273+
defaultMessage: 'Generate PDF Reports',
274+
}
275+
),
276+
minimumLicense: 'platinum',
277+
includeIn: 'all',
278+
savedObject: {
279+
all: [],
280+
read: [],
281+
},
282+
api: ['generatePDFReports'],
283+
ui: ['generatePDFReports'],
284+
},
285+
],
286+
},
262287
],
263288
},
264289
],

docs/getting-started/quick-start-guide.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,4 @@ For more information, refer to <<lens, *Lens*>>.
140140

141141
If you are you ready to add your own data, refer to <<connect-to-elasticsearch,Add data to {kib}>>.
142142

143-
If you want to ingest your data, refer to {ingest-guide}/ingest-management-getting-started.html[Quick start: Get logs and metrics into the Elastic Stack].
143+
If you want to ingest your data, refer to {ingest-guide}/fleet-quick-start.html[Quick start: Get logs and metrics into the Elastic Stack].

docs/setup/connect-to-elasticsearch.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ ship with dashboards and visualizations,
3737
so you can quickly get insights into your data.
3838

3939
To get started, refer to
40-
{ingest-guide}/ingest-management-getting-started.html[Quick start: Get logs and metrics into the Elastic Stack].
40+
{ingest-guide}/fleet-quick-start.html[Quick start: Get logs and metrics into the Elastic Stack].
4141

4242
[role="screenshot"]
4343
image::images/add-data-fleet.png[Add data using Fleet]

docs/user/security/authentication/index.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ You can also configure both PKI and basic authentication for the same {kib} inst
116116

117117
[source,yaml]
118118
--------------------------------------------------------------------------------
119+
server.ssl.clientAuthentication: optional
119120
xpack.security.authc.providers:
120121
pki.pki1:
121122
order: 0

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"**/typescript": "4.0.2"
9898
},
9999
"engines": {
100-
"node": "12.19.0",
100+
"node": "12.19.1",
101101
"yarn": "^1.21.1"
102102
},
103103
"dependencies": {
@@ -247,7 +247,7 @@
247247
"nock": "12.0.3",
248248
"node-fetch": "^2.6.1",
249249
"node-forge": "^0.10.0",
250-
"nodemailer": "^4.7.0",
250+
"nodemailer": "^6.4.16",
251251
"normalize-path": "^3.0.0",
252252
"object-hash": "^1.3.1",
253253
"object-path-immutable": "^3.1.1",
@@ -500,7 +500,7 @@
500500
"@types/node": "12.19.4",
501501
"@types/node-fetch": "^2.5.7",
502502
"@types/node-forge": "^0.9.5",
503-
"@types/nodemailer": "^6.2.1",
503+
"@types/nodemailer": "^6.4.0",
504504
"@types/normalize-path": "^3.0.0",
505505
"@types/object-hash": "^1.3.0",
506506
"@types/opn": "^5.1.0",
@@ -723,7 +723,7 @@
723723
"less": "npm:@elastic/less@2.7.3-kibana",
724724
"license-checker": "^16.0.0",
725725
"listr": "^0.14.1",
726-
"lmdb-store": "^0.6.10",
726+
"lmdb-store": "^0.8.11",
727727
"load-grunt-config": "^3.0.1",
728728
"loader-utils": "^1.2.3",
729729
"log-symbols": "^2.2.0",

packages/kbn-optimizer/src/node/cache.ts

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import Path from 'path';
2121

22-
// @ts-expect-error no types available
2322
import * as LmdbStore from 'lmdb-store';
2423
import { REPO_ROOT, UPSTREAM_BRANCH } from '@kbn/dev-utils';
2524

@@ -37,25 +36,11 @@ const MINUTE = 1000 * 60;
3736
const HOUR = MINUTE * 60;
3837
const DAY = HOUR * 24;
3938

40-
interface Lmdb<T> {
41-
get(key: string): T | undefined;
42-
put(key: string, value: T, version?: number, ifVersion?: number): Promise<boolean>;
43-
remove(key: string, ifVersion?: number): Promise<boolean>;
44-
openDB<T>(options: { name: string; encoding: 'msgpack' | 'string' | 'json' | 'binary' }): Lmdb<T>;
45-
getRange(options?: {
46-
start?: T;
47-
end?: T;
48-
reverse?: boolean;
49-
limit?: number;
50-
versions?: boolean;
51-
}): Iterable<{ key: string; value: T }>;
52-
}
53-
5439
export class Cache {
55-
private readonly codes: Lmdb<string>;
56-
private readonly atimes: Lmdb<string>;
57-
private readonly mtimes: Lmdb<string>;
58-
private readonly sourceMaps: Lmdb<any>;
40+
private readonly codes: LmdbStore.RootDatabase;
41+
private readonly atimes: LmdbStore.Database;
42+
private readonly mtimes: LmdbStore.Database;
43+
private readonly sourceMaps: LmdbStore.Database;
5944
private readonly prefix: string;
6045

6146
constructor(config: { prefix: string }) {
@@ -64,19 +49,23 @@ export class Cache {
6449
this.codes = LmdbStore.open({
6550
name: 'codes',
6651
path: CACHE_DIR,
52+
// @ts-expect-error See https://github.com/DoctorEvidence/lmdb-store/pull/18
6753
maxReaders: 500,
6854
});
6955

56+
// @ts-expect-error See https://github.com/DoctorEvidence/lmdb-store/pull/18
7057
this.atimes = this.codes.openDB({
7158
name: 'atimes',
7259
encoding: 'string',
7360
});
7461

62+
// @ts-expect-error See https://github.com/DoctorEvidence/lmdb-store/pull/18
7563
this.mtimes = this.codes.openDB({
7664
name: 'mtimes',
7765
encoding: 'string',
7866
});
7967

68+
// @ts-expect-error See https://github.com/DoctorEvidence/lmdb-store/pull/18
8069
this.sourceMaps = this.codes.openDB({
8170
name: 'sourceMaps',
8271
encoding: 'msgpack',
@@ -92,7 +81,7 @@ export class Cache {
9281
}
9382

9483
getMtime(path: string) {
95-
return this.mtimes.get(this.getKey(path));
84+
return this.safeGet<string>(this.mtimes, this.getKey(path));
9685
}
9786

9887
getCode(path: string) {
@@ -103,11 +92,11 @@ export class Cache {
10392
// touched in a long time (currently 30 days)
10493
this.atimes.put(key, GLOBAL_ATIME).catch(reportError);
10594

106-
return this.codes.get(key);
95+
return this.safeGet<string>(this.codes, key);
10796
}
10897

10998
getSourceMap(path: string) {
110-
return this.sourceMaps.get(this.getKey(path));
99+
return this.safeGet<any>(this.sourceMaps, this.getKey(path));
111100
}
112101

113102
update(path: string, file: { mtime: string; code: string; map: any }) {
@@ -125,17 +114,27 @@ export class Cache {
125114
return `${this.prefix}${path}`;
126115
}
127116

117+
private safeGet<V>(db: LmdbStore.Database, key: string) {
118+
try {
119+
return db.get(key) as V | undefined;
120+
} catch (error) {
121+
// get errors indicate that a key value is corrupt in some way, so remove it
122+
db.removeSync(key);
123+
}
124+
}
125+
128126
private async pruneOldKeys() {
129127
try {
130128
const ATIME_LIMIT = Date.now() - 30 * DAY;
131129
const BATCH_SIZE = 1000;
132130

133-
const validKeys: string[] = [];
134-
const invalidKeys: string[] = [];
131+
const validKeys: LmdbStore.Key[] = [];
132+
const invalidKeys: LmdbStore.Key[] = [];
135133

134+
// @ts-expect-error See https://github.com/DoctorEvidence/lmdb-store/pull/18
136135
for (const { key, value } of this.atimes.getRange()) {
137-
const atime = parseInt(value, 10);
138-
if (atime < ATIME_LIMIT) {
136+
const atime = parseInt(`${value}`, 10);
137+
if (Number.isNaN(atime) || atime < ATIME_LIMIT) {
139138
invalidKeys.push(key);
140139
} else {
141140
validKeys.push(key);

packages/kbn-plugin-helpers/src/cli.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export function runCli() {
9090

9191
await Tasks.initTargets(context);
9292
await Tasks.optimize(context);
93+
await Tasks.writePublicAssets(context);
9394
await Tasks.writeServerFiles(context);
9495
await Tasks.yarnInstall(context);
9596

0 commit comments

Comments
 (0)