How to control bad remote creation which takes rclone down

Hello Team,

We are using rclone in rcd mode and creating remotes by sending post http requests .

Recently one of the user sent below request for GCS remote creation , and remote got created.
But rclone k8 pod kept on restarting as it could not parse the "project_number" in config file

{
"name" : "test11_6189_GCPGCS_1aaff6f0_25ae_4087_787b_08db46d5ce8b",
"type" : "google cloud storage",
"parameters" : {
"provider" : "Google Cloud Storage",
"project_number" : "30411168\n4541",
"bucket_policy_only" : true,
"location" : "asia-south1",
"service_account_file" : "/data/......"
}
}

How do we handle this scenario ? is there any way to avoid whole rclone down scenario?
Do we have any plan to move config from flat file database or something?
please advice.

Thanks
Mahendra

should a project number has \n character?

I'd class this is as a bug. An RC interaction should never trigger a fatal error.

It looks like that request managed to create an invalid config file. I guess the embedded \n in the project_number caused the problem.

I can re-create this problem quite easily with

rclone config create test123123123 "google cloud storage" project_number "30411168"$'\n'"4541"

Which creates a config segment

[test123123123]
type = google cloud storage
project_number = 30411168
4541

Which is clearly invalid

Try this which should prevent \n and \r making it to the config file

v1.63.0-beta.6985.5bacff90e.fix-config-create on branch fix-config-create (uploaded in 15-30 mins)

1 Like

Thank you so much @ncw .

I have tested and it works fine, I got below error.

"error": "update remote: invalid key or value contains \n or \r"

Is this validation going to be common for all the fields?
I think there are some remote types which takes key file content as input, for them we might need to allow /n right?

I could not test any specific scenario but just a point.

Thanks
Mahendra

Thanks for testing. I've merged this to master now which means it will be in the latest beta in 15-30 minutes and released in v1.63

Yes

Rclone config files don't allow /n in entries at the moment so hopefully this will not be a problem!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.