I would suggest that the length is not the longest if the box is taller than it is long. It might vary depending on whether you are talking to a postal clerk, or a box designer. It might also depend on whether or not the box has a lid that implies it is on top and that its sides are therefore the width and length, not the height (the measurement which ascends to the top)..
So far, rectangular boxes have been described. Some boxes are not rectangular, but perhaps you are not asking about those.
(The cat door’s measurements can be almost any size, up to the point where the box collapses and the cat just sits on the box.)