Authorization

Authorization is managed at three levels:

  • spaces: who can access a space, and with which mode
  • agencies: which agencies a user can use inside a space
  • datasets: optional per-dataset restrictions.

It uses users, groups and API keys. A request is allowed only when every applicable layer allows it.

Space-Based Authorization

A space is configured with these properties:

PropertyMeaning
readpublic, member, agency
writepublic, member, agency
acl{ read: [...], write: [...] }
agencies{ [agencyID]: { read: [...], write: [...] } }
externalBoolean

read and write are independent. A space can be publicly readable and member-writable at the same time.

Space modes

ModeSpace accessAgency checks
publicAnyone.Skipped
memberThe user must belong to the member and have the space permission (sxs:spaces:read or sxs:spaces:write). An active ACL can replace the permission check.Yes, default allow
agencySame space-level behavior as member.Yes, default deny
unsetDeniedSkipped

The space permissions come from roles:

RolePermissions
sxs:spaces:viewersxs:spaces:read
sxs:spaces:editorsxs:spaces:read, sxs:spaces:write, sxs:spaces:create, sxs:spaces:delete

public is applied per action:

  • a public read ignores the ACL and the agency layer for read
  • a public write ignores the ACL and the agency layer for write
  • the other action still follows its own mode.

External spaces

An external space has external: true.

  • Read follows the normal space rules.
  • Write is always denied, including for administrators. Because write is never evaluated, an acl.write entry cannot grant read on an external space.
  • Dataset ACLs still apply to reads.

Administrators

An administrator is a user with the admin role:

  • an admin with no members list is a super admin
  • an admin with a members list is an admin only of those members.

Administrators bypass space checks, agency checks and dataset ACLs for the members they administer. They can always read an external space, but cannot write it. An admin of another member does not get this bypass.

ACL Space-Based Authorization

An ACL restricts an action to a list of users, groups or API keys. ACL is active when space.acl contains at least one of read or write as an array.

{
  "id": "space1",
  "read": "member",
  "write": "member",
  "acl": {
    "read": [{ "email": "u1@x.fr" }, { "group": "g1" }, { "apiKey": "1234" }],
    "write": [{ "email": "u2@x.fr" }]
  }
}

In this example:

  • u1, all users in group g1, and API key 1234 can read
  • u2 can write and read.

ACL rules:

  • entries are ORed: at least one entry must match
  • { "email": "..." } matches a user email
  • { "group": "..." } matches an entry { "id": "..." } in groups
  • { "apiKey": "..." } matches an apiKey
  • the user must belong to the space's member. ACLs never grant membership
  • An active ACL replaces only the space-role requirement: a matching entry grants the action even if the user does not have space viewer or editor role. It does not replace membership: non-admin users must still belong to the space's member
  • when write is ACL-controlled (the write mode is not public), a matching acl.write entry grants both write and read
  • a missing read or write side is an empty list, so it grants nothing directly. write entry can still grant read
  • a public space action ignores the ACL for that action: space.read = 'public' ignores acl.read
  • administrators of the member bypass the ACL for internal spaces

An ACL only replaces the space-level check. If the access mode is member or agency, the agency layer is still evaluated afterwards.

Agency-Based Authorization

The agency layer defines which agencies a user can access inside a space. It is evaluated only when access modes are member or agency.

For public mode, agency checks are skipped.

The two modes offer opposite behaviors:

  • member: all agencies are allowed
  • agency: all agencies are denied.

User-level agency rights

User's agency rights are stored in each member entry:

{
  "members": [
    {
      "id": "orox",
      "agencies": {
        "AG1": "W",
        "AG2": "R",
        "AG3": "",
      }
    }
  ]
}
ValueMeaning
RRead only
WRead and write
``No Read and No write

An agency with no user-level agency entry follows the space-level agency, or the access mode.

User-level agency rights are hierarchical:

  • AG1 applies to AG1.SUB, AG1.SUB.DETAIL, etc.
  • the nearest entry wins
  • a child entry overrides a parent entry, including ""
  • a child entry does not define its parent.

Space-level agency rights

{
  "agencies": {
    "AG1": {
      "read": [{ "email": "u1@x.fr" }, { "group": "readers" }],
      "write": [{ "group": "ag1-editors" }]
    },
    "AG2": {
      "write": []
    }
  }
}

