World is now on Opti ID! Learn more

Graph CMS index jobs - ignoring restricted content

Vote:
 

Hi,

 

This may be by design, or I am simply unable to find any information on the topic. But I have a test site that is restricted to authenticated users (as test sites normally are), and when this is enabled, the Graph synchronization will not index any conten at all. If I remove the restriction (Add Everyone read to the root page), then content appear in graph (After indexing it).

Is there a way to change or disable this? Or any other tips on testing graph in a non-public environment?

 

CMS version 12.32.5
Optimizely.ContentGraph.Cms 3.16.6

#338349
May 19, 2025 9:28
Vote:
 

Rather than the Access Rights could you restrict the website using IP Allow List instead ? 

If you are just interested in seeing the data within Graphiql you can query using the APP Key and Secret rather than the Single Key. 

#338368
May 19, 2025 15:36
Vote:
 

No, we cant use IP restrictions, it need to be behind login.

Im not sure what you mean by the second sentence, I\m using the CMS integration and all three keys are already configured in the cms appsettings.json file. 

#338369
May 19, 2025 15:55
Vote:
 

Hey Erik,

You're right to notice this behavior — and yes, it's by design

Optimizely Graph (Content Graph) only indexes content that is accessible to "Everyone" or the authenticated search user (depending on config).

 

What you can do 

Use IGraphContentAccessEvaluator to Customize Access Evaluation

public class AllowAllContentAccessEvaluator : IGraphContentAccessEvaluator
{
    public bool HasAccess(IContent content) => true;
}

And register it:

services.AddSingleton<IGraphContentAccessEvaluator, AllowAllContentAccessEvaluator>();

NOTE:-

  • This makes all content indexable, regardless of the Access Control List (ACL) ✅
  • Ideal for dev/test environments where content is behind a login ✅
  • Should never be used in production ❌
#339419
Jun 16, 2025 16:49
Erik Täck - Jun 16, 2025 16:51
Thanks, I will try this!
Vote:
 

Hey Erik,
I've been working recently on accessing restricted content through Graph and didn't have to add any IGraphContentAccessEvaluator.
I still need to test this properly across the whole site but performed tests against the page restricted like below:



Yes, it will not be returned when accessing Graph with Public access/single key (this way is used in the CMS Graph query explorer UI) but it is when querying Graph with Admin and Restricted access.
https://docs.developers.optimizely.com/platform-optimizely/docs/authentication
This would also mean that restricted content is indexed by default.

Essentially, what I did was to access the Graph with basic/hmac auth using app key and secret and adding cg-roles header with "Role1,Role2,Role3" assigned to the current user. 

I have no idea how you are accessing the graph from your FE side, but if you are using the Opti clients https://github.com/remkoj/optimizely-dxp-clients there is a method exposed to the client that switches to restricted access and sets the roles header.

 client.setFrontendUser({
        username: "user1",
        roles: "Role1,Role2,Role3"
    })
#339458
Jun 18, 2025 7:19
Vote:
 

Damian:

So Its possible the content is indexed, but not available through the Graph admin module? Interesting, is there some documentation on this?

I'll investigate if this is the case, but at the same time it makes the admin tool completely useless for testing queries in a test enviroment. I wonder why the admin tool wouldnt atleast use the access roles of the current user?

#339459
Jun 18, 2025 9:30
Vote:
 

I agree it would make sense for the admin tool actually to query content as an admin. 
If you take a look at the Network tab, you can see it sends a request with epi-single authorization header, which made me think it queries only public content:

#339461
Jun 18, 2025 9:47
Vote:
 

I need to test this when I get time, thanks for the tip!

#339462
Jun 18, 2025 10:00
Vote:
 

I thought for a second that maybe there is a configuration option to enable admin access, but I noticed this tool is actually an IFrame pointing to https://cg.optimizely.com/app/graphiql?auth=%7Bsinglekey%7D.
Admin access would require passing the app key and secret there, which doesn't seem like a good and secure approach. 

https://docs.developers.optimizely.com/platform-optimizely/docs/getting-started#access-the-interactive-graphiql-page

#339463
Jun 18, 2025 10:03
Erik Täck - Jun 18, 2025 10:12
I disagree, admin access would require Optimizely implementing proper authentication for an admin tool instead of this cop out.
- Jun 18, 2025 10:30
Yes, that definitely needs improvement! What I was trying to say is that following the current pattern for public content would require passing secrets, which isn’t secure. That’s why we don’t have admin access now - at least based on my experience.
There may be other ways to handle this, though. I’d be happy to hear your thoughts once you’ve finished your investigation!
Erik Täck - Jun 18, 2025 10:38
Well as far as I know, this works perfectly fine in Find (though its content browser in the admin mode is not as advanced as this query tool) and apparently there are no security concerns there.

Note: This is an admin tool added to the CMS, I am talking about that specifically, not accessing graph content using just an URL and a get request.
- Jun 18, 2025 10:56
I don't have a chance to look at any Find dashboard now, so can't check how it looks there, whether the request to index with credentials is going through client or backend. In this graph tool all the keys are in the HTML and going through browser, so it seems a bit iffy to me, security-wise. I am not a big security expert though so I can be mistaken here
Erik Täck - Jun 18, 2025 11:06
My point was not how it works technically. My point is that this should have already been included from the start, and not require us using browser devtools to figure out why we cant access certain content of our index using a product built-in admin tool. The tool should already have had this from day one this and it is baffling to me that it doesn't.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.