veracitylab / provenance-injector

inject provenance into JEE applications
Apache License 2.0
0 stars 0 forks source link

An associated entity can appear twice #29

Open wtwhite opened 1 month ago

wtwhite commented 1 month ago

Finally with 73953e7a124bc6cb3d2792dcefa2187a86b9a2c2 we are seeing the URL passed to HttpGet's constructor get pulled down in the provenance data as associated entity data, although for some reason it appears twice with different IDs:

wtwhite@wtwhite-vuw-vm:~$ curl -i http://localhost:8080/prov/26
--snip--
    {
        "activities": [
            {
                "id": "7f6af131-d727-4573-aa02-1f3e77250bc1",
                "type": "MakeHttpRequestApacheNew",
                "endTime": "2024-05-29T09:40:48.178480Z"
            }
        ],
        "associatedEntities": [
            {
                "id": 589882250,
                "type": "HttpRequestApacheGet",
                "value": "https://app.veracity.homes/omar-notifications-main-menu.html?name=jens&movieId=35&stars=4",
                "target": {
                    "headers": [],
                    "method": "GET",
                    "path": "/omar-notifications-main-menu.html?name=jens&movieId=35&stars=4",
                    "scheme": "https",
                    "authority": {
                        "userInfo": null,
                        "port": -1,
                        "hostName": "app.veracity.homes"
                    },
                    "version": null,
                    "requestUri": "/omar-notifications-main-menu.html?name=jens&movieId=35&stars=4",
                    "entity": null,
                    "cancelled": false,
                    "config": null,
                    "aborted": false,
                    "uri": "https://app.veracity.homes/omar-notifications-main-menu.html?name=jens&movieId=35&stars=4"
                }
            },
            {
                "id": 1082006511,
                "type": "HttpRequestApacheGet",
                "value": "https://app.veracity.homes/omar-notifications-main-menu.html?name=jens&movieId=35&stars=4",
                "target": {
                    "headers": [],
                    "method": "GET",
                    "path": "/omar-notifications-main-menu.html?name=jens&movieId=35&stars=4",
                    "scheme": "https",
                    "authority": {
                        "userInfo": null,
                        "port": -1,
                        "hostName": "app.veracity.homes"
                    },
                    "version": null,
                    "requestUri": "/omar-notifications-main-menu.html?name=jens&movieId=35&stars=4",
                    "entity": null,
                    "cancelled": false,
                    "config": null,
                    "aborted": false,
                    "uri": "https://app.veracity.homes/omar-notifications-main-menu.html?name=jens&movieId=35&stars=4"
                }
            }
        ]
    },
--snip--

Originally posted by @wtwhite in https://github.com/veracitylab/provenance-injector/issues/28#issuecomment-2137009078

wtwhite commented 1 month ago

Also see the following 2 comments in #28 for an explanation of why the entity appears twice.

One possible way to resolve this might be to set the id of the Entity to be the hash of just the target object, rather than on the parameter used to construct it -- this would resolve the issue in this specific case. But I'm not sure of the implications in general.