You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fail writing files in protoc CLI if any file output path is relative.
A flag --unsafe_allow_out_dir_escape is added which disables the enforcement for any users who are intentionally writing files outside of the out_dir as set in protoc.
This was always the intended behavior but was not enforced before now.
This avoids risks of files being accidentally written which escape the intended output directories. Strictly speaking this is more restrictive than necessary, where a relative path of `x/../y.java` could be technically ok since it doesn't escape while `x/../../y.java` does). But as we should should never have relative path components at this point in a working as intended flow so the simplest thing is to ban all relative paths when going to write out.
When investigating this issue, at least one case of someone intentionally escaping the output directory by (for example) setting `go_package = "../xyz";` Unfortunately, this change will break those rare usecases and the only fix will be to adjust the .proto file and protoc invocation context, but as a security hardening measure of an unintended behavior this is an intended change.
PiperOrigin-RevId: 893098701
0 commit comments