Skip to content

Conversation

@listerr
Copy link
Contributor

@listerr listerr commented Aug 4, 2025

[BF] Validate peeringmacro and peeringmacrov6 on input.

Related to #877

Looks there has been some fixes to the scheduled job in the pipeline, but if we can stop bum data from getting into it in the first place, this would also be good.

The scheduled job to update the ASN/prefix list was silently crashing out (again!) when it encountered an invalid entry.

Seems it has not been running properly for some time.

Often when populating from PeeringDB, it contains other spurious text in the as-macro field, like:

RIPE::AS-FOO RIPE::AS-FOO-THING.

This PR adds validation to the fields on input, and only accepts the following:-

  • AS<number>
  • AS-<name>
  • AS<number>:AS-NAME

It does not accept:-

  • AS with leading zero - AS01234
  • More than one consecutive colon - RIPE::AS-FOO
  • More than one consecutive hyphen -- - AS--FOO-BAR
  • Leading or trailing - - AS-FOO-BAR-
  • Leading or trailing : - AS12345:
  • Any spaces, dots etc. (Anything not 0-9, A-Z, a-z, -)

I've applied this as a local patch to our install to prevent this issue happening again.

R.

In addition to the above, I have:

  • ensured all relevant template output is escaped to avoid XSS attached with <?= $t->ee( $data ) ?> or equivalent.
  • ensured appropriate checks against user privilege / resources accessed
  • API calls (particular for add/edit/delete/toggle) are not implemented with GET and use CSRF tokens to avoid CSRF attacks

@barryo barryo merged commit 3e05e97 into inex:master Aug 11, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants