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

Fix: dependabot security fixes #356

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
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
19 changes: 15 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ module.exports = {
ecmaVersion: 2018,
},
extends: ['@sentry-internal/sdk'],
ignorePatterns: ['build/**', 'dist/**', 'esm/**', 'examples/**', 'scripts/**', 'src/js/Ionic/**', '__tests__/**'],
plugins: ['@sentry-internal/sdk'],
ignorePatterns: ['build/**', 'dist/**', 'esm/**', 'sample/**', 'scripts/**', 'src/js/Ionic/**', '__tests__/**'],
overrides: [
{
files: ['*.ts', '*.tsx', '*.d.ts'],
Expand All @@ -22,10 +23,20 @@ module.exports = {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@sentry-internal/sdk/no-async-await': 'off',
'@sentry-internal/sdk/no-optional-chaining': 'off',
'@sentry-internal/sdk/no-nullish-coalescing': 'off',
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description',
},
],
},
},
],
rules: {
'@sentry-internal/sdk/no-async-await': 'off',
'@sentry-internal/sdk/no-optional-chaining': 'off',
'@sentry-internal/sdk/no-nullish-coalescing': 'off',
'@sentry-internal/sdk/no-class-field-initializers': 'off',
'@sentry-internal/sdk/no-unsupported-es6-methods' : 'off',
}
};
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,8 @@ package-lock.json
# Generated Lockfiles
Cartfile.resolved

# Yarn cache
.yarn

# Yalc
sample/yalc.lock
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Dependencies

