[英]Is it safe to use the WSO2 API Manager 1.8.0 Publisher “undocumented” API to import API definitions via Swagger json?
在我的自動構建/部署環境中,我想使用WSO2 API Publisher Add API調用(請參閱https://docs.wso2.com/display/AM180/Publisher+APIs )
http://<host>:<port>/publisher/site/blocks/item-add/ajax/add.jag
通過提供我的Swagger json API定義文件來添加/更新API,該文件是從帶有Swagger 1.2批注的Java Spring @RestController類生成的。
似乎當前不支持此功能(請參閱待處理的功能請求https://wso2.org/jira/browse/APIMANAGER-3255-引入Publisher API以使用文件或URL導入大頭釘定義)。
但是,有一個未記錄的API確實支持我已經成功測試過的API:
https://host:port/publisher/site/blocks/item-design/ajax/add.jag? ... &swagger={<API SWAGGER DEFINITION GOES HERE>}
使用此API是否安全? 請詳細說明答案/說明/背景/未來計划。
“安全”的定義為:使用未記錄的API是一種好的做法嗎? 如果是,為什么沒有記錄? 如果不是,為什么不這樣做,使用它會有什么風險,會有哪些副作用,將來對WSO2的升級是否有可能破壞此API的用戶? 為什么該API提供的功能比記錄的功能更多?
例:
https://localhost:9443/publisher/site/blocks/item-design/ajax/add.jag?
name=FOOAPI&
version=1.0.0&
provider=admin&
context=/home&
action=design&
visibility=public&
swagger=
{
"apiVersion":"1.0.0",
"swaggerVersion":"1.2",
"apis":[
{
"file":
{
"apiVersion":"1.0.0",
"basePath":"http://localhost:8280/home/1.0.0",
"resourcePath":"/rest",
"swaggerVersion":"1.2",
"apis":[
{
"path":"/rest/v2/clients",
"operations":[
{
"method":"GET",
"nickname":"getCustomers",
"responseClass":"api_clients",
"parameters":[
{
"name":"firstResult",
"paramType":"query",
"description":"desc",
"dataType":"int",
"allowMultiple":false
},
{
"name":"resultsPerPage",
"paramType":"query",
"description":"desc",
"dataType":"int",
"allowMultiple":false
}
],
"summary":"The clients REST service end point returns a set of clients",
"notes":"The clients REST service end point returns a set of clients",
"errorResponses":[
{
"code":200,
"reason":"Clients found"
},
{
"code":400,
"reason":"Invalid input, returns message body of Errors"
},
{
"code":500,
"reason":"A database error has occurred"
}
],
"produces":[
"application/xml",
"application/json"
],
"consumes":[
"*/*",
"application/xml"
]
}
]
},
"description":"",
"path":"/rest"
}
]
}
問題的答案因“安全”的定義而異。 我的信息是,在即將發布的1.9版中,我們記錄的API穩定,而且計划中的2.0版肯定會對其進行更改。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.