{"record":{"id":"558526ab9ef94e4c","repo":"goharbor/harbor","slug":"127-0-0-1-can-not-be-the-hostname","errorCode":null,"errorMessage":"127.0.0.1 can not be the hostname","messagePattern":"127\\.0\\.0\\.1 can not be the hostname","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"make/photon/prepare/utils/configs.py","lineNumber":23,"sourceCode":"from urllib.parse import urlencode, quote\nfrom g import versions_file_path, host_root_dir, DEFAULT_UID, INTERNAL_NO_PROXY_DN\nfrom models import InternalTLS, Metric, Trace, PurgeUpload, Cache, Core\nfrom utils.misc import generate_random_string, owner_can_read, other_can_read\n\n# NOTE: https://golang.org/pkg/database/sql/#DB.SetMaxIdleConns\ndefault_db_max_idle_conns = 2\n# NOTE: https://golang.org/pkg/database/sql/#DB.SetMaxOpenConns\ndefault_db_max_open_conns = 0\ndefault_https_cert_path = '/your/certificate/path'\ndefault_https_key_path = '/your/certificate/path'\n\nREGISTRY_USER_NAME = 'harbor_registry_user'\n\n\ndef validate(conf: dict, **kwargs):\n    # hostname validate\n    if conf.get('hostname') == '127.0.0.1':\n        raise Exception(\"127.0.0.1 can not be the hostname\")\n    if conf.get('hostname') == 'reg.mydomain.com':\n        raise Exception(\"Please specify hostname\")\n\n    # protocol validate\n    protocol = conf.get(\"protocol\")\n    if protocol == \"https\":\n        if not conf.get(\"cert_path\") or conf[\"cert_path\"] == default_https_cert_path:\n            raise Exception(\"Error: The protocol is https but attribute ssl_cert is not set\")\n        if not conf.get(\"cert_key_path\") or conf['cert_key_path'] == default_https_key_path:\n            raise Exception(\"Error: The protocol is https but attribute ssl_cert_key is not set\")\n    if protocol == \"http\":\n        logging.warning(\"WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to https\")\n\n    # log endpoint validate\n    if ('log_ep_host' in conf) and not conf['log_ep_host']:\n        raise Exception('Error: must set log endpoint host to enable external host')\n    if ('log_ep_port' in conf) and not conf['log_ep_port']:\n        raise Exception('Error: must set log endpoint port to enable external host')","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/make/photon/prepare/utils/configs.py#L5-L41","documentation":"The payload-side check of SBOM manager UpdateReportData: the uuid argument passed validation but the report string is empty, so the update is refused rather than blanking the stored SBOM. As with the vulnerability-report twin, it is argument validation before the DAO is called.","triggerScenarios":"UpdateReportData(ctx, uuid, \"\") — the SBOM content read from the adapter response or object store came back empty while the read error was swallowed.","commonSituations":"Adapter 200-with-empty-body responses; empty blobs read from storage backends; the report variable assigned in a branch that did not execute.","solutions":["Verify the SBOM payload is non-empty at the point it is read and surface the read error","Guard both uuid and payload before calling UpdateReportData","Never use this method to clear an SBOM — delete the report instead"],"exampleFix":"// before\nerr := mgr.UpdateReportData(ctx, uuid, sbomJSON) // sbomJSON may be \"\"\n\n// after\nif strings.TrimSpace(sbomJSON) == \"\" {\n    return fmt.Errorf(\"sbom payload for %s is empty; refusing to store\", uuid)\n}\nerr := mgr.UpdateReportData(ctx, uuid, sbomJSON)","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(report) == \"\" {\n    return fmt.Errorf(\"sbom payload empty; refusing update for %s\", uuid)\n}\nreturn mgr.UpdateReportData(ctx, uuid, report)","typeGuard":null,"tryCatchPattern":"if err := mgr.UpdateReportData(ctx, uuid, report); err != nil {\n    if strings.Contains(err.Error(), \"missing report JSON data\") {\n        log.Printf(\"empty sbom body for %s; check adapter response\", uuid)\n    }\n    return err\n}","preventionTips":["Check the SBOM payload length where it is read from the adapter or store","Never swallow read errors that can yield empty payloads","Use the delete API to remove SBOMs, never an empty update"],"tags":["go","harbor","sbom","report","validation"],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}