Behavior:

  • read and write are independent
  • an array is a list of conditions, combined with OR
  • there is no AND between conditions
  • [] is an explicit deny
  • an entry with no read or write array, such as {}, is ignored
  • a space-level agency right for an action completely overrides the user-level agency right for that action. It can grant or deny, even if the user-level agency right is W or ""
  • if no space-level agency right exists in the agency's chain for an action, the user-level agency right and the mode default apply.

Complete override:

Space-level agency right for the actionUser-level agency rightResult
[]anyDenied
exists and matchesanyAllowed
exists and does not matchanyDenied
does not existRWAllowed
does not existRRead allowed, write denied
does not exist""Denied
does not existmissingAllowed in member, denied in agency

Space-level agency rights can grant access to a user with R, "", or no user-level agency right, provided the user is a member of the space's member. Space-level agency rights never grant membership.

Conditions

ConditionMatches
{ "email": "u@x.fr" }A non-API-key credential with that email.
{ "group": "g1" }A credential whose groups contain { "id": "g1" }.
{ "apiKey": "key1" }An API key whose key is key1. Users do not match this condition.

Conditions are ORed. An email condition never matches an API key use an apiKey condition for API keys. The old { "agency": "*" } condition is no longer supported and matches nobody.

Agency hierarchy

Agency IDs use dots. AG1.SUB is a child of AG1.

For a given action, sxs looks for the most specific space-level agency right and applies it to the whole subtree:

{
  "AG1": {
    "read": [{ "group": "readers" }],
    "write": [{ "group": "editors" }]
  },
  "AG1.SUB": {
    "read": [],
    "write": [{ "email": "sub-editor@x.fr" }]
  }
}
  • AG1 and AG1.OTHER use the AG1 rights
  • AG1.SUB and its children are denied for read
  • AG1.SUB and its children use sub-editor@x.fr for write
  • a child that only defines write still inherits the parent's read right
  • a child entry does not define its parent: if only AG1.SUB is configured, AG1 has no space-level agency right.

Choosing between member and agency

  • Use member when users with no member-level agency right should be allowed by default. Add space-level agency rights only for the agencies you want to restrict. Missing space-level rights fall back to the member-level agency right, or to the member default if there is no member-level right.
  • Use agency when users with no member-level agency right should be denied by default. They need a matching space-level agency right or a member-level agency right. An agency with neither is denied.

Both modes apply space-level agency rights; member does not ignore them.

Dataset-Based Authorization

A dataset can have its own ACL in _meta.acl. It is configured per dataset, through Xplor:

{
  "_meta": {
    "acl": {
      "read": [{ "email": "u1@x.fr" }, { "group": "g1" }],
      "write": [{ "email": "u2@x.fr" }]
    }
  }
}

Dataset ACL rules:

  • conditions support email and group only apiKey is not supported
  • entries are ORed
  • read conditions are the union of read and write: a write entry also grants read
  • write conditions come from write only
  • if write is absent, there is no dataset-level write restriction
  • if write is present, only matching entries can write
  • if read is absent but write is present, read uses the write entries
  • if a side is present but empty, it grants nothing: write: [] denies write, and read: [] denies read when no write entry matches
  • when the dataset ACL restricts the action, non-admin users must belong to the member
  • administrators of the member bypass the dataset ACL for read and write, even when the ACL is empty or does not match
  • a new dataset version follows the same write ACL and inherits the ACL of the previous version.
_meta.aclReadWrite
absent or {}AllowedAllowed
read onlyMatch a read entryAllowed (no write restriction)
write onlyMatch a write entryMatch a write entry
read + writeMatch a read or write entryMatch a write entry
read: [] onlyDeniedAllowed
write: [] onlyDeniedDenied
both emptyDeniedDenied

Administrators of the member bypass this table: they can read and write the dataset regardless of _meta.acl.

For non-admin users, a dataset ACL is ANDed with space and agency access.

Order of Checks

1. Space access
   public, or member/agency with permission, or a matching ACL

2. Agency access (only for member or agency actions)
   space-level agency right first, otherwise member-level agency right, otherwise mode default

3. Dataset access (when the dataset has an ACL)
   dataset ACL conditions (administrators bypass)

Every applicable layer must allow. If one layer denies, the request is denied.

sxs Objects

tenants.json defines members and spaces:

{
  "orox": {
    "id": "orox",
    "label": "orox",
    "spaces": {
      "collect": {
        "id": "collect",
        "read": "agency",
        "write": "agency",
        "agencies": {
          "AG1": {
            "read": [{ "email": "example@gmail.com" }, { "group": "g1" }],
            "write": [{ "email": "example@gmail.com" }]
          }
        }
      }
    }
  }
}

Users and groups are created in Confy and provided by the auth server:

{
  "email": "example@email.com",
  "roles": ["sxs:spaces:editor"],
  "groups": [{ "id": "g1" }],
  "members": [
    {
      "id": "orox",
      "agencies": {
        "AG1": "RW"
      }
    }
  ]
}

API keys are created in Confy. They use the same roles and members[].agencies map as users:

{
  "roles": ["sxs:spaces:viewer"],
  "members": [
    {
      "id": "orox",
      "agencies": {
        "AG1": "R"
      }
    }
  ],
  "meta": {
    "type": "apiKey",
    "key": "1234"
  }
}

Use an API key with a Basic Authorization header:

const headers = { authorization: `Basic ${API_KEY}` }

Use Cases

Public read, write restricted to member users

Space disseminate is publicly readable, but only orox editors can write:

{
  "read": "public",
  "write": "member"
}
UserMembersRolesReadWrite
anonymous--✅❌
editororoxSpaces Editor✅✅
vieweroroxSpaces Viewer✅❌
otheruroxSpaces Editor✅❌

Read is public. Write requires membership in orox and sxs:spaces:write.

Read and write restricted to member users

{
  "read": "member",
  "write": "member"
}
UserMembersRolesReadWrite
anonymous--❌❌
editororoxSpaces Editor✅✅
vieweroroxSpaces Viewer✅❌
otheruroxSpaces Editor❌❌

Read requires sxs:spaces:read write requires sxs:spaces:write.

Write restricted by an ACL

Only listed users or groups can write, regardless of their space roles:

{
  "read": "member",
  "write": "member",
  "acl": {
    "write": [{ "email": "u1@example.com" }, { "group": "g1" }]
  }
}
UserMembersACL entryReadWrite
u1oroxemail✅✅
u2oroxgroup g1✅✅
u3orox-❌❌
  • matching acl.write grants write and read, so u1 and u2 can read even without sxs:spaces:read
  • u3 does not match the ACL, so write is denied, and read is denied because the active ACL has no read entries.

Restrict write access to specific agencies

All orox editors can write, except on SDMX.SAMPLE, which is reserved for the sample-editors group:

{
  "read": "public",
  "write": "member",
  "agencies": {
    "SDMX.SAMPLE": {
      "write": [{ "group": "sample-editors" }]
    }
  }
}
UserGroupSDMX.SAMPLESDMX.SAMPLE.SUBSDMX.OTHER
u1sample-editors✅✅✅
u2-❌❌✅
  • write: member allows all editors by default
  • the SDMX.SAMPLE space-level agency right overrides that default for the agency and its children
  • SDMX.OTHER has no space-level agency right, so the member default applies
  • a denied agency write is rejected with 403.

To use agency mode instead, users without a member-level agency right will be denied unless a space-level agency right matches. An agency with neither a space-level agency right nor a member-level agency right is denied.

Summary

  1. Every applicable layer must allow.
  2. public ignores ACL and agency checks for that action.
  3. member and agency require membership and the space permission, unless an ACL replaces the space check.
  4. An ACL is active when space.acl has a read or write array. A matching write entry also grants read.
  5. Space-level agency rights (space.agencies) apply in both member and agency modes and override the member-level agency rights for that action.
  6. In agency mode, an agency with no space-level agency right and no member-level agency right is denied. In member mode, it is allowed.
  7. Member-level agency rights are R, RW, or ""; missing means the mode default.
  8. Dataset ACLs are separate: read uses read plus write, write uses write, and a missing write side means no write restriction.
  9. Administrators bypass space checks, agency checks and dataset ACLs for the members they administer. They can read external spaces but cannot write them.