TritonDataCenter / TritonDataCenter/sdc-cloudapi

RBAC: Cannot set `role-tag` on `/my/fabrics` or descendants

Open
#31 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
8
Forks
22
Avg merge
3d 9h
Merged PRs (30d)
1

Description

I'm not able to use HTTP PUT to update the role-tag on /my/fabrics or any of its descendants.

Reproduction setup, the usual environment variables and also:

function cloudapi() {
    local now=$(date -u '+%a, %d %h %Y %H:%M:%S GMT')
    local signature=$(echo -n "$now" | openssl dgst -sha256 -sign ~/.ssh/id_rsa | openssl enc -e -a | tr -d '\n')
    local url="$SDC_URL$1"
    shift
    curl --silent --insecure \
        --header 'Accept: application/json' \
        --header "accept-version: ~8" \
        --header "Date: $now" \
        --header "Authorization: Signature keyId=\"/$SDC_ACCOUNT/keys/id_rsa\",algorithm=\"rsa-sha256\" $signature" \
        "$@" "$url"
    echo
}

Make sure keyId matches your account's key name. You may need to create an example role too.

Expected output:

$ cloudapi /my/fabrics --request PUT --header "Content-Type: application/json" --data '{"role-tag": ["network-operator"]}'
{"name":"/$SDC_ACCOUNT/fabrics","role-tag":["network-operator"]}

Actual output:

$ cloudapi /my/fabrics --request PUT --header "Content-Type: application/json" --data '{"role-tag": ["network-operator"]}'
{"code":"ResourceNotFound","message":"fabrics is not a valid resource"}

$ cloudapi /my/fabrics/default --request PUT --header "Content-Type: application/json" --data '{"role-tag": ["network-operator"]}'
{"code":"ResourceNotFound","message":"fabrics is not a valid resource"}

$ cloudapi /my/fabrics/default/vlans --request PUT --header "Content-Type: application/json" --data '{"role-tag": ["network-operator"]}'
{"code":"MethodNotAllowedError","message":"PUT is not allowed"}

$ cloudapi /my/fabrics/default/vlans/2 --request PUT --header "Content-Type: application/json" --data '{"role-tag": ["network-operator"]}'
{"code":"InvalidArgument","message":"property \"role-tag\": unsupported property"}

This server is CloudAPI version 9.3.0, apologies if this is already fixed in a newer version. This may or may not be related to #30 .

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by using the provided cloudapi curl helper against /my/fabrics and its descendants with CloudAPI version 9.3.0, comparing the reported errors with the expected response. Done means HTTP PUT accepts role-tag for the listed fabric resources and returns the resource with the requested role-tag instead of ResourceNotFound, MethodNotAllowedError, or unsupported-property errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, authorization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.