forked from raystack/frontier
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de00939
commit b1f6044
Showing
4 changed files
with
87 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ type EndToEndProxySmokeTestSuite struct { | |
orgID string | ||
orgSlug string | ||
projID string | ||
projSlug string | ||
groupID string | ||
client shieldv1beta1.ShieldServiceClient | ||
cancelClient func() | ||
|
@@ -57,6 +58,7 @@ func (s *EndToEndProxySmokeTestSuite) SetupTest() { | |
s.Require().NoError(err) | ||
s.Require().Equal(1, len(pRes.GetProjects())) | ||
s.projID = pRes.GetProjects()[0].GetId() | ||
s.projSlug = pRes.GetProjects()[0].GetSlug() | ||
|
||
gRes, err := s.client.ListGroups(ctx, &shieldv1beta1.ListGroupsRequest{}) | ||
s.Require().NoError(err) | ||
|
@@ -161,10 +163,11 @@ func (s *EndToEndProxySmokeTestSuite) TestProxyToEchoServer() { | |
s.Assert().Equal(401, res.StatusCode) | ||
}) | ||
|
||
s.Run("permission expression: user not having permission at org level will not be authenticated by middleware auth", func() { | ||
s.Run("permission expression: user not having permission at proj level will not be authenticated by middleware auth", func() { | ||
url := fmt.Sprintf("http://localhost:%d/api/create_firehose_based_on_sink", s.appConfig.Proxy.Services[0].Port) | ||
reqBodyMap := map[string]any{ | ||
"organization": s.orgID, | ||
"project": s.projID, | ||
"configs": map[string]any{ | ||
"env_vars": map[string]any{ | ||
"SINK_TYPE": "bigquery", | ||
|
@@ -186,10 +189,63 @@ func (s *EndToEndProxySmokeTestSuite) TestProxyToEchoServer() { | |
s.Assert().Equal(401, res.StatusCode) | ||
}) | ||
|
||
s.Run("permission expression: user not having permission at org level will not be authenticated by middleware auth", func() { | ||
url := fmt.Sprintf("http://localhost:%d/api/create_firehose_based_on_sink", s.appConfig.Proxy.Services[0].Port) | ||
reqBodyMap := map[string]any{ | ||
"organization": s.orgID, | ||
"project": s.projID, | ||
"configs": map[string]any{ | ||
"env_vars": map[string]any{ | ||
"SINK_TYPE": "blob", | ||
}, | ||
}, | ||
} | ||
reqBodyBytes, err := json.Marshal(reqBodyMap) | ||
s.Require().NoError(err) | ||
|
||
req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(reqBodyBytes)) | ||
s.Require().NoError(err) | ||
|
||
req.Header.Set(testbench.IdentityHeader, "[email protected]") | ||
|
||
res, err := http.DefaultClient.Do(req) | ||
s.Require().NoError(err) | ||
|
||
defer res.Body.Close() | ||
s.Assert().Equal(401, res.StatusCode) | ||
}) | ||
|
||
s.Run("permission expression: user not having permission at org level will not be authenticated by middleware auth with org passed as slug", func() { | ||
url := fmt.Sprintf("http://localhost:%d/api/create_firehose_based_on_sink", s.appConfig.Proxy.Services[0].Port) | ||
reqBodyMap := map[string]any{ | ||
"organization": s.orgSlug, | ||
"project": s.projSlug, | ||
"configs": map[string]any{ | ||
"env_vars": map[string]any{ | ||
"SINK_TYPE": "blob", | ||
}, | ||
}, | ||
} | ||
reqBodyBytes, err := json.Marshal(reqBodyMap) | ||
s.Require().NoError(err) | ||
|
||
req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(reqBodyBytes)) | ||
s.Require().NoError(err) | ||
|
||
req.Header.Set(testbench.IdentityHeader, "[email protected]") | ||
|
||
res, err := http.DefaultClient.Do(req) | ||
s.Require().NoError(err) | ||
|
||
defer res.Body.Close() | ||
s.Assert().Equal(401, res.StatusCode) | ||
}) | ||
|
||
s.Run("permission expression: user not having permission at proj level will not be authenticated by middleware auth with proj passed as slug", func() { | ||
url := fmt.Sprintf("http://localhost:%d/api/create_firehose_based_on_sink", s.appConfig.Proxy.Services[0].Port) | ||
reqBodyMap := map[string]any{ | ||
"organization": s.orgSlug, | ||
"project": s.projSlug, | ||
"configs": map[string]any{ | ||
"env_vars": map[string]any{ | ||
"SINK_TYPE": "bigquery", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters