-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #442 from DinoChiesa/pd002-fix
fix: correct PD002 so that it handles sharedflows correctly
- Loading branch information
Showing
24 changed files
with
409 additions
and
16 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
test/fixtures/resources/PD002-no-unconditional-routerule/proxy2/apiproxy/no-route-rules.xml
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<APIProxy revision="1" name="no-route-rules"> | ||
<ConfigurationVersion minorVersion="0" majorVersion="4"/> | ||
<DisplayName>no-route-rules</DisplayName> | ||
</APIProxy> |
21 changes: 21 additions & 0 deletions
21
...conditional-routerule/proxy2/apiproxy/policies/AM-Clean-Request-Headers-From-Response.xml
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<AssignMessage name='AM-Clean-Request-Headers-From-Response'> | ||
<Remove> | ||
<Headers> | ||
<Header name='Host'/> | ||
<Header name='Accept'/> | ||
<Header name='Authorization'/> | ||
<Header name='Origin'/> | ||
<Header name='user-agent'/> | ||
<Header name='X-Request-id'/> | ||
<Header name='x-client-data'/> | ||
<Header name='x-cloud-trace-context'/> | ||
<Header name='X-Powered-By'/> | ||
<Header name='X-b3-traceid'/> | ||
<Header name='X-b3-spanid'/> | ||
<Header name='X-b3-sampled'/> | ||
<Header name='X-Forwarded-For'/> | ||
<Header name='X-Forwarded-Port'/> | ||
<Header name='X-Forwarded-Proto'/> | ||
</Headers> | ||
</Remove> | ||
</AssignMessage> |
7 changes: 7 additions & 0 deletions
7
...2-no-unconditional-routerule/proxy2/apiproxy/policies/AM-Inject-Proxy-Revision-Header.xml
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<AssignMessage name='AM-Inject-Proxy-Revision-Header'> | ||
<Set> | ||
<Headers> | ||
<Header name='APIProxy'>{apiproxy.name} r{apiproxy.revision}</Header> | ||
</Headers> | ||
</Set> | ||
</AssignMessage> |
12 changes: 12 additions & 0 deletions
12
...tures/resources/PD002-no-unconditional-routerule/proxy2/apiproxy/policies/AM-Response.xml
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<AssignMessage name='AM-Response'> | ||
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> | ||
<Set> | ||
<Payload contentType='application/json'>{ | ||
"status" : "ok" | ||
} | ||
</Payload> | ||
<ReasonPhrase>OK</ReasonPhrase> | ||
<StatusCode>200</StatusCode> | ||
</Set> | ||
<AssignTo>response</AssignTo> | ||
</AssignMessage> |
16 changes: 16 additions & 0 deletions
16
...esources/PD002-no-unconditional-routerule/proxy2/apiproxy/policies/RF-Unknown-Request.xml
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<RaiseFault name='RF-Unknown-Request'> | ||
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> | ||
<FaultResponse> | ||
<Set> | ||
<Payload contentType='application/json'>{ | ||
"error" : { | ||
"code" : 404.01, | ||
"message" : "that request was unknown; try a different request." | ||
} | ||
} | ||
</Payload> | ||
<StatusCode>404</StatusCode> | ||
<ReasonPhrase>Not Found</ReasonPhrase> | ||
</Set> | ||
</FaultResponse> | ||
</RaiseFault> |
76 changes: 76 additions & 0 deletions
76
...fixtures/resources/PD002-no-unconditional-routerule/proxy2/apiproxy/proxies/endpoint1.xml
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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<ProxyEndpoint name="endpoint1"> | ||
<Description>Proxy Endpoint 1</Description> | ||
<HTTPProxyConnection> | ||
<BasePath>/no-route-rules</BasePath> | ||
</HTTPProxyConnection> | ||
|
||
<FaultRules/> | ||
<DefaultFaultRule name="default-fault-rule"> | ||
<Step> | ||
<Name>AM-Inject-Proxy-Revision-Header</Name> | ||
</Step> | ||
<AlwaysEnforce>true</AlwaysEnforce> | ||
</DefaultFaultRule> | ||
|
||
<PreFlow name="PreFlow"> | ||
<Request> | ||
</Request> | ||
<Response> | ||
<Step> | ||
<Name>AM-Clean-Request-Headers-From-Response</Name> | ||
</Step> | ||
</Response> | ||
</PreFlow> | ||
|
||
<PostFlow name="PostFlow"> | ||
<Request> | ||
</Request> | ||
<Response> | ||
<Step> | ||
<Name>AM-Inject-Proxy-Revision-Header</Name> | ||
</Step> | ||
</Response> | ||
</PostFlow> | ||
|
||
<PostClientFlow name="PostClientFlow"> | ||
<Request> | ||
</Request> | ||
<Response> | ||
</Response> | ||
</PostClientFlow> | ||
|
||
<Flows> | ||
|
||
<Flow name="flow1"> | ||
<Request> | ||
</Request> | ||
<Response> | ||
<Step> | ||
<Name>AM-Response</Name> | ||
</Step> | ||
</Response> | ||
<Condition>(proxy.pathsuffix MatchesPath "/t1") and (request.verb = "GET")</Condition> | ||
</Flow> | ||
|
||
<Flow name="unknown request"> | ||
<Request> | ||
<Step> | ||
<Name>RF-Unknown-Request</Name> | ||
</Step> | ||
</Request> | ||
<Response> | ||
</Response> | ||
</Flow> | ||
|
||
</Flows> | ||
|
||
<!-- There is no RouteRule. | ||
<RouteRule name="BrokenRouteRule"> | ||
<TargetEndpoint>target-1</TargetEndpoint> | ||
<Condition>proxy.pathsuffix = "/foobar"</Condition> | ||
</RouteRule> | ||
--> | ||
|
||
</ProxyEndpoint> |
22 changes: 22 additions & 0 deletions
22
.../fixtures/resources/PD002-no-unconditional-routerule/proxy2/apiproxy/targets/target-1.xml
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<TargetEndpoint name="target-1"> | ||
<Description/> | ||
<FaultRules/> | ||
<PreFlow name="PreFlow"> | ||
<Request/> | ||
<Response/> | ||
</PreFlow> | ||
<PostFlow name="PostFlow"> | ||
<Request/> | ||
<Response/> | ||
</PostFlow> | ||
<Flows/> | ||
<HTTPTargetConnection> | ||
<SSLInfo> | ||
<Enabled>true</Enabled> | ||
<Enforce>true</Enforce> | ||
<IgnoreValidationErrors>false</IgnoreValidationErrors> | ||
</SSLInfo> | ||
<Properties/> | ||
<URL>https://echo.dchiesa.demo.altostrat.com</URL> | ||
</HTTPTargetConnection> | ||
</TargetEndpoint> |
20 changes: 20 additions & 0 deletions
20
...2-no-unconditional-routerule/sharedflow1/sharedflowbundle/authorize-idp-access-tokens.xml
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright 2023 Google LLC | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<SharedFlowBundle name="sample-hello-cicd-sf"> | ||
<Description>Authorize IdP Access Tokens Shared Flow</Description> | ||
</SharedFlowBundle> |
9 changes: 9 additions & 0 deletions
9
...2-no-unconditional-routerule/sharedflow1/sharedflowbundle/policies/JWT-VerifyIdPToken.xml
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<VerifyJWT async="false" continueOnError="false" enabled="true" name="JWT-VerifyIdPToken"> | ||
<DisplayName>JWT-VerifyIdPToken</DisplayName> | ||
<Algorithm>RS256</Algorithm> | ||
<PublicKey> | ||
<JWKS uriRef="propertyset.idp_configuration.jwks_uri"/> | ||
</PublicKey> | ||
<Issuer ref="propertyset.idp_configuration.issuer"/> | ||
<Audience ref="propertyset.idp_configuration.audience"/> | ||
</VerifyJWT> |
4 changes: 4 additions & 0 deletions
4
...no-unconditional-routerule/sharedflow1/sharedflowbundle/policies/VA-IdentifyClientApp.xml
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<VerifyAPIKey async="false" continueOnError="false" enabled="true" name="VA-IdentifyClientApp"> | ||
<DisplayName>VA-IdentifyClientApp</DisplayName> | ||
<APIKey ref="jwt.JWT-VerifyIdPToken.claim.REPLACEWITHIDPCLIENTIDCLAIM"/> | ||
</VerifyAPIKey> |
8 changes: 8 additions & 0 deletions
8
...ces/PD002-no-unconditional-routerule/sharedflow1/sharedflowbundle/sharedflows/default.xml
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<SharedFlow name="default"> | ||
<Step> | ||
<Name>JWT-VerifyIdPToken</Name> | ||
</Step> | ||
<Step> | ||
<Name>VA-IdentifyClientApp</Name> | ||
</Step> | ||
</SharedFlow> |
20 changes: 20 additions & 0 deletions
20
...2-no-unconditional-routerule/sharedflow2/sharedflowbundle/authorize-idp-access-tokens.xml
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright 2023 Google LLC | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<SharedFlowBundle name="sample-hello-cicd-sf"> | ||
<Description>Authorize IdP Access Tokens Shared Flow</Description> | ||
</SharedFlowBundle> |
9 changes: 9 additions & 0 deletions
9
...2-no-unconditional-routerule/sharedflow2/sharedflowbundle/policies/JWT-VerifyIdPToken.xml
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<VerifyJWT async="false" continueOnError="false" enabled="true" name="JWT-VerifyIdPToken"> | ||
<DisplayName>JWT-VerifyIdPToken</DisplayName> | ||
<Algorithm>RS256</Algorithm> | ||
<PublicKey> | ||
<JWKS uriRef="propertyset.idp_configuration.jwks_uri"/> | ||
</PublicKey> | ||
<Issuer ref="propertyset.idp_configuration.issuer"/> | ||
<Audience ref="propertyset.idp_configuration.audience"/> | ||
</VerifyJWT> |
4 changes: 4 additions & 0 deletions
4
...no-unconditional-routerule/sharedflow2/sharedflowbundle/policies/VA-IdentifyClientApp.xml
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<VerifyAPIKey async="false" continueOnError="false" enabled="true" name="VA-IdentifyClientApp"> | ||
<DisplayName>VA-IdentifyClientApp</DisplayName> | ||
<APIKey ref="jwt.JWT-VerifyIdPToken.claim.REPLACEWITHIDPCLIENTIDCLAIM"/> | ||
</VerifyAPIKey> |
15 changes: 15 additions & 0 deletions
15
...ces/PD002-no-unconditional-routerule/sharedflow2/sharedflowbundle/sharedflows/default.xml
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<SharedFlow name="default"> | ||
<Step> | ||
<Name>JWT-VerifyIdPToken</Name> | ||
</Step> | ||
<Step> | ||
<Name>VA-IdentifyClientApp</Name> | ||
</Step> | ||
|
||
<!-- this does not belong here --> | ||
<RouteRule name="BrokenRouteRule"> | ||
<TargetEndpoint>target-1</TargetEndpoint> | ||
<Condition>proxy.pathsuffix = "/foobar"</Condition> | ||
</RouteRule> | ||
|
||
</SharedFlow> |
Oops, something went wrong.