Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Share Docs' $ref does not work #1646

Open
daida00 opened this issue Aug 30, 2021 · 12 comments
Open

'Share Docs' $ref does not work #1646

daida00 opened this issue Aug 30, 2021 · 12 comments
Labels

Comments

@daida00
Copy link

daida00 commented Aug 30, 2021

Hello.
I am using apicurio studio.

If data types defined in other APIs are imported and used, an error occurs when calling 'Share docs'.
image

image

But, It works well when using 'Preview Docs..'.

@daida00 daida00 changed the title 'Share Docs...' $ref does not work 'Share Docs' $ref does not work Aug 30, 2021
@EricWittmann
Copy link
Member

Thank you for the report. I think this might be a duplicate of #1417

@EricWittmann
Copy link
Member

But I'll leave this open until I'm sure.

@daida00
Copy link
Author

daida00 commented Sep 1, 2021

Thank you for your confirmation.
If the function works, it seems to be useful.

@jsenko
Copy link
Member

jsenko commented Sep 23, 2021

hi, @daida00 version 0.2.49.Final is running on https://studio.apicur.io/ . Can you please check if the issue has been resolved?

@DyspC
Copy link

DyspC commented Oct 14, 2021

I think this is not resolved yet in 0.2.50 and am willing to fix it but from what I've seen so far there is no way to resolve apicurio: references from within the WS module because the InternalReferenceResolver asserts the user in the security context has read access to the design.

image

Perhaps dereferencing classes should be reorganized to move the ContentDereferencer and AbsoluteReferenceResolver to hub-core. That way we should be able to add a ReferenceResolver in the WS that uses the user who created the sharing link to resolve references using his ACLs.
It would only need a bit of DB tinkering to store the user somewhere but I think linking what the share servlet can resolve to who shared the resource makes sense.

@EricWittmann
Copy link
Member

Could we assume that sharing a document using the Share Docs feature also implicitly implies that any $refs in the doc are also available? In other words, create a reference resolver that doesn't need a user. Does the storage layer require the user? I can't recall. :(

@EricWittmann
Copy link
Member

Although perhaps that's a bad idea because it opens an attack vector whereby someone could manually add an apicurio: reference in their source and then do a ShareDocs on their api design. Thereby getting access to content they cannot see.

So nevermind. :)

I'm not sure I see another option other than storing the username of the user who shared the document and then fabricating a principal as you suggest.

@EricWittmann
Copy link
Member

TLDR: So +1 from me on your proposal above, @DyspC

@DyspC
Copy link

DyspC commented Oct 20, 2021

I was thinking about the attack vector too, using who created the link does not fully close the hole because users with write access can extract specifications only the other can see but it makes it really less exploitable than just skipping all controls.

A more complete option would be to check if a quorum of the collaborators has access but it makes everything complicated and users will have trouble understanding why adding collaborators to a document breaks its documentation

FYI @EricWittmann I'll wait a bit before I add columns to a table since version 12 of the ddls is on its way (template publication)

We will also have an issue with existing documentation links whose creator will be undefined, how should we handle this?

@EricWittmann
Copy link
Member

Good question - perhaps the DB upgrade script can populate the new column using the creator of the API design.

@daida00
Copy link
Author

daida00 commented Oct 25, 2021

@jsenko
Thanks for checking.
I checked with version 0.2.50.Final, and the same error occurs.

@adrixgc
Copy link

adrixgc commented Apr 18, 2023

I had the same error and managed to make it work by sharing first the referenced api. After that, sharing was possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants