Is there any security issue when making for-loops inside getter functions ? Let's say the array is very large, and it takes a long time to loop through the array. Is it a potential threat or I can ignore this as long as the function is passed as view or pure ? Moreover in general can I consider all view and pure functions as none dangerous for the smart contract security ? Best regards
There is no security issue when making getter functions, period!
A getter function is constant (typically
view), hence does not change the state.
Therefore, such function cannot yield a security breach by definition.
You may have a security issue in some non-constant function which calls some getter function, but that security issue will not be resolved by changing the getter function's code.