Skip to content

Commit

Permalink
Merge branch 'main' into feature/extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanL1997 committed Jul 25, 2023
2 parents a9451dd + 8063e1b commit 1268dee
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 14 deletions.
13 changes: 13 additions & 0 deletions TRIAGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ While we are always happy to help the community, the best resource for implement

There you can find answers to many common questions as well as speak with implementation experts.

### What are the issue labels associated with triaging?

Yes, there are several labels that are used to identify the 'state' of issues filed in OpenSearch and the Security Plugin.

| Label | When applied | Meaning |
| ----- | ------------ | ------- |
| Untriaged | When issues are created or re-opened. | Issues labeled as 'Untriaged' require the attention of the repository maintainers and may need to be prioritized for quicker resolution. It's crucial to keep the count of 'Untriaged' labels low to ensure all potential security issues are addressed in a timely manner. See [SECURITY.md](https://github.com/opensearch-project/security/blob/main/SECURITY.md) for more details on handling these issues. |
| Triaged | During triage meetings. | Issues labeled as 'Triaged' have been reviewed and are deemed actionable. Opening a pull request for an issue with the 'Triaged' label has a higher likelihood of approval from the project maintainers, particularly in novel areas. |
| Neither Label | During triage meetings. | This category is for issues that lack sufficient details to formulate a potential solution. Until more details are provided, it's difficult to ascertain if a proposed solution would be acceptable. When dealing with an 'Untriaged' issue that falls into this category, the triage team should provide further insights so the issue can be appropriately closed or labeled as 'Triaged'. Issues in this state are reviewed during every triage meeting. |
| Help Wanted | Anytime. | Issues marked as 'Help Wanted' signal that they are actionable and not the current focus of the project maintainers. Community contributions are especially encouraged for these issues. |
| Good First Issue | Anytime. | Issues labeled as 'Good First Issue' are small in scope and can be resolved with a single pull request. These are recommended starting points for newcomers looking to make their first contributions. |


### What if my issue is critical to OpenSearch operations, do I have to wait for the weekly meeting for it to be addressed?

