Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Solved
  • Unsolved
  • Users
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Darkly)
  • No Skin
Collapse
brainCloud Forums
  1. Home
  2. General
  3. How should Cloud Code read a Global Property flagged Secret?

How should Cloud Code read a Global Property flagged Secret?

Scheduled Pinned Locked Moved Unsolved General
1 Posts 1 Posters 7 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gyutaelee
    wrote last edited by
    #1

    A Global Property (String, Category internal, Secret: checked) holds a bearer token that two scheduled Cloud Code scripts need in order to call our own backend. Cloud Code cannot read it.

    The script does:

    var res = bridge.getGlobalAppServiceProxy().readSelectedProperties(["MY_SECRET_PROPERTY"]);
    if (!res || res.status !== 200 || !res.data || !res.data["MY_SECRET_PROPERTY"]) {
        bridge.logError("failed to read MY_SECRET_PROPERTY");
    }
    

    Running it from the portal returns:

    {
      "response": {
        "logList": [
          { "level": "error", "message": "failed to read MY_SECRET_PROPERTY" },
          { "level": "error", "message": "skipped POST: bearer token unavailable" }
        ],
        "callStats": { "globalApp": { "READ_SELECTED_PROPERTIES": 1 } },
        "callCounts": { "total": 4, "api": 2 },
        "status": 200
      },
      "duration": 17
    }
    

    So the call is made and succeeds — READ_SELECTED_PROPERTIES: 1, status 200, no exception — but the requested key is absent from data. It is silently filtered rather than reported.

    A non-secret property in the same app is read successfully by the same proxy on every run. The Secret flag is the only difference between the two. Support confirmed this behavior is expected, and I see no Sys-prefixed read method for properties in the docs — only SysCreateProperty* / SysUpdateProperty*.

    The suggested workaround was to keep the secret in our server environment and read it from there, but Cloud Code runs on brainCloud's infrastructure — a .ccjs script has no access to our environment variables or secrets manager. Global Properties appears to be the only config store Cloud Code can read, so flagging one Secret makes it unreachable by the layer that needs it.

    Questions

    1. Is there any supported way to read a Secret Global Property from Cloud Code?
    2. If not: what is the recommended pattern for a secret that Cloud Code itself consumes, rather than one our backend consumes? Unchecking Secret would expose the token to any authenticated client via GlobalApp.ReadProperties(), which we can't accept in production.

    Thank you.

    1 Reply Last reply
    0

    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

    With your input, this post could be even better 💗

    Register Login
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Solved
    • Unsolved
    • Users