Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

fix: Whitelist cli args #553

Merged
merged 6 commits into from
Sep 3, 2019
Merged

fix: Whitelist cli args #553

merged 6 commits into from
Sep 3, 2019

Conversation

amaury1093
Copy link
Collaborator

@amaury1093 amaury1093 commented Sep 2, 2019

fix #550

Only two flags possible:

  • --chain
  • --no-run-parity: kept this one, iirc was requested a couple of times in parity ui, and harmless

Any other flags will exit Fether with error code != 0.

!arg.startsWith('--ws-interface')
)
);
.parse(process.argv);
Copy link
Contributor

Choose a reason for hiding this comment

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

My hunch is that Electron or MacOs would be pass down flags to Electron, which are unexpected on our side and would make the program exit with error code != 0 (because we don't allow unknown arguments anymore). I think I would keep the filtering of process.argv ?

parse(
    process.argv
      // We want to ignore some flags and not pass them down to Parity:
      // --inspect: `electron-webpack dev` runs Electron with the `--inspect` flag for HMR
      // -psn_*: https://github.com/paritytech/fether/issues/188
      // --ws-interface: we don't pass down this flag, because fether only allows 127.0.0.1 as WS interface
      .filter(
        arg =>
          !arg.startsWith('--inspect') &&
          !arg.startsWith('-psn_') &&
          !arg.startsWith('--ws-interface')
      )

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It seems that --inspect is not passed by electron-webpack anymore, so we can remove that one. --ws-interface has been removed.

You're probably right, i'll keep arg => !arg.startsWith('-psn_') just to be sure

Copy link
Collaborator

@Tbaut Tbaut left a comment

Choose a reason for hiding this comment

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

tested with yarn electron --chain kovan successfully.

@amaury1093 amaury1093 merged commit 33934af into master Sep 3, 2019
@amaury1093 amaury1093 deleted the am-flags branch September 3, 2019 10:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use whitelist for CLI arguments instead of blacklist
3 participants