Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
github.com/mitranim/refut
Short for "reflect utils": utilities missing from the "reflect" package in the Go standard library. Small and dependency-free.
See the full documentation at https://pkg.go.dev/github.com/mitranim/rf.
Walking now avoids stack overflow on cyclic types. More specifically, it avoids infinite recursion when generating walkers for cyclic types. Note that fully walking cyclic types is not yet supported; instead, inner occurrences of a cyclic type are ignored, and only the outermost occurrence is walked. This limitation may be lifted in future versions.
Walking now ignores private fields.
Converted the following tools to generics, for better type safety and efficiency:
TypeFilter
IfaceFilter
ShallowIfaceFilter
Appender
Trawl
TrawlWith
Added KindFilter
(untested).
Added Type
.
Rename WalkFuncPtr
→ WalkPtrFunc
.
Add WalkPtr
and WalkFuncPtr
. Remove DerefPtr
because it made no sense.
Added:
ValueAddr
Interface
DeepFields
TypeDeepFields
OffsetFields
TypeOffsetFields
Path
Rev
Breaking changes:
DerefValue*
to begin with Deref*
.CopyPath
with Path.Copy
.DeepFields
and TypeDeepFields
is a particularly useful addition, as it supports "flattening" structs, simplifying most use cases that involve struct iteration.
Add IfaceFilterFor
, ShallowIfaceFilterFor
.
Reverted breaking change in v0.3.1
: IfaceFilter
once again allows to visit descendants. Added ShallowIfaceFilter
that doesn't visit descendants of a matching node.
Quick breaking change: IfaceFilter
visits either self or descendants, not both.
More flexible Filter
interface:
Previous approach: filter returns bool
answering "should visit this node". 2 possible states. Implicitly walks descendants.
New approach: filter returns flagset where "should visit this node" and "should walk descendants" are both optional flags. 4 possible states. Walking descendants is now optional.
Renamed Filter.ShouldVisit
to Filter.Visit
because it's no longer a boolean. This makes it impossible to implement Filter
and Walker
on the same type, which is probably a good thing due to filter equality rules.
Nop
no longer implements Filter
.
Replaced True
and False
with Self
, Desc
, Both
, All
.
Replaced Not
with InvertSelf
.
Renamed DerefLen
to Len
.
Added Fields
and TypeFields
for micro-optimizing struct shallow walking.
Walk
/ GetWalker
now support walking into interface{}
values, fetching the appropriate cached walker for the given type and filter on the fly.
Added MaybeOr
, MaybeAnd
, GetTypeFilter
, TypeFilterFor
for micro-optimizing filter allocations.
Complete revision.
Cache
for generating and caching arbitrary type-dependent structures.github.com/mitranim/refut
to github.com/mitranim/rf
for brevity.I'm receptive to suggestions. If this library almost satisfies you but needs changes, open an issue or chat me up. Contacts: https://mitranim.com/#contacts
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.