Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

sqlib/sqhook: allow attaching multiple rules per hook point #136

Merged
merged 2 commits into from
Jul 17, 2020

Conversation

Julio-Guerra
Copy link
Collaborator

@Julio-Guerra Julio-Guerra commented Jul 16, 2020

  • Add support to attach multiple callbacks per hook.
  • Add support to attach multiple rules per hook by ascending priority order.

When multiple callbacks are attached to a hook, a reflected callback is created
to call each one of them. The prolog calls are stopped as soon as an error is
returned, and the epilogs returned so far are called in the same order of their
prolog calls. The implementation is the most straightforward and reuses already
existing features (ie. return a reflected prolog callback calling every prolog
callbacks) - the downside is that it is based on `reflect.MakeFunc` which is a
dynamic function stub according the function type. We couldn't find anyting
simple only using type assertions.
For the record, we used to have an explicit callback chaining (a callback had
its next callback pointer) so that it could make benefit from the type
information at the callback level (a callback knows its function type) in order
to avoid using `reflect` thanks to straightforward type assertions. But the
downside was a very complex implementation of callbacks which had to deal with
the management of the next callback - readibility was terrible. This
implementation hides the chaining details in a wrapper callback.
@Julio-Guerra Julio-Guerra added this to the v0.13.0 milestone Jul 16, 2020
@Julio-Guerra Julio-Guerra self-assigned this Jul 16, 2020
Multiple rules per hookpoint are attached and executed in ascending priority
order.
@Julio-Guerra Julio-Guerra changed the title sqlib/sqhook: allow attaching multiple callbacks per hook sqlib/sqhook: allow attaching multiple rules per hook point Jul 17, 2020
@Julio-Guerra Julio-Guerra added enhancement New feature or request internals Internal feature labels Jul 17, 2020
@Julio-Guerra Julio-Guerra merged commit 7bb4913 into dev Jul 17, 2020
@Julio-Guerra Julio-Guerra deleted the feature/multiple-callbacks-per-hook branch July 17, 2020 20:25
@Julio-Guerra Julio-Guerra mentioned this pull request Jul 24, 2020
Julio-Guerra pushed a commit that referenced this pull request Jul 24, 2020
- (#137) RASP: add noSQL Injection protection support for the Go MongoDB driver
  `go.mongodb.org/mongo-driver/mongo`. This protection can be configured at
  <https://my.sqreen.com/application/goto/modules/rasp/details/nosql_injection>.

Internal Changes:

- (#138) Health-check the HTTPS connectivity to the new backend API
  `ingestion.sqreen.com` before using it. Fallback to the usual
  `back.sqreen.com` in case of a connection issue. Therefore, the agent can take
  up to 30 seconds to connect to Sqreen if the health-check timeouts. Please
  make sure to add this new  firewall and proxy configurations.

- (#136) Add support to attach multiple security protections per hook point.

Fixes:

- (#140) Fix the In-App WAF metadata PII scrubbing to also match substrings.
Julio-Guerra pushed a commit that referenced this pull request Jul 24, 2020
New Feature:

- (#137) RASP: add noSQL Injection protection support for the Go MongoDB driver
  `go.mongodb.org/mongo-driver/mongo`. This protection can be configured at
  <https://my.sqreen.com/application/goto/modules/rasp/details/nosql_injection>.

Internal Changes:

- (#138) Health-check the HTTPS connectivity to the new backend API
  `ingestion.sqreen.com` before using it. Fallback to the usual
  `back.sqreen.com` in case of a connection issue. Therefore, the agent can take
  up to 30 seconds to connect to Sqreen if the health-check timeouts. Please
  make sure to add this new  firewall and proxy configurations.

- (#136) Add support to attach multiple security protections per hook point.

Fixes:

- (#140) Fix the In-App WAF metadata PII scrubbing to also match substrings.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request internals Internal feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant