Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade hapi to @hapi/hapi 18.4.1 #61959

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@
"url": "https://github.com/elastic/kibana.git"
},
"resolutions": {
"**/@hapi/iron": "^5.1.4",
"**/@types/node": ">=10.17.17 <10.20.0",
"**/@types/react": "^16.9.19",
"**/@types/react-router": "^5.1.3",
"**/@types/hapi": "^17.0.18",
"**/@types/hapi__hapi": "^18.2.6",
"**/@types/hapi__hapi/@types/hapi__boom": "^7.4.1",
"**/@types/angular": "^1.6.56",
"**/@types/hoist-non-react-statics": "^3.3.1",
"**/typescript": "3.7.2",
Expand Down Expand Up @@ -127,8 +129,16 @@
"@elastic/numeral": "2.4.0",
"@elastic/request-crypto": "^1.0.2",
"@elastic/ui-ace": "0.2.3",
"@hapi/good-squeeze": "5.2.1",
"@hapi/wreck": "^15.0.2",
"@hapi/boom": "^7.4.11",
"@hapi/cookie": "^10.1.2",
"@hapi/good-squeeze": "^5.2.1",
"@hapi/h2o2": "^8.3.2",
"@hapi/hoek": "^8.5.1",
"@hapi/hapi": "^18.4.1",
"@hapi/inert": "^5.2.2",
"@hapi/podium": "^3.4.3",
"@hapi/vision": "^5.5.4",
"@hapi/wreck": "^15.1.0",
"@kbn/analytics": "1.0.0",
"@kbn/babel-code-parser": "1.0.0",
"@kbn/babel-preset": "1.0.0",
Expand All @@ -152,7 +162,6 @@
"autoprefixer": "^9.7.4",
"babel-loader": "^8.0.6",
"bluebird": "3.5.5",
"boom": "^7.2.0",
"brace": "0.11.1",
"browserslist-useragent": "^3.0.2",
"cache-loader": "^4.1.0",
Expand Down Expand Up @@ -182,17 +191,12 @@
"glob": "^7.1.2",
"glob-all": "^3.2.1",
"globby": "^8.0.1",
"h2o2": "^8.1.2",
"handlebars": "4.5.3",
"hapi": "^17.5.3",
"hapi-auth-cookie": "^9.0.0",
"history": "^4.9.0",
"hjson": "3.2.1",
"hoek": "^5.0.4",
"http-proxy-agent": "^2.1.0",
"https-proxy-agent": "^5.0.0",
"immer": "^1.5.0",
"inert": "^5.1.0",
"inline-style": "^2.0.0",
"joi": "^13.5.2",
"jquery": "^3.4.1",
Expand Down Expand Up @@ -276,7 +280,6 @@
"vega-lite": "^2.6.0",
"vega-schema-url-parser": "1.0.0",
"vega-tooltip": "^0.12.0",
"vision": "^5.3.3",
"webpack": "^4.41.5",
"webpack-merge": "4.2.2",
"whatwg-fetch": "^3.0.0",
Expand Down Expand Up @@ -309,7 +312,6 @@
"@types/angular-mocks": "^1.7.0",
"@types/babel__core": "^7.1.2",
"@types/bluebird": "^3.1.1",
"@types/boom": "^7.2.0",
"@types/browserslist-useragent": "^3.0.0",
"@types/chance": "^1.0.0",
"@types/cheerio": "^0.22.10",
Expand All @@ -330,13 +332,14 @@
"@types/glob": "^7.1.1",
"@types/globby": "^8.0.0",
"@types/graphql": "^0.13.2",
"@types/h2o2": "^8.1.1",
"@types/hapi": "^17.0.18",
"@types/hapi-auth-cookie": "^9.1.0",
"@types/hapi__boom": "^7.4.1",
"@types/hapi__cookie": "^10.1.0",
"@types/hapi__h2o2": "8.3.0",
"@types/hapi__hapi": "^18.2.6",
"@types/hapi__inert": "^5.2.0",
"@types/hapi__podium": "^3.4.0",
"@types/has-ansi": "^3.0.0",
"@types/history": "^4.7.3",
"@types/hoek": "^4.1.3",
"@types/inert": "^5.1.2",
"@types/jest": "24.0.19",
"@types/joi": "^13.4.2",
"@types/jquery": "^3.3.31",
Expand All @@ -360,7 +363,6 @@
"@types/opn": "^5.1.0",
"@types/pegjs": "^0.10.1",
"@types/pngjs": "^3.3.2",
"@types/podium": "^1.0.0",
"@types/prop-types": "^15.5.3",
"@types/reach__router": "^1.2.6",
"@types/react": "^16.9.19",
Expand Down
40 changes: 20 additions & 20 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -382,22 +382,30 @@
'(\\b|_)hapi(\\b|_)',
],
packageNames: [
'hapi',
'@types/hapi',
'@hapi/hapi',
'@types/hapi__hapi',
'joi',
'@types/joi',
'boom',
'@types/boom',
'hoek',
'@types/hoek',
'h2o2',
'@types/h2o2',
'@hapi/boom',
'@types/hapi__boom',
'@hapi/hoek',
'@types/hapi__hoek',
'@hapi/h2o2',
'@types/hapi__h2o2',
'@hapi/cookie',
'@types/hapi__cookie',
'@elastic/good',
'@types/elastic__good',
'good-squeeze',
'@types/good-squeeze',
'inert',
'@types/inert',
'@hapi/good-squeeze',
'@types/hapi__good-squeeze',
'@hapi/inert',
'@types/hapi__inert',
'@hapi/podium',
'@types/hapi__podium',
'@hapi/vision',
'@types/hapi__vision',
'@hapi/wreck',
'@types/hapi__wreck',
],
},
{
Expand Down Expand Up @@ -761,14 +769,6 @@
'@types/pngjs',
],
},
{
groupSlug: 'podium',
groupName: 'podium related packages',
packageNames: [
'podium',
'@types/podium',
],
},
{
groupSlug: 'proper-lockfile',
groupName: 'proper-lockfile related packages',
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/elasticsearch/errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import Boom from 'boom';
import Boom from '@hapi/boom';

import { ElasticsearchErrorHelpers } from './errors';

Expand Down
2 changes: 1 addition & 1 deletion src/core/server/elasticsearch/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import Boom from 'boom';
import Boom from '@hapi/boom';
import { get } from 'lodash';

const code = Symbol('ElasticsearchError');
Expand Down
4 changes: 2 additions & 2 deletions src/core/server/http/base_path_proxy_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { Agent as HttpsAgent, ServerOptions as TlsOptions } from 'https';

import apm from 'elastic-apm-node';
import { ByteSizeValue } from '@kbn/config-schema';
import { Server, Request, ResponseToolkit } from 'hapi';
import HapiProxy from 'h2o2';
import { Server, Request, ResponseToolkit } from '@hapi/hapi';
import HapiProxy from '@hapi/h2o2';
import { sample } from 'lodash';
import BrowserslistUserAgent from 'browserslist-useragent';
import * as Rx from 'rxjs';
Expand Down
17 changes: 13 additions & 4 deletions src/core/server/http/cookie_session_storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* under the License.
*/

import { Request, Server } from 'hapi';
import hapiAuthCookie from 'hapi-auth-cookie';
import { Request, Server } from '@hapi/hapi';
import hapiAuthCookie from '@hapi/cookie';

import { KibanaRequest, ensureRawRequest } from './router';
import { SessionStorageFactory, SessionStorage } from './session_storage';
Expand Down Expand Up @@ -73,7 +73,16 @@ class ScopedCookieSessionStorage<T extends Record<string, any>> implements Sessi
const session = await this.server.auth.test('security-cookie', this.request);
// A browser can send several cookies, if it's not an array, just return the session value
if (!Array.isArray(session)) {
return session as T;
// TypeScript note: Casting to `unknown` to fix the following error:
//
// Conversion of type 'AuthenticationData' to type 'T' may be a mistake
// because neither type sufficiently overlaps with the other. If this
// was intentional, convert the expression to 'unknown' first.
//
// 'AuthenticationData' is assignable to the constraint of type 'T', but
// 'T' could be instantiated with a different subtype of constraint
// 'Record<string, any>'.
return (session as unknown) as T;
}

// If we have an array with one value, we're good also
Expand Down Expand Up @@ -128,7 +137,7 @@ export async function createCookieSessionStorageFactory<T>(
server.auth.strategy('security-cookie', 'cookie', {
cookie: cookieOptions.name,
password: cookieOptions.encryptionKey,
validateFunc: async (req, session: T | T[]) => {
validateFunc: async (req: Request, session: T | T[]) => {
const result = cookieOptions.validate(session);
if (!result.isValid) {
clearInvalidCookie(req, result.path);
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/http/http_server.mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { Request } from 'hapi';
import { Request } from '@hapi/hapi';
import { merge } from 'lodash';
import { Socket } from 'net';
import { stringify } from 'query-string';
Expand Down
4 changes: 2 additions & 2 deletions src/core/server/http/http_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
import { Server } from 'hapi';
import HapiStaticFiles from 'inert';
import { Server } from '@hapi/hapi';
import HapiStaticFiles from '@hapi/inert';
import url from 'url';

import { Logger, LoggerFactory } from '../logging';
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/http/http_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { Server } from 'hapi';
import { Server } from '@hapi/hapi';
import { CspConfig } from '../csp';
import { mockRouter } from './router/router.mock';
import { configMock } from '../config/config.mock';
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/http/http_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import { Observable, Subscription, combineLatest } from 'rxjs';
import { first, map } from 'rxjs/operators';
import { Server } from 'hapi';
import { Server } from '@hapi/hapi';

import { CoreService } from '../../types';
import { Logger, LoggerFactory } from '../logging';
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/http/http_tools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jest.mock('fs', () => ({
}));

import supertest from 'supertest';
import { Request, ResponseToolkit } from 'hapi';
import { Request, ResponseToolkit } from '@hapi/hapi';
import Joi from 'joi';

import { defaultValidationErrorHandler, HapiValidationError, getServerOptions } from './http_tools';
Expand Down
4 changes: 2 additions & 2 deletions src/core/server/http/http_tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* under the License.
*/

import { Lifecycle, Request, ResponseToolkit, Server, ServerOptions, Util } from 'hapi';
import Hoek from 'hoek';
import { Lifecycle, Request, ResponseToolkit, Server, ServerOptions, Util } from '@hapi/hapi';
import Hoek from '@hapi/hoek';
import { ServerOptions as TLSOptions } from 'https';
import { ValidationError } from 'joi';
import { HttpConfig } from './http_config';
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/http/https_redirect_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { Request, ResponseToolkit, Server } from 'hapi';
import { Request, ResponseToolkit, Server } from '@hapi/hapi';
import { format as formatUrl } from 'url';

import { Logger } from '../logging';
Expand Down
4 changes: 2 additions & 2 deletions src/core/server/http/integration_tests/core_services.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
import Boom from 'boom';
import { Request } from 'hapi';
import Boom from '@hapi/boom';
import { Request } from '@hapi/hapi';
import { clusterClientMock } from './core_service.test.mocks';

import * as kbnTestServer from '../../../../test_utils/kbn_server';
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/http/integration_tests/router.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import { Stream } from 'stream';
import Boom from 'boom';
import Boom from '@hapi/boom';
import supertest from 'supertest';
import { schema } from '@kbn/config-schema';

Expand Down
2 changes: 1 addition & 1 deletion src/core/server/http/lifecycle/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { Lifecycle, Request, ResponseToolkit } from 'hapi';
import { Lifecycle, Request, ResponseToolkit } from '@hapi/hapi';
import { Logger } from '../../logging';
import {
HapiResponseAdapter,
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/http/lifecycle/on_post_auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { Lifecycle, Request, ResponseToolkit as HapiResponseToolkit } from 'hapi';
import { Lifecycle, Request, ResponseToolkit as HapiResponseToolkit } from '@hapi/hapi';
import { Logger } from '../../logging';
import {
HapiResponseAdapter,
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/http/lifecycle/on_pre_auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { Lifecycle, Request, ResponseToolkit as HapiResponseToolkit } from 'hapi';
import { Lifecycle, Request, ResponseToolkit as HapiResponseToolkit } from '@hapi/hapi';
import { Logger } from '../../logging';
import {
HapiResponseAdapter,
Expand Down
4 changes: 2 additions & 2 deletions src/core/server/http/lifecycle/on_pre_response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* under the License.
*/

import { Lifecycle, Request, ResponseToolkit as HapiResponseToolkit } from 'hapi';
import Boom from 'boom';
import { Lifecycle, Request, ResponseToolkit as HapiResponseToolkit } from '@hapi/hapi';
import Boom from '@hapi/boom';
import { Logger } from '../../logging';

import { HapiResponseAdapter, KibanaRequest, ResponseHeaders } from '../router';
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/http/router/error_wrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import Boom from 'boom';
import Boom from '@hapi/boom';
import { KibanaResponse, KibanaResponseFactory, kibanaResponseFactory } from './response';
import { wrapErrors } from './error_wrapper';
import { KibanaRequest, RequestHandler, RequestHandlerContext } from 'kibana/server';
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/http/router/error_wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import Boom from 'boom';
import Boom from '@hapi/boom';
import { KibanaRequest } from './request';
import { KibanaResponseFactory } from './response';
import { RequestHandler } from './router';
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/http/router/request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { RouteOptions } from 'hapi';
import { RouteOptions } from '@hapi/hapi';
import { KibanaRequest } from './request';
import { httpServerMock } from '../http_server.mocks';
import { schema } from '@kbn/config-schema';
Expand Down
Loading