[NETCONF-1210] RESTCONF OPTIONS on /data does not produce Accept-Patch Created: 06/Dec/23  Updated: 06/Dec/23

Status: Confirmed
Project: netconf
Component/s: restconf-nb
Affects Version/s: 4.0.9, 6.0.5, 5.0.9
Fix Version/s: 7.0.0

Type: Bug Priority: Medium
Reporter: Robert Varga Assignee: Robert Varga
Resolution: Unresolved Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to NETCONF-773 Refactor restconf-nb wiring Confirmed

 Description   

Our default implementation of OPTIONS defers to JAX-RS runtime to generate the response to OPTIONS on all endpoints.

This leads to two outcomes:

  1. we do not attach Accept-Patch header, as required by RESTCONF PATCH
  2. we serve a WADL which leaks our implementation details
* processing: http://localhost:8181/rests/data
*   Trying [::1]:8181...
* Connected to localhost (::1) port 8181
* Server auth using Basic with user 'admin'
> OPTIONS /rests/data HTTP/1.1
> Host: localhost:8181
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/8.2.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Set-Cookie: JSESSIONID=node01fob7f15na96q1fx8i99uqh8cb14.node0; Path=/rests; HttpOnly
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Set-Cookie: rememberMe=deleteMe; Path=/rests; Max-Age=0; Expires=Tue, 05-Dec-2023 11:05:56 GMT; SameSite=lax
< Content-Type: application/vnd.sun.wadl+xml
< Allow: HEAD,POST,GET,OPTIONS,PATCH,PUT
< Last-Modified: Wed, 06 Dec 2023 12:05:56 CET
< Content-Length: 3853
< 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<application xmlns="http://wadl.dev.java.net/2009/02">
    <doc xmlns:jersey="http://jersey.java.net/" jersey:generatedBy="Jersey: 2.41 2023-10-20 08:17:02"/>
    <grammars/>
    <resources base="http://localhost:8181/rests/">
        <resource path="data">
            <method id="dataXmlPATCH" name="PATCH">
                <request>
                    <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="javax.ws.rs.container.Suspended" type="xs:string"/>
                    <representation mediaType="application/yang-data+xml"/>
                    <representation mediaType="application/xml"/>
                    <representation mediaType="text/xml"/>
                </request>
            </method>
            <method id="dataJsonPATCH" name="PATCH">
                <request>
                    <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="javax.ws.rs.container.Suspended" type="xs:string"/>
                    <representation mediaType="application/yang-data+json"/>
                    <representation mediaType="application/json"/>
                </request>
            </method>
            <method id="dataYangJsonPATCH" name="PATCH">
                <request>
                    <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="javax.ws.rs.container.Suspended" type="xs:string"/>
                    <representation mediaType="application/yang-patch+json"/>
                </request>
            </method>
            <method id="dataYangXmlPATCH" name="PATCH">
                <request>
                    <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="javax.ws.rs.container.Suspended" type="xs:string"/>
                    <representation mediaType="application/yang-patch+xml"/>
                </request>
            </method>
            <method id="postDataJSON" name="POST">
                <request>
                    <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="javax.ws.rs.container.Suspended" type="xs:string"/>
                    <representation mediaType="application/yang-data+json"/>
                    <representation mediaType="application/json"/>
                </request>
            </method>
            <method id="postDataXML" name="POST">
                <request>
                    <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="javax.ws.rs.container.Suspended" type="xs:string"/>
                    <representation mediaType="application/yang-data+xml"/>
                    <representation mediaType="application/xml"/>
                    <representation mediaType="text/xml"/>
                </request>
            </method>
            <method id="dataJsonPUT" name="PUT">
                <request>
                    <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="javax.ws.rs.container.Suspended" type="xs:string"/>
                    <representation mediaType="application/yang-data+json"/>
                    <representation mediaType="application/json"/>
                </request>
            </method>
            <method id="dataXmlPUT" name="PUT">
                <request>
                    <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="javax.ws.rs.container.Suspended" type="xs:string"/>
                    <representation mediaType="application/yang-data+xml"/>
                    <representation mediaType="application/xml"/>
                    <representation mediaType="text/xml"/>
                </request>
            </method>
            <method id="dataGET" name="GET">
                <request>
                    <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="javax.ws.rs.container.Suspended" type="xs:string"/>
                </request>
            </method>
        </resource>
    </resources>
</application>

Provide @OPTIONS overrides for our top-level responses, so that we provide the required header and do not leak the WADL.


Generated at Wed Feb 07 20:16:56 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.