Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion zap/src/main/dist/lang/Messages_ja_JP.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2671,7 +2671,7 @@ search.toolbar.warn.regex.match.empty.string.button.search = \u691c\u7d22
search.toolbar.warn.regex.match.empty.string.text = \u5165\u529b\u3055\u308c\u305f\u6b63\u898f\u8868\u73fe\u306f\u7a7a\u6587\u5b57\u5217\u306b\u30de\u30c3\u30c1\u3057\u307e\u3059\u3002\n\u5927\u91cf\u306e\u4e0d\u8981\u306a\u7d50\u679c\u304c\u8868\u793a\u3055\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002\n\u7d9a\u884c\u3057\u307e\u3059\u304b?
search.toolbar.warn.regex.match.empty.string.title = \u6b63\u898f\u8868\u73fe\u304c\u9069\u5207\u3067\u306a\u3044\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059

session.ascan.exclude.title = \u30b9\u30ad\u30e3\u30f3\u304b\u3089\u9664\u5916
session.ascan.exclude.title = \u30b9\u30ad\u30e3\u30ca\u30fc\u304b\u3089\u9664\u5916
session.ascan.label.ignore = \u30a2\u30af\u30c6\u30a3\u30d6\u30b9\u30ad\u30e3\u30f3\u3067\u7121\u8996\u3055\u308c\u308bURL
session.desc = \u30bb\u30c3\u30b7\u30e7\u30f3\u30c8\u30fc\u30af\u30f3\u306e\u7ba1\u7406
session.dialog.title = \u30bb\u30c3\u30b7\u30e7\u30f3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public static enum State {
private static final Logger LOGGER = LogManager.getLogger(ActiveScan.class);

private boolean persistTemporaryMessages;
private boolean warnDbFull = true;

@Deprecated
public ActiveScan(
Expand Down Expand Up @@ -298,7 +299,14 @@ public void notifyNewMessage(final HttpMessage msg) {
msg.setHistoryRef(null);
hRefs.add(hRef.getHistoryId());
} catch (HttpMalformedHeaderException | DatabaseException e) {
LOGGER.error(e.getMessage(), e);
if (hasCause(e, "Data File size limit is reached")) {
if (warnDbFull) {
warnDbFull = false;
LOGGER.warn("Unable to persist temporary message, database is full.", e);
}
} else {
LOGGER.error(e.getMessage(), e);
}
}
} else {
hRefs.add(hRef.getHistoryId());
Expand All @@ -314,6 +322,18 @@ public void notifyNewMessage(final HttpMessage msg) {
}
}

private static boolean hasCause(Exception e, String wantedMessage) {
Throwable cause = e.getCause();
if (cause == null) {
return false;
}
String message = cause.getMessage();
if (message == null) {
return false;
}
return message.contains(wantedMessage);
}

private void addHistoryReferenceInEdt(final HistoryReference hRef) {
EventQueue.invokeLater(
new Runnable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ public class ExtensionParams extends ExtensionAdaptor
private ExtensionHttpSessions extensionHttpSessions;
private ParamScanner paramScanner;

private boolean warnDbFull = true;

public ExtensionParams() {
super(NAME);
this.setOrder(58);
Expand Down Expand Up @@ -196,6 +198,8 @@ protected ParamsPanel getParamsPanel() {

@Override
public void sessionChanged(final Session session) {
warnDbFull = true;

if (EventQueue.isDispatchThread()) {
sessionChangedEventHandler(session);

Expand Down Expand Up @@ -381,18 +385,35 @@ private void persist(HtmlParameterStats param) {
setToString(param.getValues()));
}
} catch (DatabaseException e) {
if (e.getCause().getMessage().contains("truncation")) {
if (hasCause(e, "truncation")) {
LOGGER.warn("Could not add or update param: {}", param.getName());
LOGGER.warn(
"It is likely that the length of one of the data elements exceeded the column size.");
LOGGER.warn(e.getMessage());
LOGGER.debug(e.getMessage(), e);
} else if (hasCause(e, "Data File size limit is reached")) {
if (warnDbFull) {
warnDbFull = false;
LOGGER.warn("Unable to persist parameter, database is full.", e);
}
} else {
LOGGER.error(e.getMessage(), e);
}
}
}

private static boolean hasCause(Exception e, String wantedMessage) {
Throwable cause = e.getCause();
if (cause == null) {
return false;
}
String message = cause.getMessage();
if (message == null) {
return false;
}
return message.contains(wantedMessage);
}

public boolean onHttpResponseReceive(HttpMessage msg) {

// Check we know the site
Expand Down
Loading