Skip to content

Commit

Permalink
Add claim string & crystal payload validation (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
adelinag08 authored Jan 28, 2025
1 parent 89ef14d commit d6198df
Show file tree
Hide file tree
Showing 22 changed files with 785 additions and 78 deletions.
58 changes: 46 additions & 12 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,59 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: '1.21'

- name: Check Format
run: gofmt -d ./

- name: Verify dependencies
run: go mod verify

- name: Install dependencies
run: |
cd cmd/snd-cli; go get ./
- name: Run go vet
run: go vet ./...

- name: Build
run: go build -v ./...

- name: Lint
run: |
set -euxo pipefail
LINT_VERSION=1.54.1
curl -fsSL /~https://github.com/golangci/golangci-lint/releases/download/v${LINT_VERSION}/golangci-lint-${LINT_VERSION}-linux-amd64.tar.gz | \
tar xz --strip-components 1 --wildcards \*/golangci-lint
mkdir -p bin && mv golangci-lint bin/
bin/golangci-lint run --out-format=github-actions --timeout=3m
gofmt -d ./
- name: Test with the Go CLI
run: go test -race -vet=off ./...
uses: golangci/golangci-lint-action@v6
with:
version: v1.60

- name: Test
run: go test ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...

- name: Visualise Coverage
if: ${{ github.ref != 'refs/heads/main' && always() }}
run: go tool cover -html=cover.out -o=cover.html

- name: Upload Coverage
if: ${{ github.ref != 'refs/heads/main' && always() }}
uses: actions/upload-artifact@v4
with:
name: coverage
path: cover.html
retention-days: 1
id: cover

- name: Post Coverage
if: ${{ github.ref != 'refs/heads/main' && always() }}
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.number }}
body: |
New [coverage report](${{ steps.cover.outputs.artifact-url }}) available :sparkles:
- name: Check Coverage
uses: vladopajic/go-test-coverage@v2
with:
config: ./.testcoverage.yml

## badge is created and committed only for main branch
git-token: ${{ github.ref_name == 'main' && secrets.GITHUB_TOKEN || '' }}
## name of branch where badges are stored
## ideally this should be orphan branch (see below how to create this branch)
git-branch: badges
18 changes: 18 additions & 0 deletions .testcoverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
profile: cover.out

local-prefix: "github.com/SneaksAndData/snd-cli-go"

threshold:
# file: 70
# package: 70
# total: 75

