File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed
Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change 55#include < math.h>
66#include < napi.h>
77#include < napi-inl.h>
8+ #include < js_native_api.h>
89#include < ddwaf.h>
910
1011#include < limits>
@@ -84,7 +85,22 @@ ddwaf_object* to_ddwaf_object_object(
8485 }
8586 }
8687
87- Napi::Array properties = obj.GetPropertyNames ();
88+
89+ napi_value result;
90+ napi_status status = napi_get_all_property_names (env,
91+ obj,
92+ napi_key_own_only,
93+ napi_key_skip_symbols,
94+ napi_key_keep_numbers,
95+ &result);
96+
97+ if ((status) != napi_ok) {
98+ mlog (" Error getting object properties" );
99+ return nullptr ;
100+ }
101+
102+ Napi::Array properties = Napi::Array (env, result);
103+
88104 uint32_t len = properties.Length ();
89105 if (lim && len > DDWAF_MAX_CONTAINER_SIZE) {
90106 len = DDWAF_MAX_CONTAINER_SIZE;
@@ -103,11 +119,7 @@ ddwaf_object* to_ddwaf_object_object(
103119 for (uint32_t i = 0 ; i < len; ++i) {
104120 mlog (" Getting properties" );
105121 Napi::Value keyV = properties.Get (i);
106- if (!obj.HasOwnProperty (keyV) || !keyV.IsString ()) {
107- // We avoid inherited properties here.
108- // If the key is not a String, well this is weird
109- continue ;
110- }
122+
111123 std::string key = keyV.ToString ().Utf8Value ();
112124 Napi::Value valV = obj.Get (keyV);
113125 mlog (" Looping into ToPWArgs" );
You can’t perform that action at this time.
0 commit comments