Skip to content

Commit

Permalink
Merge branch '7.10' into eui-29-3-2
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Dec 14, 2020
2 parents ee69661 + 032abfc commit 59ac924
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ describe('Jira service', () => {
beforeAll(() => {
service = createExternalService(
{
config: { apiUrl: 'https://siem-kibana.atlassian.net', projectKey: 'CK' },
// The trailing slash at the end of the url is intended.
// All API calls need to have the trailing slash removed.
config: { apiUrl: 'https://siem-kibana.atlassian.net/', projectKey: 'CK' },
secrets: { apiToken: 'token', email: '[email protected]' },
},
logger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,22 @@ export const createExternalService = (
throw Error(`[Action]${i18n.NAME}: Wrong configuration.`);
}

const incidentUrl = `${url}/${BASE_URL}/issue`;
const capabilitiesUrl = `${url}/${CAPABILITIES_URL}`;
const urlWithoutTrailingSlash = url.endsWith('/') ? url.slice(0, -1) : url;
const incidentUrl = `${urlWithoutTrailingSlash}/${BASE_URL}/issue`;
const capabilitiesUrl = `${urlWithoutTrailingSlash}/${CAPABILITIES_URL}`;
const commentUrl = `${incidentUrl}/{issueId}/comment`;
const getIssueTypesOldAPIURL = `${url}/${BASE_URL}/issue/createmeta?projectKeys=${projectKey}&expand=projects.issuetypes.fields`;
const getIssueTypeFieldsOldAPIURL = `${url}/${BASE_URL}/issue/createmeta?projectKeys=${projectKey}&issuetypeIds={issueTypeId}&expand=projects.issuetypes.fields`;
const getIssueTypesUrl = `${url}/${BASE_URL}/issue/createmeta/${projectKey}/issuetypes`;
const getIssueTypeFieldsUrl = `${url}/${BASE_URL}/issue/createmeta/${projectKey}/issuetypes/{issueTypeId}`;
const searchUrl = `${url}/${BASE_URL}/search`;
const getIssueTypesOldAPIURL = `${urlWithoutTrailingSlash}/${BASE_URL}/issue/createmeta?projectKeys=${projectKey}&expand=projects.issuetypes.fields`;
const getIssueTypeFieldsOldAPIURL = `${urlWithoutTrailingSlash}/${BASE_URL}/issue/createmeta?projectKeys=${projectKey}&issuetypeIds={issueTypeId}&expand=projects.issuetypes.fields`;
const getIssueTypesUrl = `${urlWithoutTrailingSlash}/${BASE_URL}/issue/createmeta/${projectKey}/issuetypes`;
const getIssueTypeFieldsUrl = `${urlWithoutTrailingSlash}/${BASE_URL}/issue/createmeta/${projectKey}/issuetypes/{issueTypeId}`;
const searchUrl = `${urlWithoutTrailingSlash}/${BASE_URL}/search`;

const axiosInstance = axios.create({
auth: { username: email, password: apiToken },
});

const getIncidentViewURL = (key: string) => {
return `${url}/${VIEW_INCIDENT_URL}/${key}`;
return `${urlWithoutTrailingSlash}/${VIEW_INCIDENT_URL}/${key}`;
};

const getCommentsURL = (issueId: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ describe('IBM Resilient service', () => {
beforeAll(() => {
service = createExternalService(
{
config: { apiUrl: 'https://resilient.elastic.co', orgId: '201' },
// The trailing slash at the end of the url is intended.
// All API calls need to have the trailing slash removed.
config: { apiUrl: 'https://resilient.elastic.co/', orgId: '201' },
secrets: { apiKeyId: 'keyId', apiKeySecret: 'secret' },
},
logger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ describe('ServiceNow service', () => {
beforeAll(() => {
service = createExternalService(
{
config: { apiUrl: 'https://dev102283.service-now.com' },
// The trailing slash at the end of the url is intended.
// All API calls need to have the trailing slash removed.
config: { apiUrl: 'https://dev102283.service-now.com/' },
secrets: { username: 'admin', password: 'admin' },
},
logger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ export const createExternalService = (
throw Error(`[Action]${i18n.NAME}: Wrong configuration.`);
}

const incidentUrl = `${url}/${INCIDENT_URL}`;
const urlWithoutTrailingSlash = url.endsWith('/') ? url.slice(0, -1) : url;
const incidentUrl = `${urlWithoutTrailingSlash}/${INCIDENT_URL}`;
const axiosInstance = axios.create({
auth: { username, password },
});

const getIncidentViewURL = (id: string) => {
return `${url}/${VIEW_INCIDENT_URL}${id}`;
return `${urlWithoutTrailingSlash}/${VIEW_INCIDENT_URL}${id}`;
};

const getIncident = async (id: string) => {
Expand Down
7 changes: 6 additions & 1 deletion x-pack/plugins/ingest_manager/server/routes/security.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ export function enforceSuperUser<T1, T2, T3>(
const security = appContextService.getSecurity();
const user = security.authc.getCurrentUser(req);
if (!user) {
return res.unauthorized();
return res.forbidden({
body: {
message:
'Access to Fleet API require the superuser role, and for stack security features to be enabled.',
},
});
}

const userRoles = user.roles || [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,16 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
expect(links.map((link) => link.text)).to.contain('Stack Management');
});

it('should render the "Stack" section with License Management', async () => {
await PageObjects.common.navigateToApp('management');
const sections = await managementMenu.getSections();
expect(sections).to.have.length(3);
expect(sections[2]).to.eql({
sectionId: 'stack',
sectionLinks: ['license_management', 'upgrade_assistant'],
describe('[SkipCloud] global dashboard with license management user: skip cloud', function () {
this.tags('skipCloud');
it('should render the "Stack" section with License Management', async () => {
await PageObjects.common.navigateToApp('management');
const sections = await managementMenu.getSections();
expect(sections).to.have.length(3);
expect(sections[2]).to.eql({
sectionId: 'stack',
sectionLinks: ['license_management', 'upgrade_assistant'],
});
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const appsMenu = getService('appsMenu');
const managementMenu = getService('managementMenu');

describe('security', () => {
describe('security', function () {
before(async () => {
await esArchiver.load('empty_kibana');
await PageObjects.common.navigateToApp('home');
Expand Down Expand Up @@ -58,13 +58,16 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
expect(links.map((link) => link.text)).to.contain('Stack Management');
});

it('should render the "Stack" section with Upgrde Assistant', async () => {
await PageObjects.common.navigateToApp('management');
const sections = await managementMenu.getSections();
expect(sections).to.have.length(3);
expect(sections[2]).to.eql({
sectionId: 'stack',
sectionLinks: ['license_management', 'upgrade_assistant'],
describe('[SkipCloud] global dashboard all with global_upgrade_assistant_role', function () {
this.tags('skipCloud');
it('should render the "Stack" section with Upgrde Assistant', async function () {
await PageObjects.common.navigateToApp('management');
const sections = await managementMenu.getSections();
expect(sections).to.have.length(3);
expect(sections[2]).to.eql({
sectionId: 'stack',
sectionLinks: ['license_management', 'upgrade_assistant'],
});
});
});
});
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15681,9 +15681,9 @@ [email protected]:
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=

ini@^1.2.0, ini@^1.3.4, ini@^1.3.5, ini@~1.3.0:
version "1.3.5"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927"
integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==
version "1.3.7"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.7.tgz#a09363e1911972ea16d7a8851005d84cf09a9a84"
integrity sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ==

[email protected]:
version "0.1.1"
Expand Down

0 comments on commit 59ac924

Please sign in to comment.