exclude:
paths:
- \.pb\.go$ # excludes all protobuf generated files
- ^pkg/generated # exclude generated code
- ^pkg/signals # exclude signal handlers from sample controller
- hack/*.go # exclude hack folder
- main.go # exclude main file
- pkg/cmd/root/root.go # exclude root file
- pkg/cmd/version/version.go # exclude version file
31 changes: 31 additions & 0 deletions docs/snd_completion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## snd completion

Generate the autocompletion script for the specified shell

### Synopsis

Generate the autocompletion script for snd for the specified shell.
See each sub-command's help for details on how to use the generated script.


### Options

```
-h, --help help for completion
```

### Options inherited from parent commands

```
--gen-docs Generate Markdown documentation for all commands
```

### SEE ALSO

* [snd](snd.md) - SnD CLI
* [snd completion bash](snd_completion_bash.md) - Generate the autocompletion script for bash
* [snd completion fish](snd_completion_fish.md) - Generate the autocompletion script for fish
* [snd completion powershell](snd_completion_powershell.md) - Generate the autocompletion script for powershell
* [snd completion zsh](snd_completion_zsh.md) - Generate the autocompletion script for zsh

###### Auto generated by spf13/cobra on 4-Nov-2024
50 changes: 50 additions & 0 deletions docs/snd_completion_bash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
## snd completion bash

Generate the autocompletion script for bash

### Synopsis

Generate the autocompletion script for the bash shell.

This script depends on the 'bash-completion' package.
If it is not installed already, you can install it via your OS's package manager.

To load completions in your current shell session:

source <(snd completion bash)

To load completions for every new session, execute once:

#### Linux:

snd completion bash > /etc/bash_completion.d/snd

#### macOS:

snd completion bash > $(brew --prefix)/etc/bash_completion.d/snd

You will need to start a new shell for this setup to take effect.


```
snd completion bash
```

### Options

```
-h, --help help for bash
--no-descriptions disable completion descriptions
```

### Options inherited from parent commands

```
--gen-docs Generate Markdown documentation for all commands
```

### SEE ALSO

* [snd completion](snd_completion.md) - Generate the autocompletion script for the specified shell

###### Auto generated by spf13/cobra on 4-Nov-2024
41 changes: 41 additions & 0 deletions docs/snd_completion_fish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## snd completion fish

Generate the autocompletion script for fish

### Synopsis

Generate the autocompletion script for the fish shell.

To load completions in your current shell session:

snd completion fish | source

To load completions for every new session, execute once:

snd completion fish > ~/.config/fish/completions/snd.fish

You will need to start a new shell for this setup to take effect.


```
snd completion fish [flags]
```

### Options

```
-h, --help help for fish
--no-descriptions disable completion descriptions
```

### Options inherited from parent commands

```
--gen-docs Generate Markdown documentation for all commands
```

### SEE ALSO

* [snd completion](snd_completion.md) - Generate the autocompletion script for the specified shell

###### Auto generated by spf13/cobra on 4-Nov-2024
38 changes: 38 additions & 0 deletions docs/snd_completion_powershell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## snd completion powershell

Generate the autocompletion script for powershell

### Synopsis

Generate the autocompletion script for powershell.

To load completions in your current shell session:

snd completion powershell | Out-String | Invoke-Expression

To load completions for every new session, add the output of the above command
to your powershell profile.


```
snd completion powershell [flags]
```

### Options

```
-h, --help help for powershell
--no-descriptions disable completion descriptions
```

### Options inherited from parent commands

```
--gen-docs Generate Markdown documentation for all commands
```

### SEE ALSO

* [snd completion](snd_completion.md) - Generate the autocompletion script for the specified shell

###### Auto generated by spf13/cobra on 4-Nov-2024
52 changes: 52 additions & 0 deletions docs/snd_completion_zsh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## snd completion zsh

Generate the autocompletion script for zsh

### Synopsis

Generate the autocompletion script for the zsh shell.

If shell completion is not already enabled in your environment you will need
to enable it. You can execute the following once:

echo "autoload -U compinit; compinit" >> ~/.zshrc

To load completions in your current shell session:

source <(snd completion zsh)

To load completions for every new session, execute once:

#### Linux:

snd completion zsh > "${fpath[1]}/_snd"

#### macOS:

snd completion zsh > $(brew --prefix)/share/zsh/site-functions/_snd

You will need to start a new shell for this setup to take effect.


```
snd completion zsh [flags]
```

### Options

```
-h, --help help for zsh
--no-descriptions disable completion descriptions
```

### Options inherited from parent commands

```
--gen-docs Generate Markdown documentation for all commands
```

### SEE ALSO

* [snd completion](snd_completion.md) - Generate the autocompletion script for the specified shell

###### Auto generated by spf13/cobra on 4-Nov-2024
30 changes: 30 additions & 0 deletions docs/snd_dsr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## snd dsr

Manage DSR requests

### Synopsis

Manage DSR requests

### Options

```
-a, --auth-provider string Specify the OAuth provider name (default "azuread")
--custom-auth-url string Specify the auth service uri
--custom-service-url string Specify the service url (default "https://dsr-manager.%s.sneaksanddata.com")
-e, --env string Target environment (default "awsp")
-h, --help help for dsr
```

### Options inherited from parent commands

```
--gen-docs Generate Markdown documentation for all commands
```

### SEE ALSO

* [snd](snd.md) - SnD CLI
* [snd dsr get](snd_dsr_get.md) - Retrieves occurrences of the specified email

###### Auto generated by spf13/cobra on 4-Nov-2024
36 changes: 36 additions & 0 deletions docs/snd_dsr_get.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## snd dsr get

Retrieves occurrences of the specified email

```
snd dsr get [flags]
```

### Examples

```
snd dsr get --email user@ecco.com
```

### Options

```
--email string Specify the email
-h, --help help for get
```

### Options inherited from parent commands

```
-a, --auth-provider string Specify the OAuth provider name (default "azuread")
--custom-auth-url string Specify the auth service uri
--custom-service-url string Specify the service url (default "https://dsr-manager.%s.sneaksanddata.com")
-e, --env string Target environment (default "awsp")
--gen-docs Generate Markdown documentation for all commands
```

### SEE ALSO

* [snd dsr](snd_dsr.md) - Manage DSR requests

###### Auto generated by spf13/cobra on 4-Nov-2024
Loading

0 comments on commit d6198df

Please sign in to comment.