Skip to content

Commit

Permalink
fix 756c817
Browse files Browse the repository at this point in the history
must be applied to all code where a transaction token is generated.
  • Loading branch information
Orbiter committed Oct 21, 2023
1 parent dc6f218 commit 7830268
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 10 deletions.
7 changes: 5 additions & 2 deletions source/net/yacy/htroot/ConfigAccounts_p.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ public static serverObjects respond(final RequestHeader header, final serverObje
final serverObjects prop = new serverObjects();

/* Acquire a transaction token for the next POST form submission */
prop.put(TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));

final Switchboard sb = (Switchboard) env;
try {
prop.put(TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));
} catch (IllegalArgumentException e) {
sb.log.fine("access by unauthorized or unknown user: no transaction token delivered");
}
UserDB.Entry entry = null;

// admin password
Expand Down
6 changes: 5 additions & 1 deletion source/net/yacy/htroot/ConfigPortal_p.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,11 @@ public static serverObjects respond(final RequestHeader header, final serverObje
}

/* Acquire a transaction token for the next POST form submission */
prop.put(TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));
try {
prop.put(TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));
} catch (IllegalArgumentException e) {
sb.log.fine("access by unauthorized or unknown user: no transaction token delivered");
}

prop.putHTML(SwitchboardConstants.GREETING, sb.getConfig(SwitchboardConstants.GREETING, ""));
prop.putHTML(SwitchboardConstants.GREETING_HOMEPAGE, sb.getConfig(SwitchboardConstants.GREETING_HOMEPAGE, ""));
Expand Down
7 changes: 6 additions & 1 deletion source/net/yacy/htroot/ConfigProperties_p.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

import net.yacy.cora.protocol.RequestHeader;
import net.yacy.data.TransactionManager;
import net.yacy.search.Switchboard;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;

Expand All @@ -47,7 +48,11 @@ public static serverObjects respond(final RequestHeader header, final serverObje
final serverObjects prop = new serverObjects();

/* Acquire a transaction token for the next POST form submission */
prop.put(TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));
try {
prop.put(TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));
} catch (IllegalArgumentException e) {
Switchboard.getSwitchboard().log.fine("access by unauthorized or unknown user: no transaction token delivered");
}

String key = "";
String value = "";
Expand Down
6 changes: 5 additions & 1 deletion source/net/yacy/htroot/ConfigSearchPage_p.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,11 @@ public static serverObjects respond(final RequestHeader header, final serverObje
}

/* Acquire a transaction token for the next POST form submission */
prop.put(TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));
try {
prop.put(TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));
} catch (IllegalArgumentException e) {
sb.log.fine("access by unauthorized or unknown user: no transaction token delivered");
}

prop.putHTML(SwitchboardConstants.GREETING, sb.getConfig(SwitchboardConstants.GREETING, ""));
prop.putHTML(SwitchboardConstants.GREETING_HOMEPAGE, sb.getConfig(SwitchboardConstants.GREETING_HOMEPAGE, ""));
Expand Down
6 changes: 5 additions & 1 deletion source/net/yacy/htroot/IndexDeletion_p.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ public static serverObjects respond(final RequestHeader header, final serverObje
final serverObjects prop = new serverObjects();

/* Acquire a transaction token for the next POST form submission */
prop.put(TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));
try {
prop.put(TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));
} catch (IllegalArgumentException e) {
sb.log.fine("access by unauthorized or unknown user: no transaction token delivered");
}

final SolrConnector defaultConnector = sb.index.fulltext().getDefaultConnector();
final SolrConnector webgraphConnector = sb.index.fulltext().getWebgraphConnector();
Expand Down
6 changes: 5 additions & 1 deletion source/net/yacy/htroot/IndexFederated_p.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ public static serverObjects respond(final RequestHeader header, final serverObje
}

/* Acquire a transaction token for the next POST form submission */
prop.put(TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));
try {
prop.put(TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));
} catch (IllegalArgumentException e) {
sb.log.fine("access by unauthorized or unknown user: no transaction token delivered");
}

// show solr host table
if (!sb.index.fulltext().connectedRemoteSolr()) {
Expand Down
6 changes: 5 additions & 1 deletion source/net/yacy/htroot/PerformanceQueues_p.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ public static serverObjects respond(final RequestHeader header, final serverObje
File defaultSettingsFile = new File(sb.getAppPath(), "defaults/yacy.init");

/* Acquire a transaction token for the next POST form submission */
prop.put(TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));
try {
prop.put(TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));
} catch (IllegalArgumentException e) {
sb.log.fine("access by unauthorized or unknown user: no transaction token delivered");
}

// get segment
final Segment indexSegment = sb.index;
Expand Down
6 changes: 5 additions & 1 deletion source/net/yacy/htroot/SearchAccessRate_p.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ public static serverObjects respond(final RequestHeader header, final serverObje
final serverObjects prop = new serverObjects();

/* Acquire a transaction token for the next POST form submission */
prop.put(TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));
try {
prop.put(TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));
} catch (IllegalArgumentException e) {
sb.log.fine("access by unauthorized or unknown user: no transaction token delivered");
}

if (post != null) {
/*
Expand Down
6 changes: 5 additions & 1 deletion source/net/yacy/htroot/Steering.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ public static serverObjects respond(final RequestHeader header, final serverObje
if(ss != null && ((Switchboard) ss).verifyAuthentication(header)) {
/* YaCyDefaultServlet will detect it and then also fill the custom HTTP response header used by the JavaScript shutdown and restart actions
* or any external API requesting tool */
prop.put(TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));
try {
prop.put(TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));
} catch (IllegalArgumentException e) {
((Switchboard) ss).log.fine("access by unauthorized or unknown user: no transaction token delivered");
}
/* Also add to the Steering.html page info block for eventual display of this page without parameter */
prop.put("info_" + TransactionManager.TRANSACTION_TOKEN_PARAM, TransactionManager.getTransactionToken(header));
} else {
Expand Down

0 comments on commit 7830268

Please sign in to comment.