Creation of a new target succeeds despite empty name

Ouverte
#1,237 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
35/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
À l'abandon
Stack technique
java
Domaine
api

Piste de recherche

Start at the POST /rest/v1/targets endpoint and trace how target creation handles the name field. Reproduce the request from the issue's shell example; done means an empty name is rejected instead of creating a target named after its controller ID.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

I'm working on a library providing Go bindings for Eclipse Hawkbit. As a part of the process I created integration tests that interrogate a real Hawkbit installation to see how it behaves.

According to the documentation at https://www.eclipse.org/hawkbit/rest-api/targets-api-guide/#_create_list_of_targets the name fields is mandatory when creating a target. Providing an empty value unexpectedly succeeds, with the name being set to the controller ID.

See the sample shell test program I created.

    # We should not be able to create a target with an empty name
    # https://www.eclipse.org/hawkbit/rest-api/targets-api-guide/#_create_list_of_targets
    curl \
        --verbose \
        --dump-header resp.head \
        --output resp.body \
        -H "$TEST_HAWKBIT_AUTH" \
        -H 'Accept: application/hal+json' \
        -H 'Content-Type: application/json;charset=UTF-8' \
        "${TEST_HAWKBIT_URL}/rest/v1/targets" \
        -d '[{"controllerId": "1001", "name": "",  "description": "First test device", "securityToken": "9999", "address": "https://localhost:8001"}]'

    # The request unexpected succeeds.
    fromdos resp.head
    GREP -qFx 'HTTP/1.1 201 Created' < resp.head

    # The returned data is sane.
    jq '.[0].controllerId' -r < resp.body | GREP -qFx 1001
    # The name seems to default to the value of the controllerId.
    jq '.[0].name' -r < resp.body | GREP -qFx "1001"
    jq '.[0].description' -r < resp.body | GREP -qFx "First test device"
    jq '.[0].createdBy' -r < resp.body | GREP -qFx admin
    jq '.[0].lastModifiedBy' -r < resp.body | GREP -qFx admin
    jq '.[0].updateStatus' -r < resp.body | GREP -qFx unknown
    jq '.[0]._links.self.href' -r < resp.body | GREP -qFx "${TEST_HAWKBIT_URL}/rest/v1/targets/1001"
Langage dominant
Java
Étoiles
601
Forks
228
Merge moyen
15 h 48 min
PR mergées (30 j)
62

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de eclipse-hawkbit/hawkbit

Toutes les issues de eclipse-hawkbit/hawkbit

Issues similaires

Plus d'issues Java

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.