You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "Attila Magyar (Jira)" <ji...@apache.org> on 2021/07/20 12:46:00 UTC

[jira] [Updated] (KNOX-2638) Shiro propererties are missing after topology deployment

     [ https://issues.apache.org/jira/browse/KNOX-2638?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Attila Magyar updated KNOX-2638:
--------------------------------
    Description: 
STR:

1. Have an existing topology (test.xml), see if blockSemicolon/blockBackslash/blockNonAscii are in the get topology output:
curl -u admin:admin-password  -k -X GET 
[https://localhost:8443/gateway/admin/api/v1/topologies/test]
 | grep  blockSemicolon
<name>main.invalidRequest.blockSemicolon</name>
2. Deploy a new topology file (test2.xml)
{code:java}
cp ./conf/topologies/test.xml ./conf/topologies/test2.xml {code}
3. blockSemicolon/blockBackslash/blockNonAscii are no longer in the orignial test.xml output:
{code:java}
curl -u admin:admin-password  -k -X GET https://localhost:8443/gateway/admin/api/v1/topologies/test | grep  blockSemicolon {code}
This also causes some flakiness in tests like GatewayAdminTopologyFuncTest.

 

The reason why these shiro properties are missing is because we only add these after a topology deployment to the in memory representation of a topology. When we deploy a new topology we also reload all the existing topologies but only redeploy the newly added one.

 
{code:java}
@Override
public void reloadTopologies() {
  try {
    synchronized (this) {
      Map<File, Topology> oldTopologies = topologies;
      Map<File, Topology> newTopologies = loadTopologies(topologiesDirectory); // <= parse everything from disk
      List<TopologyEvent> events = createChangeEvents(oldTopologies, newTopologies);
      topologies = newTopologies;
      notifyChangeListeners(events); // <= this will redeploy the new topology and add the shiro properties, but those will be missing from all other existing topologies
    }
  } catch (Exception e) {
    // Maybe it makes sense to throw exception
    log.failedToReloadTopologies(e);
  }
} {code}
 

 

> Shiro propererties are missing after topology deployment
> --------------------------------------------------------
>
>                 Key: KNOX-2638
>                 URL: https://issues.apache.org/jira/browse/KNOX-2638
>             Project: Apache Knox
>          Issue Type: Bug
>            Reporter: Attila Magyar
>            Assignee: Attila Magyar
>            Priority: Major
>
> STR:
> 1. Have an existing topology (test.xml), see if blockSemicolon/blockBackslash/blockNonAscii are in the get topology output:
> curl -u admin:admin-password  -k -X GET 
> [https://localhost:8443/gateway/admin/api/v1/topologies/test]
>  | grep  blockSemicolon
> <name>main.invalidRequest.blockSemicolon</name>
> 2. Deploy a new topology file (test2.xml)
> {code:java}
> cp ./conf/topologies/test.xml ./conf/topologies/test2.xml {code}
> 3. blockSemicolon/blockBackslash/blockNonAscii are no longer in the orignial test.xml output:
> {code:java}
> curl -u admin:admin-password  -k -X GET https://localhost:8443/gateway/admin/api/v1/topologies/test | grep  blockSemicolon {code}
> This also causes some flakiness in tests like GatewayAdminTopologyFuncTest.
>  
> The reason why these shiro properties are missing is because we only add these after a topology deployment to the in memory representation of a topology. When we deploy a new topology we also reload all the existing topologies but only redeploy the newly added one.
>  
> {code:java}
> @Override
> public void reloadTopologies() {
>   try {
>     synchronized (this) {
>       Map<File, Topology> oldTopologies = topologies;
>       Map<File, Topology> newTopologies = loadTopologies(topologiesDirectory); // <= parse everything from disk
>       List<TopologyEvent> events = createChangeEvents(oldTopologies, newTopologies);
>       topologies = newTopologies;
>       notifyChangeListeners(events); // <= this will redeploy the new topology and add the shiro properties, but those will be missing from all other existing topologies
>     }
>   } catch (Exception e) {
>     // Maybe it makes sense to throw exception
>     log.failedToReloadTopologies(e);
>   }
> } {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)