Skip to content

Commit

Permalink
fix(docs): add slack to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidabbm committed Nov 21, 2023
1 parent 9c10ed4 commit 883c3a4
Showing 1 changed file with 79 additions and 3 deletions.
82 changes: 79 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

CLI that scans repositories and generates the necessary IAM Policies for the service to run.

If you need any help getting started or have any questions, please join our [Slack Community](https://join.slack.com/t/slauthiocommunity/shared_invite/zt-268nxuwyd-Vav8lYJdiP44Kt8lQSSybg)

## Installation

```bash
Expand All @@ -13,14 +15,88 @@ npm install -g @slauth.io/slauth
1. Set the `OPENAI_API_KEY` environment variable: `export OPENAI_API_KEY=<key>`
2. Run `slauth --help` to see available commands

### Example scan command
### Examples

#### Scan command

The scan command will look for any `aws-sdk` calls in your git repository and generate the necessary policies for it.

```bash
slauth scan -p aws ../path/to/my/repository
```

> Note: By default the `scan` command will print the generated policies to `stdout`. Use `-o,--output-file` option to specify a file to output to.
**Result:**

> Note: By default the `scan` command will print the generated policies to `stdout`. Use `--output-file` option to specify a file to output to.
The result of the scan command is an array of AWS IAM Policy Documents.
If the resource is not explicit in the code (e.g. comes from a variable), we use a placholder for it.
Before deploying the policies, you will have to **manually** change these placeholders with the correct resources the service will try to interact with.

```bash
slauth scan -p aws ./path/to/my/repository
Detected Policies:

[
{
"Version": "2012-10-17",
"Id": "S3Policy",
"Statement": [
{
"Sid": "S3Permissions",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetBucketAcl"
],
"Resource": [
"<S3_BUCKET_PLACEHOLDER>",
"<S3_BUCKET_1_PLACEHOLDER>",
"arn:aws:s3:::my_bucket_2/*"
]
}
]
},
{
"Version": "2012-10-17",
"Id": "DynamoDBPolicy",
"Statement": [
{
"Sid": "DynamoDBPermissions",
"Effect": "Allow",
"Action": [
"dynamodb:PutItem"
],
"Resource": [
"<DYNAMODB_TABLE_PLACEHOLDER>"
]
}
]
},
{
"Version": "2012-10-17",
"Id": "SQSPolicy",
"Statement": [
{
"Sid": "SQSPermissions",
"Effect": "Allow",
"Action": [
"sqs:SendMessage"
],
"Resource": [
"<SQS_QUEUE_URL_PLACEHOLDER>"
]
}
]
}
]
```

##### Available options

- `-p, --cloud-provider <cloudProvider>` select the cloud provider you would like to generate policies for (choices: "aws")
- `-m, --openai-model <openaiModel>` select the openai model to use (choices: "gpt-3.5-turbo-16k", "gpt-4-32k")
- `-o, --output-file <outputFile>` write generated policies to a file instead of stdout

### Selecting which OpenAI Model to use

By default `slauth` will use `gpt-4-32k` as it provides the best results. You can still choose to use other models to scan you repo, specially if cost is a concern:
Expand Down

0 comments on commit 883c3a4

Please sign in to comment.