Page MenuHomePhabricator

Incorrect node sharing in router
Closed, ResolvedPublic

Description

When we share nodes in router, we clone a node, creating a complete new one with shared _children property, so value property is not shared, which is correct in general. But when sharing happens on a 'module' level, it happens before the node is loaded, so the cloned node doesn't get 'resources' field assigned correctly. Here's an example of the spec:

var parsoidSpec = {
    'x-modules': [
        {
            name: 'parsoid',
            version: '1.0.0',
            type: 'file',
            options: {
                parsoidHost: 'http://parsoid-lb.eqiad.wikimedia.org'
            }
        }
    ]
};

var sameModuleAtDifferentPathsSpec = {
    paths: {
        '/{domain:en.wikipedia.org}/v1': {
            'x-subspecs': [
                {
                    paths: {
                        '/parsoid': parsoidSpec
                    }
                }
            ]
        },
        '/{domain:secure.wikipedia.org}/v1': {
            'x-subspecs': [
                {
                    paths: {
                        '/parsoid': parsoidSpec
                    }
                }
            ],
            'additions_property': 'test'
        }
    }
};

Here sharing would happen on the module level, so in result structure node at 'secure.wikipedia.org/v1/parsoid' would not have any resources, so buckets for this domain wouldn't be created.

Second, when we share trees, child nodes have shared 'node.value.path' param, so in our current config node at '/DE.wikipedia.org/v1/sys' would have 'value.path === EN.wikipedia.org/v1/sys', which is obviously incorrect.

Event Timeline

Pchelolo claimed this task.
Pchelolo raised the priority of this task from to Medium.
Pchelolo updated the task description. (Show Details)
Pchelolo added a project: RESTBase.

This issue was fixed as a part of T88016, so ticket can be closed

Pchelolo set Security to None.