Feature request for Encrypted Messaging restriction on endpoints

Hi,

It would be nice to have an annotation which could be used to restrict an endpoint, so that it only allows calls that are encrypted with the Encrypted Messaging feature. I know it is possible to add a custom RequestFilterAttribute, however I am not sure what would be the best thing to check for.

Please submit any feature requests on UserVoice so they can be recorded and measured as feature requests in forums are easily lost.

Note you can use RequestAttributes.Secure to ensure Requests are made over a secure channel, e.g. via https or Encrypted Messaging:

[Restrict(RequestAttributes.Secure)]
class MyRequest { ... }

Thanks for the quick response @mythz,

I applied [RequestAttributes.Secure] to the endpoint, and tried to call it over http with encrypted messaging (not https).

The endpoint throws an UnauthrizedAccessException:

“Could not execute service ‘Hello’, The following restrictions were not met: ‘\n -[LocalSubnet, External, HttpHead, HttpGet, HttpPut, HttpDelete, HttpPatch, HttpOptions, HttpOther, OneWay, Soap11, Soap12, Xml, Jsv, ProtoBuf, Csv, Html, Wire, MsgPack, FormatOther, MessageQueue, Tcp, EndpointOther, InProcess]’\n Unauthorized call was made from: Localhost, AnySecurityMode, HttpPost, Reply, Json, Http”

Regards

Are you using the latest ServiceStack v5.4?

Yes, I am using ServiceStack v.5.4 on the client and server

Server:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="ServiceStack" version="5.4.0" targetFramework="net45" />
  <package id="ServiceStack.Client" version="5.4.0" targetFramework="net45" />
  <package id="ServiceStack.Common" version="5.4.0" targetFramework="net45" />
  <package id="ServiceStack.Interfaces" version="5.4.0" targetFramework="net45" />
  <package id="ServiceStack.OrmLite" version="5.4.0" targetFramework="net45" />
  <package id="ServiceStack.Redis" version="5.4.0" targetFramework="net45" />
  <package id="ServiceStack.Server" version="5.4.0" targetFramework="net45" />
  <package id="ServiceStack.Text" version="5.4.0" targetFramework="net45" />
  <package id="System.Buffers" version="4.4.0" targetFramework="net45" />
  <package id="System.Memory" version="4.5.1" targetFramework="net45" />
  <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.0" targetFramework="net45" />
  <package id="System.ValueTuple" version="4.5.0" targetFramework="net45" />
</packages>

Client:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="ServiceStack.Client" version="5.4.0" targetFramework="net461" />
  <package id="ServiceStack.Interfaces" version="5.4.0" targetFramework="net461" />
  <package id="ServiceStack.Text" version="5.4.0" targetFramework="net461" />
  <package id="System.Buffers" version="4.4.0" targetFramework="net461" />
  <package id="System.Memory" version="4.5.1" targetFramework="net461" />
  <package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net461" />
  <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.0" targetFramework="net461" />
</packages>

This should now be resolved from this commit, this change is available from v5.4.1 that’s now available on MyGet.

If it’s still not working for you, please post a small standalone repro on GitHub and link to it here.

Please also use the forums for all posts/comments (i.e. don’t reply to system generated emails).