- Bump `sentry-wizard` to 3.34.2 ([#356](https://github.com/getsentry/sentry-cordova/pull/356))

## 1.4.0

### Features
Expand Down
4 changes: 2 additions & 2 deletions dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function checkDocs() {

function getCleanTitleWithPrLink() {
const title = danger.github.pr.title;
return title.split(": ").slice(-1)[0].trim().replace(/\.+$/, "") + ` ` + PR_LINK;
return `${title.split(": ").slice(-1)[0].trim().replace(/\.+$/, "") } ${ PR_LINK}`;
}

function getChangelogDetailsHtml() {
Expand All @@ -41,7 +41,7 @@ async function checkChangelog() {

// Check if skipped
const skipChangelog =
danger.github && (danger.github.pr.body + "").toLowerCase().includes("#skip-changelog");
danger.github && (`${danger.github.pr.body }`).toLowerCase().includes("#skip-changelog");

if (skipChangelog) {
return;
Expand Down
39 changes: 20 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,47 +29,48 @@
"@sentry/hub": "7.119.1",
"@sentry/types": "7.119.1",
"@sentry/utils": "7.119.1",
"@sentry/wizard": "^3.32.0"
"@sentry/wizard": "^3.34.2"
},
"devDependencies": {
"@jest/types": "^26.0.0",
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.1",
Comment on lines +36 to +39
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we upgraded the build tooling, is the built shipped JS still the same or where there any changes introduced?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a diff check and no break changes were introduced, the only changes were just the ones made on the PR in regard to code formatting.

"@sentry-internal/eslint-config-sdk": "7.119.1",
"@sentry-internal/typescript": "7.119.1",
"@types/cordova": "0.0.34",
"@types/jest": "^24.0.18",
"@types/jest": "^26.0.24",
"@types/node": "^12.7.5",
"codecov": "^3.5.0",
"eslint": "7.6.0",
"jest": "^24.9.0",
"npm-run-all": "^4.1.5",
"prettier": "^1.18.2",
"@types/prettier": "<2.6.0",
"eslint": "^7.13.0",
"jest": "^26.6.3",
"json-schema": "^0.4.0",
"prettier": "^3.3.3",
"prettier-check": "^2.0.0",
"replace-in-file": "^4.1.3",
"rimraf": "^3.0.0",
"replace-in-file": "^8.2.0",
"rollup": "^2.79.2",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-node-resolve": "^4.2.3",
"rollup-plugin-terser": "^4.0.4",
"rollup-plugin-typescript2": "^0.21.0",
"ts-jest": "^24.1.0",
"typescript": "^3.6.3"
"ts-jest": "^26.5.0",
"typescript": "^3.6.3",
"yarn": "^1.22.22"
},
"scripts": {
"build:bundle": "rollup --config",
"build:typescript": "tsc -p tsconfig.build.json",
"build": "run-s clean build:typescript build:bundle",
lucas-zimerman marked this conversation as resolved.
Show resolved Hide resolved
"build": "yarn run clean && yarn run build:typescript && yarn run build:bundle",
"clean": "rimraf dist coverage",
"jest": "jest",
"test:watch": "jest --watch",
"test": "jest",
"codecov": "codecov",
"lint": "run-s lint:prettier lint:eslint",
"lint": "yarn run lint:prettier && yarn run lint:eslint",
"lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
"lint:eslint": "eslint . --cache --format stylish",
"fix": "run-s fix:eslint fix:prettier",
"fix": "yarn run fix:eslint && yarn run fix:prettier",
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
"fix:eslint": "eslint . --format stylish --fix",
"preversion:changelog": "grep -q -F \"## v$npm_package_version\" CHANGELOG.md",
"version:all": "run-s preversion:changelog version:bump test",
"version:all": "yarn run preversion:changelog && yarn run version:bump && yarn run test",
"version:bump": "node ./scripts/versionbump.js && git add -A"
},
"jest": {
Expand Down
20 changes: 9 additions & 11 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import commonjs from 'rollup-plugin-commonjs';
import { terser } from 'rollup-plugin-terser';
import resolve from 'rollup-plugin-node-resolve';
import typescript from 'rollup-plugin-typescript2';
import commonjs from '@rollup/plugin-commonjs';
import terser from '@rollup/plugin-terser';
import resolve from '@rollup/plugin-node-resolve';
import ts from '@rollup/plugin-typescript';

const terserInstance = terser({
mangle: {
Expand All @@ -17,14 +17,12 @@ const terserInstance = terser({
});

const defaultPlugins = [
typescript({
ts({
tsconfig: 'tsconfig.build.json',
tsconfigOverride: {
compilerOptions: {
declaration: false,
declarationMap: false,
module: 'ES2015',
},
compilerOptions: {
declaration: false,
declarationMap: false,
module: 'ES2015', // Set module to ES2015
},
}),
resolve({
Expand Down
2 changes: 1 addition & 1 deletion sample/www/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ function onDeviceReady() {
tracesSampleRate: 1,
});

console.log('Running cordova-' + cordova.platformId + '@' + cordova.version);
console.log(`Running cordova-${ cordova.platformId }@${ cordova.version}`);
document.getElementById('deviceready').classList.add('ready');
}
15 changes: 8 additions & 7 deletions src/js/__tests__/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line deprecation/deprecation
import { getGlobalObject } from '@sentry/utils';

import type { CordovaOptions } from '../options';
Expand Down Expand Up @@ -32,6 +33,7 @@ jest.mock('../utils', () => {
describe('Tests SDK', () => {
describe('init', () => {
it('Uses SENTRY_RELEASE environment variable if present.', () => {
// eslint-disable-next-line deprecation/deprecation
const window = getGlobalObject<any>();
window.SENTRY_RELEASE = {
id: 'test-release',
Expand All @@ -43,6 +45,7 @@ describe('Tests SDK', () => {
});

it('User release has precedence over SENTRY_RELEASE', () => {
// eslint-disable-next-line deprecation/deprecation
const window = getGlobalObject<any>();
window.SENTRY_RELEASE = {
id: 'test-release',
Expand All @@ -56,15 +59,14 @@ describe('Tests SDK', () => {
});

describe('ios Options', () => {

it('Should include iOS parameters when running on iOS', async () => {
(getPlatform as jest.Mock).mockReturnValue('ios');

const expectedOptions: CordovaOptions = {
environment: 'abc',
// iOS parameters
enableAppHangTracking: true,
appHangTimeoutInterval: 123
appHangTimeoutInterval: 123,
};

Sdk.init(expectedOptions);
Expand All @@ -77,19 +79,18 @@ describe('Tests SDK', () => {
(getPlatform as jest.Mock).mockReturnValue('android');

const expectedOption = {
environment: 'abc'
}
environment: 'abc',
};
const unexpectedOptions = {
appHangTimeoutInterval: 123,
enableAppHangTracking: true
enableAppHangTracking: true,
};

Sdk.init({ ...unexpectedOptions, ...expectedOption });

expect(optionsTest.current).not.toContain(unexpectedOptions);
expect(optionsTest.current?.environment).toEqual(expectedOption.environment);
});
})

});
});
});
2 changes: 1 addition & 1 deletion src/js/__tests__/wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ declare global {
const setupGlobals = (): void => {
// @ts-ignore Global
global.Cordova = {
exec: jest.fn(resolve => resolve()),
exec: jest.fn((resolve) => resolve()),
};

// @ts-ignore Global
Expand Down
1 change: 1 addition & 0 deletions src/js/integrations/cordova.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class Cordova implements Integration {
*/
public setupOnce(): void {
addEventProcessor((event: Event) => {
// eslint-disable-next-line deprecation/deprecation
const self = getCurrentHub().getIntegration(Cordova);
if (self) {
return normalizeData(event) as Event;
Expand Down
2 changes: 1 addition & 1 deletion src/js/integrations/eventorigin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class EventOrigin implements Integration {
* @inheritDoc
*/
public setupOnce(): void {
addEventProcessor(event => {
addEventProcessor((event) => {
event.tags = event.tags ?? {};

event.tags['event.origin'] = 'cordova';
Expand Down
7 changes: 3 additions & 4 deletions src/js/integrations/sdkinfo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Integration } from '@sentry/types';
import { addEventProcessor } from '@sentry/core';
import type { Integration } from '@sentry/types';

import { SDK_NAME, SDK_VERSION } from '../version';
import { addEventProcessor } from '@sentry/core';

/** Default SdkInfo instrumentation */
export class SdkInfo implements Integration {
Expand All @@ -19,8 +19,7 @@ export class SdkInfo implements Integration {
* @inheritDoc
*/
public setupOnce(): void {
addEventProcessor(async event => {

addEventProcessor(async (event) => {
event.platform = event.platform || 'javascript';
event.sdk = {
...event.sdk,
Expand Down
69 changes: 34 additions & 35 deletions src/js/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import type { BrowserOptions } from '@sentry/browser';
* Configuration options for the Sentry Cordova SDK.
* @see CordovaFrontend for more information.
*/
export interface CordovaOptions
extends Omit<BrowserOptions, 'autoSessionTracking'> {
export interface CordovaOptions extends Omit<BrowserOptions, 'autoSessionTracking'> {
/**
* Enables crash reporting for native crashes.
* Defaults to `true`.
Expand Down Expand Up @@ -33,43 +32,43 @@ export interface CordovaOptions
attachThreads?: boolean;

/**
* Enables Out of Memory Tracking for iOS and macCatalyst.
* See the following link for more information and possible restrictions:
* https://docs.sentry.io/platforms/apple/guides/ios/configuration/out-of-memory/
*
* @default true
* */
* Enables Out of Memory Tracking for iOS and macCatalyst.
* See the following link for more information and possible restrictions:
* https://docs.sentry.io/platforms/apple/guides/ios/configuration/out-of-memory/
*
* @default true
* */
enableWatchdogTerminationTracking?: boolean;

/**
* Enables Out of Memory Tracking for iOS and macCatalyst.
* See the following link for more information and possible restrictions:
* https://docs.sentry.io/platforms/apple/guides/ios/configuration/out-of-memory/
*
* @default true
* @deprecated The method will be removed on a major update, instead, use enableWatchdogTerminationTracking for the same result.
* */
* Enables Out of Memory Tracking for iOS and macCatalyst.
* See the following link for more information and possible restrictions:
* https://docs.sentry.io/platforms/apple/guides/ios/configuration/out-of-memory/
*
* @default true
* @deprecated The method will be removed on a major update, instead, use enableWatchdogTerminationTracking for the same result.
* */
enableOutOfMemoryTracking?: boolean;

/**
* When enabled, the SDK tracks when the application stops responding for a specific amount of
* time defined by the `appHangTimeoutInterval` option.
*
* iOS only
*
* @default true
*/
enableAppHangTracking?: boolean;
/**
* When enabled, the SDK tracks when the application stops responding for a specific amount of
* time defined by the `appHangTimeoutInterval` option.
*
* iOS only
*
* @default true
*/
enableAppHangTracking?: boolean;

/**
* The minimum amount of time an app should be unresponsive to be classified as an App Hanging.
* The actual amount may be a little longer.
* Avoid using values lower than 100ms, which may cause a lot of app hangs events being transmitted.
* Value should be in seconds.
*
* iOS only
*
* @default 2
*/
appHangTimeoutInterval?: number;
/**
* The minimum amount of time an app should be unresponsive to be classified as an App Hanging.
* The actual amount may be a little longer.
* Avoid using values lower than 100ms, which may cause a lot of app hangs events being transmitted.
* Value should be in seconds.
*
* iOS only
*
* @default 2
*/
appHangTimeoutInterval?: number;
}
4 changes: 2 additions & 2 deletions src/js/scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class CordovaScope extends Scope {
*/
public setTags(tags: { [key: string]: string }): this {
// As native only has setTag, we just loop through each tag key.
Object.keys(tags).forEach(key => {
Object.keys(tags).forEach((key) => {
NATIVE.setTag(key, tags[key]);
});
return super.setTags(tags);
Expand All @@ -38,7 +38,7 @@ export class CordovaScope extends Scope {
* @inheritDoc
*/
public setExtras(extras: { [key: string]: any }): this {
Object.keys(extras).forEach(key => {
Object.keys(extras).forEach((key) => {
NATIVE.setExtra(key, extras[key]);
});
return super.setExtras(extras);
Expand Down
Loading
Loading