Commit graph

522 commits

Author SHA1 Message Date
Tom Hughes
0c2e471708 Fix new rubocop warnings 2023-12-05 18:13:13 +00:00
Tom Hughes
12b4d11d44 Use SecureRandom to generate user tokens 2023-12-04 17:25:57 +00:00
Tom Hughes
cebda5ffb9 Merge remote-tracking branch 'upstream/pull/4319' 2023-11-15 17:14:49 +00:00
Tom Hughes
55a05d9e80 Use secure_compare to compare passwords and tokens
It's unlikely there is an explotable attack here given than network
latencies and variability will swamp any local timing differences but
it's best practice and there's no reason not to.
2023-11-07 17:22:40 +00:00
Tom Hughes
ef4c9a3306 Make change set comment rate limit errors display properly
Fixes #4320
2023-11-02 10:08:19 +00:00
Tom Hughes
2f11b77309 Add support for per-user limits on the rate changes can be made 2023-11-02 08:59:57 +00:00
Tom Hughes
0e74b21cb2 Fix new rubocop warnings 2023-10-31 18:16:46 +00:00
Tom Hughes
a6b5f2f56d Adjust code for rails internal changes 2023-10-18 18:26:14 +01:00
Gregory Igelmund
aa573ce1bb
.github/workflows/lint.yml: Add task verifying annotations are up2date 2023-10-14 11:28:44 +08:00
Milan Cvetkovic
64bcf7652b Add openid connect support using doorkeeper-openid_connect gem
... as discussed in [Issue 507](https://github.com/openstreetmap/operations/issues/507)
and described by @mmd-osm.

To activate, set the value of `doorkeeper_signing_key` to RSA private key.

Allows using openstreetmap as an identity provider.

Adds `openid` scope to OAuth2 authorizations, required to login to OSM.

Currently, the only claims returned are:
 - "openid" scope: "sub" and "preferred_username"
 - "read_email" scope: "email"
2023-10-03 18:53:47 +01:00
Anton Khorev
0ef4a299bb Check required bbox parameter presence outside of BoundingBox class 2023-09-03 09:47:27 +03:00
Andy Allan
a1657f03a8
Merge pull request #4202 from tomhughes/changeset-comment-limit
Add rate limiting for changeset comments
2023-08-30 11:12:40 +01:00
Tom Hughes
a274726f46 Add rate limiting for changeset comments
Fixes #4196
2023-08-25 19:53:04 +01:00
Tom Hughes
63bf18a3c3 Add support for rate limiting signup requests 2023-08-22 18:45:17 +01:00
Milan Cvetkovic
ad164d384e Change provider name to "microsoft" 2023-08-20 10:19:30 +01:00
Milan Cvetkovic
568bf4939d Replace references to windowslive with microsoft_graph 2023-08-17 13:01:15 +00:00
Milan Cvetkovic
7428da74c2 Use omniauth-microsoft_graph instead of omniauth-windowslive
Omniauth-microsoft_graph correctly populates 'email' and 'name' fields used by OpenStreetMap.
It also  uses updated endpoints for Microsoft identity provider.

Use email address returned by microsoft_graph provider as a verified address.

Upgrading exisiting users from windowslive to microsoft_graph:
 - upon next login existing `windowslive` users will have to authorizei
   OpenStreetMap application to "Read Your Profile," required for proper reading
   of display name field.

The name of the identity provider in OSM is kept to 'windowslive':
 - the entries in users table with `provider == 'windowslive'`
   can be reused for microsoft_graph provider, since
   the uid field is preserved. Users will not need to repeat the sign up process.
 - OAuth2 callback is still `/auth/windowslive`, no updates to Microsoft Identity Provider portal
   App registration are necessary.
2023-08-17 13:01:15 +00:00
Tom Hughes
466de96a91 Fix new rubocop warnings 2023-06-27 18:13:33 +01:00
Tom Hughes
c599f2bfaf Fix new rubocop warnings 2023-01-24 18:23:49 +00:00
Andy Allan
4ab134d869 Use fallbacks for OCI resource names
This uses the fallbacks for OCI translations. For example, if a
local chapter doesn't have an explicitly translated name, it will
use a template for osm-lc resources and fill in the appropriate
translated community name.

Fixes #3814
2022-12-14 14:54:01 +00:00
Tom Hughes
8cef62cd2c Merge remote-tracking branch 'upstream/pull/3301' 2022-11-22 18:47:24 +00:00
Andy Allan
b755db57a6 Use Pathname.glob to fetch the files 2022-11-02 18:33:32 +00:00
Andy Allan
af6fec502a Validate URLs against supply-chain attacks
Unfortunately validates_url gem doesn't support mailto or xmpp urls,
so we need to write our own validation.
2022-11-02 18:21:00 +00:00
Brian DeRocher
8eb2abc10c get_text("reversegeocode/result") returns an XML node. We want to get the text value of that node.
This will unescape ' into an apostrophe.

All callers of this function will later re-encode it depending out output whether it be HTML in an email, or XML in an RSS feed.

* app/mailers/user_mail.rb
* app/helpers/geocode_helper.rb
* app/views/api/notes/feed.rss.builder
* app/views/api/notes/_note.rss.builder

Fixes openstreetmap/openstreetmap-website#3761
2022-10-23 16:04:01 -04:00
Adam Hoyle
7e5cbe87ed Merge branch 'master' into feature/add-communities-page
# Conflicts:
#	Gemfile.lock
#	package.json
#	yarn.lock
2022-09-10 16:13:17 +01:00
Tom Hughes
9cd96bd452 Fix new rubocop warnings 2022-09-09 22:45:58 +01:00
Tom Hughes
fa93526f76 Use nominatim_url setting more consistently 2022-09-07 08:45:27 +01:00
Andy Allan
7e62e2b5ed Filter out the communities before loading the translations
This avoids loading excessive numbers of translations
2022-08-10 17:34:24 +01:00
Andy Allan
bf1f882eb8 Genericese comment 2022-08-10 17:19:46 +01:00
Andy Allan
87bb2a717d Use each_with_object 2022-08-10 14:01:42 +01:00
Andy Allan
5dcb4aa8fd Use member syntax for accessing communities 2022-08-10 13:54:14 +01:00
Andy Allan
d20632de9c Restrict files read from directory 2022-08-10 13:48:27 +01:00
Andy Allan
83a0ea14f1 Refactor i18n so that all community information is available
This makes it easier to use non-chapter communities on the site in future.
2022-08-03 10:11:30 +01:00
Andy Allan
bb7f5ac2c8 Switch to using FrozenRecord for loading communities
This allows us to query the records to get the local chapters, which
is more flexible and allows us to use other resources too.
2022-07-27 16:19:08 +01:00
Tom Hughes
006884bedd Fix new rubocop warning 2022-06-28 21:11:12 +01:00
Tom Hughes
eea25bd154 Set a timeout on HTTP requests made by the server 2022-05-29 10:55:06 +01:00
Andy Allan
561ee71129 Rubocop autofix: ambiguous operator precedence
This simply adds braces to clarify which mathematical operator comes
first.
2022-04-06 14:55:29 +01:00
Andy Allan
d17d13c806 Use map rather than foo = [] ... each ... foo.push(bar) 2022-03-30 18:03:11 +01:00
Andy Allan
44286b46b1 Use String#tr instead of String.split(foo).join(bar) 2022-03-30 17:41:30 +01:00
Andy Allan
d6f8302eae
Merge pull request #3491 from tomhughes/legacy-trace
Remove support for legacy trace files
2022-03-09 17:10:40 +00:00
Tom Hughes
5d67fa3908 Fix some Naming/AccessorMethodName rubocop warnings 2022-03-08 19:10:05 +00:00
Tom Hughes
cbcc7dc49f Fix some rubocop Naming/PredicateName warnings 2022-03-03 22:47:55 +00:00
Tom Hughes
92b122759f Remove support for legacy trace files 2022-03-03 19:47:40 +00:00
Andy Allan
1bcde09125 Unnest OsmCommunityIndex
No need for OsmCommunityIndex::OsmCommunityIndex.foo
2022-03-02 16:23:07 +00:00
Andy Allan
30b3a971bc Rubocop autofixes 2022-03-02 15:52:04 +00:00
Tom Hughes
b5f06e06c1 Fix rubocop Rails/TimeZone warnings 2022-03-01 22:55:10 +00:00
Andy Allan
2fabc46421
Merge pull request #3440 from mmd-osm/relationmemberlimit
Introduce relation member limit
2022-02-16 14:58:30 +00:00
Adam Hoyle
b4ec1c9f3d Fix: add osm-community-index localisation data to I18n 2022-02-10 22:28:40 +00:00
mmd-osm
2efd73c672 Introduce relation member limit
Adds a new parameter `max_number_of_relation_members` in settings.yml
2022-02-02 13:15:40 +01:00
Tom Hughes
b244905cd2 Add a rake task to migrate trace data to ActiveStorage 2021-12-16 18:45:31 +00:00