Skip to content

Commit

Permalink
Check whether the application belongs to project (#202)
Browse files Browse the repository at this point in the history
**What this PR does / why we need it**:

**Which issue(s) this PR fixes**:

Fixes #

**Does this PR introduce a user-facing change?**:
<!--
If no, just write "NONE" in the release-note block below.
-->
```release-note
NONE
```

This PR was merged by Kapetanios.
  • Loading branch information
stormcat24 committed Jun 25, 2020
1 parent 88ac059 commit 41e735b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/app/api/api/web_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,14 @@ func (a *WebAPI) SyncApplication(ctx context.Context, req *webservice.SyncApplic
return nil, err
}

claims, err := rpcauth.ExtractClaims(ctx)
if err != nil {
return nil, err
}
if app.ProjectId != claims.Role.ProjectId {
return nil, status.Error(codes.PermissionDenied, "The current project does not have requested application")
}

cmd := model.Command{
Id: uuid.New().String(),
PipedId: app.PipedId,
Expand Down

0 comments on commit 41e735b

Please sign in to comment.