Hi,
We’ve run into a permission issue when updating our module to 8.3
Out SNMP module has a setting for uploading and listing additional configuration files like so:
While listing files works without a hitch, when uploading a file, we receive a 403 response from the gateway. There is nothing in the gateway log. It seems that the problem stems from the:
requirePermission(PermissionType.WRITE)
If we try to change this permission, the route mounting fails Ignition’s internal validation as unsafe, and the routes don’t mount at all.
Are we missing something in our route setup or mounting?
PermissionType.WRITE implicitly declares that the incoming request must be authorized with the gateway write permission (set in your gateway security settings), by either a logged in user session, a valid API key, or a security zone based permission.
If you don't want to use those or want to provide your own access control, use RouteMounter.accessControl instead. If you want to make a totally public route, pass AccessControlStrategy.OPEN_ROUTE in the accessControl builder method.
Ah, okay, Perspective works differently (because it's not part of platform).
So if you're in a module that depends on Perspective you should have com.inductiveautomation.perspective.gateway.comm.Routes on your classpath - that class has a utility method you can use: requireSession method you can use - just pass in the "session scopes" (runtime session or designer) allowed.
Heh. I thought so. I figured out I would need a csrf token by watching the headers in the network tab of a session while editing the IA native modbus driver's address map. Now I know where to find it for my own use...
I couldn't convince myself I actually needed to fetch from that route, since the session store already in the browser shows that it already knows the CSRF token. The one-liner I show replaces your fetching and caching operations.
I would suggest confirming that the csrf token in react-redux session is the same as one in /data/app/session. If there are 2 different tokens, there could be 3 different tokens.