All new issues for the [security](https://github.com/opensearch-project/security/issues?q=is%3Aissue+is%3Aopen+label%3Auntriaged) repo and [security-dashboards](https://github.com/opensearch-project/security-dashboards-plugin/issues?q=is%3Aissue+is%3Aopen+-label%3Atriaged) repo are reviewed daily to check for critical issues which require immediate triaging. If an issue relates to a severe concern for OpenSearch operation, it will be triaged by a maintainer mid-week. You can still come to discuss an issue at the following meeting even if it has already been triaged during the week.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private boolean handleLowLevel(RestRequest restRequest, RestChannel restChannel)
XPathExpressionException, ParserConfigurationException, SAXException, SettingsException {
try {

if (restRequest.getXContentType() != XContentType.JSON) {
if (restRequest.getMediaType() != XContentType.JSON) {
throw new OpenSearchSecurityException(
"/_opendistro/_security/api/authtoken expects content with type application/json",
RestStatus.UNSUPPORTED_MEDIA_TYPE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.opensearch.common.settings.Settings;
import org.opensearch.common.transport.TransportAddress;
import org.opensearch.common.xcontent.XContentHelper;
import org.opensearch.core.xcontent.MediaType;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.common.xcontent.json.JsonXContent;
import org.opensearch.core.xcontent.NamedXContentRegistry;
Expand Down Expand Up @@ -657,7 +658,7 @@ public void logDocumentWritten(ShardId shardId, GetResult originalResult, Index
// originalResult.internalSourceRef()));

// current source, normally not null or empty
msg.addTupleToRequestBody(new Tuple<XContentType, BytesReference>(XContentType.JSON, currentIndex.source()));
msg.addTupleToRequestBody(new Tuple<MediaType, BytesReference>(XContentType.JSON, currentIndex.source()));
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.opensearch.common.collect.Tuple;
import org.opensearch.common.transport.TransportAddress;
import org.opensearch.common.xcontent.XContentHelper;
import org.opensearch.core.xcontent.MediaType;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.common.xcontent.json.JsonXContent;
import org.opensearch.core.common.Strings;
Expand Down Expand Up @@ -205,7 +206,7 @@ void addSecurityConfigWriteDiffSource(final String diff, final String id) {
// }
// }

public void addTupleToRequestBody(Tuple<XContentType, BytesReference> xContentTuple) {
public void addTupleToRequestBody(Tuple<MediaType, BytesReference> xContentTuple) {
if (xContentTuple != null) {
try {
auditInfo.put(REQUEST_BODY, XContentHelper.convertToJson(xContentTuple.v2(), false, xContentTuple.v1()));
Expand Down Expand Up @@ -377,7 +378,7 @@ void addRestRequestInfo(final RestRequest request, final AuditConfig.Filter filt
addRestMethod(request.method());
if (filter.shouldLogRequestBody() && request.hasContentOrSourceParam()) {
try {
final Tuple<XContentType, BytesReference> xContentTuple = request.contentOrSourceParam();
final Tuple<MediaType, BytesReference> xContentTuple = request.contentOrSourceParam();
final String requestBody = XContentHelper.convertToJson(xContentTuple.v2(), false, xContentTuple.v1());
if (path != null
&& requestBody != null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import org.opensearch.common.settings.Settings;
import org.opensearch.common.transport.TransportAddress;
import org.opensearch.common.xcontent.XContentFactory;
import org.opensearch.core.xcontent.MediaType;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.core.index.Index;
Expand Down Expand Up @@ -381,7 +382,7 @@ private static void addIndicesSourceSafe(
final String[] indices,
final IndexNameExpressionResolver resolver,
final ClusterService cs,
final XContentType xContentType,
final MediaType mediaType,
final Object source,
final Settings settings,
boolean resolveIndices,
Expand Down Expand Up @@ -423,27 +424,27 @@ private static void addIndicesSourceSafe(
if (sourceIsSensitive && source != null) {
if (!allIndicesMatcher.test(securityIndex)) {
if (source instanceof BytesReference) {
msg.addTupleToRequestBody(convertSource(xContentType, (BytesReference) source));
msg.addTupleToRequestBody(convertSource(mediaType, (BytesReference) source));
} else {
msg.addMapToRequestBody((Map) source);
}
}
} else if (source != null) {
if (source instanceof BytesReference) {
msg.addTupleToRequestBody(convertSource(xContentType, (BytesReference) source));
msg.addTupleToRequestBody(convertSource(mediaType, (BytesReference) source));
} else {
msg.addMapToRequestBody((Map) source);
}
}
}
}

private static Tuple<XContentType, BytesReference> convertSource(XContentType type, BytesReference bytes) {
private static Tuple<MediaType, BytesReference> convertSource(MediaType type, BytesReference bytes) {
if (type == null) {
type = XContentType.JSON;
}

return new Tuple<XContentType, BytesReference>(type, bytes);
return new Tuple<MediaType, BytesReference>(type, bytes);
}

private static String[] arrayOrEmpty(String[] array) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public PatchableResourceApiAction(
}

private void handlePatch(RestChannel channel, final RestRequest request, final Client client) throws IOException {
if (request.getXContentType() != XContentType.JSON) {
if (request.getMediaType() != XContentType.JSON) {
badRequestResponse(channel, "PATCH accepts only application/json");
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import org.opensearch.core.common.bytes.BytesReference;
import org.opensearch.common.io.stream.BytesStreamOutput;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.core.xcontent.MediaType;
import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.rest.RestChannel;
import org.opensearch.rest.RestRequest;
Expand Down Expand Up @@ -992,7 +992,7 @@ public XContentBuilder newErrorBuilder() throws IOException {
}

@Override
public XContentBuilder newBuilder(XContentType xContentType, boolean useFiltering) throws IOException {
public XContentBuilder newBuilder(MediaType mediaType, boolean useFiltering) throws IOException {
return null;
}

Expand All @@ -1018,8 +1018,7 @@ public void sendResponse(RestResponse response) {
}

@Override
public XContentBuilder newBuilder(XContentType xContentType, XContentType responseContentType, boolean useFiltering)
throws IOException {
public XContentBuilder newBuilder(MediaType mediaType, MediaType responseContentType, boolean useFiltering) throws IOException {
return null;
}

Expand Down

0 comments on commit 1268dee

Please sign in to comment.