Skip to content

The sensitive information of uri may leak #8853

@YLChen-007

Description

@YLChen-007
ISSUE TYPE
  • Bug Report
COMPONENT NAME
cloudstack-service-secondary-storage 
CLOUDSTACK VERSION
commit ID: 45d267ccbf2749c547cbbbac4a2cb1f3351dcaf2 on main branch.
CONFIGURATION
OS / ENVIRONMENT
SUMMARY

The sensitive information of URI may leak through "logger.error"

STEPS TO REPRODUCE

EXPECTED RESULTS

ACTUAL RESULTS

error code location

protected String parseCifsMountOptions(URI uri) {
    List<NameValuePair> args = URLEncodedUtils.parse(uri, "UTF-8");
    boolean foundUser = false;
    boolean foundPswd = false;
    StringBuilder extraOpts = new StringBuilder();
    for (NameValuePair nvp : args) {
        String name = nvp.getName();
        if (name.equals("user")) {
            foundUser = true;
            logger.debug("foundUser is" + foundUser);
        } else if (name.equals("password")) {
            foundPswd = true;
            logger.debug("password is present in uri");
        }

        extraOpts.append(name + "=" + nvp.getValue() + ",");
    }

    if (logger.isDebugEnabled()) {
        logger.error("extraOpts now " + extraOpts); //output 
    }

    if (!foundUser || !foundPswd) {
        String errMsg = "Missing user and password from URI. Make sure they" + "are in the query string and separated by '&'.  E.g. "
                + "cifs://example.com/some_share?user=foo&password=bar";
        logger.error(errMsg);
        throw new CloudRuntimeException(errMsg);
    }
    return extraOpts.toString();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions