def get_pack_file_abs_path(pack_name, file_path):
    pack_base_path = get_pack_base_path(pack_name=pack_name)

    path_components = []
    path_components.append(pack_base_path)

    # Normalize the path to prevent directory traversal
    normalized_file_path = os.path.normpath('/' + file_path).lstrip('/')

    if normalized_file_path != file_path:
        raise ValueError('Invalid file path: %s' % (file_path))

    path_components.append(normalized_file_path)
    result = os.path.join(*path_components)

    assert normalized_file_path in result

    # Final safety check for common prefix to avoid traversal attack
    common_prefix = os.path.commonprefix([pack_base_path, result])
    if common_prefix != pack_base_path:
        raise ValueError('Invalid file_path: %s' % (file_path))

    return result
Retrieve full absolute path to the pack file.
dataset/ETHPy150Open StackStorm/st2/st2common/st2common/content/utils.py/get_pack_file_abs_path