8000 v3 refactor by dgreene-r7 · Pull Request #217 · rapid7/awsaml · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

v3 refactor #217

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

Merged
merged 19 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
9df1f55
Updated a number of core packages. Fixed linting issues. Centralized …
dgreene-r7 Mar 6, 2023
ccac9d0
Rewrote all class-based components as functional ones with hooks. Rem…
dgreene-r7 Mar 6, 2023
17b960c
Bumped deps. Fixed a few breaking changes. Removed mkdirp in favor of…
dgreene-r7 Mar 7, 2023
9dd2d10
Added support for IPC communication between rendered process and elec…
dgreene-r7 Mar 19, 2023
f16b91e
Reworked some components. Added support for dark mode.
dgreene-r7 Mar 19, 2023
4632ab9
App improvements. Now content loads from disk and the only web traffi…
dgreene-r7 Mar 19, 2023
1f40db0
Copying from UI now uses electron's native clipboard management rathe…
dgreene-r7 Mar 23, 2023
6e282e8
Migrate away from electron-packager directly in favor of electron-forge.
dgreene-r7 Mar 23, 2023
6793bff
Restructured directories. Improved build pipeline. Updated readme. Ad…
dgreene-r7 Mar 24, 2023
f4a62c8
Updated GH Actions.
dgreene-r7 Mar 29, 2023
fbd581d
Updated menu.
dgreene-r7 Apr 7, 2023
0a2e6f6
Add app updating functionality.
dgreene-r7 Apr 7, 2023
a4756b9
Bumped deps
dgreene-r7 May 25, 2023
addd621
Bumped deps and added interactive-tools plugin.
dgreene-r7 Jun 29, 2023
e1891ad
Prefix nodejs imports with node namespace.
dgreene-r7 Jun 29, 2023
d0dd36b
Some index cleanup.
dgreene-r7 Jun 29, 2023
91d19ac
Bumped deps and added github publisher for electron-forge.
dgreene-r7 Jul 17, 2023
7e3ae4d
Added forge publish bits.
dgreene-r7 Jul 17, 2023
c4fad3c
Tweaked about window.
dgreene-r7 Jul 17, 2023 8000
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
14 changes: 0 additions & 14 deletions .eslintrc

This file was deleted.

71 changes: 71 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
module.exports = {
env: {
node: true,
},
settings: {
react: {
version: 'detect',
},
'import/core-modules': [
'electron',
'electron-packager',
'electron-devtools-installer',
],
},
extends: [
'airbnb',
],
globals: {
require: true,
process: true,
__dirname: true,
console: true,
Storage: true,
},
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 2020,
requireConfigFile: false,
babelOptions: {
presets: ['@babel/preset-react'],
},
},
rules: {
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
'import/no-extraneous-dependencies': ['error', {
devDependencies: true,
}],
'global-require': 0,
},
overrides: [
{
files: 'api/**/*.js',
extends: ['plugin:node/recommended'],
},
{
files: 'test/**/*.js',
env: {
'jest/globals': true,
},
plugins: ['jest'],
parserOptions: {
sourceType: 'module',
},
rules: {
'func-names': 0,
'prefer-arrow-callback': 0,
'max-nested-callbacks': 0,
'space-before-function-paren': 0,
},
},
{
files: 'src/**/*.js',
env: {
browser: true,
},
plugins: [
'react-hooks',
],
},
],
};
31 changes: 16 additions & 15 deletions .github/workflows/node.js.yml
CEB7
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI
name: Lint and Test

on: [push]
jobs:
build:

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

node-version: [16.x, 18.x]
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci || npm install --ignore-engines --ignore-optional
- run: npm run build --if-present
- run: npm test
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: Lint
run: yarn lint
- name: Unit Tests
run: yarn test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# production
/build
/out
/dist

# misc
Expand All @@ -30,3 +31,4 @@ yarn-error.log*
!.yarn/releases
!.yarn/sdks
!.yarn/versions
test-results.xml
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

541 changes: 541 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-outdated.cjs

Large diffs are not rendered by default.

550 changes: 550 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-version.cjs

Large diffs are not rendered by default.

516 changes: 258 additions & 258 deletions .yarn/releases/yarn-3.4.1.cjs → .yarn/releases/yarn-3.5.0.cjs

Large diffs are not rendered by default.

18 changes: 17 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.4.1.cjs
packageExtensions:
eslint-plugin-flowtype@*:
peerDependenciesMeta:
"@babel/plugin-syntax-flow":
optional: true
"@babel/plugin-transform-react-jsx":
optional: true

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-outdated.cjs
spec: "https://mskelton.dev/yarn-outdated/v3"
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.5.0.cjs
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2015-2018 Frank Mitchell, Rapid7 LLC.
Copyright (c) 2015-2023 Opal Mitchell, Rapid7 LLC.

MIT License
===========
Expand Down
60 changes: 43 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Awsaml

[![Build Status](https://api.travis-ci.org/rapid7/awsaml.svg?branch=master)](https://travis-ci.org/rapid7/awsaml) [![Coverage Status](https://coveralls.io/repos/github/rapid7/awsaml/badge.svg?branch=master)](https://coveralls.io/github/rapid7/awsaml?branch=master)

Awsaml is an application for providing automatically rotated temporary [AWS][]
Expand All @@ -18,10 +19,9 @@ while the application's running. Awsaml reuses the SAML response from the
identity provider, so the user doesn't need to reauthenticate every time.

You can grab prebuilt binaries for Mac, Linux, and Window from [the releases page][releases].
Awsaml is current pre-release software. Back up your `~/.aws/credentials` file
before using it, please.

## Configuration

Configuring Awsaml is a multi-step process that involves a bit of back and forth
between Amazon and your identity provider. The general flow looks like this

Expand All @@ -32,6 +32,7 @@ between Amazon and your identity provider. The general flow looks like this
5. Run Awsaml and give it your application's metadata.

### 1. Create a SAML application in your identity provider

The only tested identity provider is [Okta][]. To use Awsaml with Okta, you'll
need to create a SAML 2.0 application in Okta with the following settings

Expand Down Expand Up @@ -75,6 +76,7 @@ You should do two things with this url:
supply that file when you create an identity provider in AWS.

#### A note on naming things (if you are using Okta)

In the next two steps, you will create and name an identity provider and a role.
Be sure to choose short names (fewer than 28 characters between the two).

Expand Down Expand Up @@ -103,6 +105,7 @@ The `IDENTITY_PROVIDER_ARN` will be in this format:
```
arn:aws:iam::{ACCOUNT_ID}:saml-provider/{PROVIDER_NAME}
```

Where the `ACCOUNT_ID` is 12 digits long, and the `PROVIDER_NAME` is as long as
you want it to be.

Expand All @@ -117,6 +120,7 @@ As a consequence, between the name you give to the identity provider and the nam
you give to the role, you can only use up to 28 characters.

### 2. Create a SAML identity provider in AWS

Follow [Amazon's documentation for creating a SAML identity provider][saml-provider],
in which you will need to upload the metadata document you downloaded in the
previous step.
Expand All @@ -125,6 +129,7 @@ Save the ARN for your identity provider so you can configure it in your
application.

### 3. Create an IAM role in AWS

Follow [Amazon's documentation for creating an IAM role][iam-role] with the
following modifications:

Expand All @@ -145,7 +150,7 @@ between your role and the SAML identity provider you created. If not, you will
need to set up a trust relationship between it and your SAML identity provider
manually. Here's an example of the JSON policy document for that relationship.

~~~json
```json
{
"Version": "2012-10-17",
"Statement": [{
Expand All @@ -162,7 +167,7 @@ manually. Here's an example of the JSON policy document for that relationship.
}
}]
}
~~~
```

Replace the "issuer" value for the "SAML:iss" key in the policy document with
the issuer URL for your application. Replace the "arn:aws:iam:saml-provider"
Expand All @@ -172,6 +177,7 @@ SAML identity provider.
Save the ARN for the role so you can configure it in your application.

### 4. Update the SAML application with ARNs

Now that you have ARNs for the AWS identity provider and role, you can go back
into Okta and add them to your application. Edit your application to include the
following attributes.
Expand All @@ -189,6 +195,7 @@ provider in AWS your created.


##### Multiple Role Support

To support multiple roles, add multiple values to the `https://aws.amazon.com/SAML/Attributes/Role`
attribute. For example:

Expand All @@ -205,46 +212,61 @@ To support multiple roles, you must contact Okta support and request that the
see [this post](https://devforum.okta.com/t/multivalued-attributes/179).


### 5. Run Awsaml and give it your application's metadata.
### 5. Run Awsaml and give it your application's metadata

You can find a prebuilt binary for Awsaml on [the releases page][releases]. Grab
the appropriate binary for your architecture and run the Awsaml application. It
will prompt you for a SAML metadata URL. Enter the URL you saved in step 1. If
the URL's valid, it will prompt you to log in to your identity provider. If the
login's successful, you'll see temporary AWS credentials in the UI.

## Building
Awsaml is built using [Node][] and [Yarn][], so
make sure you've got a compatible versions installed. Then run Yarn to install
dependencies and build Awsaml.

~~~bash
Awsaml is built using [Node][] and [Yarn 3][], so
make sure you've got a compatible versions installed. Then run Yarn to install dependencies and build Awsaml.

```bash
rm -rf node_modules/
yarn install
yarn build
~~~
```

Those commands will create a "dist" folder with zipped binaries. If you only want
to create binaries for specific platforms, you can set a `PLATFORM` environment
Those commands will create a "out" folder with zipped binaries. If you only want to create binaries for specific platforms, you can set a `PLATFORM` environment
variable before building.

~~~bash
```bash
export PLATFORM=linux
yarn build
~~~
```

Allowed values for `PLATFORM` are `darwin`, `linux` and `win32`. You can build
binaries for multiple platforms by using a comma separated list.

~~~bash
```bash
export PLATFORM=darwin,linux
yarn build
~~~
```

Similarly, if you want to
specify the build architecture, you can set a `ARCH`
environment variable before building.

```bash
export ARCH=universal
export PLATFORM=darwin
yarn build
```

Supported architectures are `ia32`, `x64` , `armv7l`,
`arm64`, `mips64el`, `universal`, or `all`.

## Setup on macOS with Homebrew

A caskfile is bundled with the repository, to install Awsaml with [Homebrew][] simply run:

`wget https://raw.githubusercontent.com/rapid7/awsaml/master/brew/cask/awsaml.rb`
`brew install --cask awsaml.rb`

There might be an error and warning prompt but it should start succesfully downloading right after
When download is succesfully installed, a `awsaml was successfully installed!` prompt is displayed

Expand All @@ -253,13 +275,17 @@ When download is succesfully installed, a `awsaml was successfully installed!` p
Awsaml is licensed under a MIT License. See the "LICENSE.md" file for more
details.

## Special Thanks

* [Tristan Harward] for the app icon.

[AWS]: https://aws.amazon.com
[AssumeRoleWithSAML]: http://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithSAML.html
[releases]: https://github.com/rapid7/awsaml/releases
[Okta]: https://www.okta.com
[Node]: https://nodejs.org
[Yarn]: https://yarnpkg.com
[Yarn 3]: https://yarnpkg.com
[saml-provider]: http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml.html
[iam-role]: http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_saml.html
[Homebrew]: http://brew.sh/
[Tristan Harward]: https://github.com/trisweb
3 changes: 0 additions & 3 deletions api/.eslintrc

This file was deleted.

Loading
0